#include "third_party/blink/renderer/core/html/forms/color_chooser_ui_controller.h"
#include "build/build_config.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/public/web/web_local_frame_client.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/html/forms/color_chooser_client.h"
#include "third_party/blink/renderer/platform/graphics/color.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace blink {
ColorChooserUIController::ColorChooserUIController(
LocalFrame* frame,
blink::ColorChooserClient* client)
: … { … }
ColorChooserUIController::~ColorChooserUIController() = default;
void ColorChooserUIController::Trace(Visitor* visitor) const { … }
void ColorChooserUIController::OpenUI() { … }
void ColorChooserUIController::SetSelectedColor(const Color& color) { … }
void ColorChooserUIController::EndChooser() { … }
AXObject* ColorChooserUIController::RootAXObject(Element* popup_owner) { … }
void ColorChooserUIController::DidChooseColor(uint32_t color) { … }
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
void ColorChooserUIController::OpenColorChooser() {
DCHECK(!chooser_);
scoped_refptr<base::SequencedTaskRunner> runner =
frame_->DomWindow()->GetExecutionContext()->GetTaskRunner(
TaskType::kUserInteraction);
frame_->GetBrowserInterfaceBroker().GetInterface(
color_chooser_factory_.BindNewPipeAndPassReceiver(runner));
color_chooser_factory_->OpenColorChooser(
chooser_.BindNewPipeAndPassReceiver(runner),
receiver_.BindNewPipeAndPassRemote(runner), client_->CurrentColor().Rgb(),
client_->Suggestions());
receiver_.set_disconnect_handler(WTF::BindOnce(
&ColorChooserUIController::EndChooser, WrapWeakPersistent(this)));
}
#endif
}