This source file includes following definitions.
- m_client
- openUI
- setSelectedColor
- endChooser
- didChooseColor
- didEndChooser
- openColorChooser
#include "config.h"
#include "ColorChooserUIController.h"
#include "ChromeClientImpl.h"
#include "WebColorChooser.h"
#include "WebColorSuggestion.h"
#include "WebViewClient.h"
#include "WebViewImpl.h"
#include "platform/ColorChooserClient.h"
#include "platform/graphics/Color.h"
#include "public/platform/WebColor.h"
using namespace WebCore;
namespace blink {
ColorChooserUIController::ColorChooserUIController(ChromeClientImpl* chromeClient, ColorChooserClient* client)
: m_chromeClient(chromeClient)
, m_client(client)
{
}
ColorChooserUIController::~ColorChooserUIController()
{
}
void ColorChooserUIController::openUI()
{
openColorChooser();
}
void ColorChooserUIController::setSelectedColor(const Color& color)
{
ASSERT(m_chooser);
m_chooser->setSelectedColor(static_cast<WebColor>(color.rgb()));
}
void ColorChooserUIController::endChooser()
{
if (m_chooser)
m_chooser->endChooser();
}
void ColorChooserUIController::didChooseColor(const WebColor& color)
{
ASSERT(m_client);
m_client->didChooseColor(Color(static_cast<RGBA32>(color)));
}
void ColorChooserUIController::didEndChooser()
{
ASSERT(m_client);
m_chooser = nullptr;
m_client->didEndChooser();
}
void ColorChooserUIController::openColorChooser()
{
ASSERT(!m_chooser);
WebViewClient* webViewClient = static_cast<WebViewImpl*>(m_chromeClient->webView())->client();
if (!webViewClient)
return;
m_chooser = adoptPtr(webViewClient->createColorChooser(
this, static_cast<WebColor>(m_client->currentColor().rgb()), m_client->suggestions()));
}
}