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(mozIDOMWindowProxy
* aParent
, const nsAString
& aTitle
,
17 const nsAString
& aInitialColor
,
18 const nsTArray
<nsString
>& aDefaultColors
) {
19 BrowserChild
* browserChild
= BrowserChild::GetFrom(aParent
);
21 return NS_ERROR_FAILURE
;
24 browserChild
->SendPColorPickerConstructor(this, aTitle
, aInitialColor
,
30 nsColorPickerProxy::Open(
31 nsIColorPickerShownCallback
* aColorPickerShownCallback
) {
32 NS_ENSURE_STATE(!mCallback
);
33 mCallback
= aColorPickerShownCallback
;
39 mozilla::ipc::IPCResult
nsColorPickerProxy::RecvUpdate(
40 const nsAString
& aColor
) {
42 mCallback
->Update(aColor
);
47 mozilla::ipc::IPCResult
nsColorPickerProxy::Recv__delete__(
48 const nsAString
& aColor
) {
50 mCallback
->Done(aColor
);