1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
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/TabChild.h"
11 using namespace mozilla::dom
;
13 NS_IMPL_ISUPPORTS(nsColorPickerProxy
, nsIColorPicker
)
15 /* void init (in nsIDOMWindow parent, in AString title, in short mode); */
17 nsColorPickerProxy::Init(nsIDOMWindow
* aParent
, const nsAString
& aTitle
,
18 const nsAString
& aInitialColor
)
20 TabChild
* tabChild
= TabChild::GetFrom(aParent
);
22 return NS_ERROR_FAILURE
;
25 tabChild
->SendPColorPickerConstructor(this,
27 nsString(aInitialColor
));
32 /* void open (in nsIColorPickerShownCallback aColorPickerShownCallback); */
34 nsColorPickerProxy::Open(nsIColorPickerShownCallback
* aColorPickerShownCallback
)
36 NS_ENSURE_STATE(!mCallback
);
37 mCallback
= aColorPickerShownCallback
;
44 nsColorPickerProxy::RecvUpdate(const nsString
& aColor
)
47 mCallback
->Update(aColor
);
53 nsColorPickerProxy::Recv__delete__(const nsString
& aColor
)
56 mCallback
->Done(aColor
);