1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsColorPickerProxy.h"
9 #include "mozilla/dom/BrowserChild.h"
11 using namespace mozilla::dom
;
13 NS_IMPL_ISUPPORTS(nsColorPickerProxy
, nsIColorPicker
)
16 nsColorPickerProxy::Init(BrowsingContext
* aBrowsingContext
,
17 const nsAString
& aTitle
,
18 const nsAString
& aInitialColor
,
19 const nsTArray
<nsString
>& aDefaultColors
) {
20 BrowserChild
* browserChild
=
21 BrowserChild::GetFrom(aBrowsingContext
->GetDocShell());
23 return NS_ERROR_FAILURE
;
26 browserChild
->SendPColorPickerConstructor(this, aBrowsingContext
, aTitle
,
27 aInitialColor
, aDefaultColors
);
32 nsColorPickerProxy::Open(
33 nsIColorPickerShownCallback
* aColorPickerShownCallback
) {
34 NS_ENSURE_STATE(!mCallback
);
35 mCallback
= aColorPickerShownCallback
;
41 mozilla::ipc::IPCResult
nsColorPickerProxy::RecvUpdate(
42 const nsAString
& aColor
) {
44 mCallback
->Update(aColor
);
49 mozilla::ipc::IPCResult
nsColorPickerProxy::Recv__delete__(
50 const nsAString
& aColor
) {
52 mCallback
->Done(aColor
);
58 void nsColorPickerProxy::ActorDestroy(ActorDestroyReason aWhy
) {
60 mCallback
->Done(u
""_ns
);