Bug 1794292 - [ANGLE] cherry-pick init-gl-point-size. r=gfx-reviewers,bradwerth
[gecko.git] / widget / nsColorPickerProxy.cpp
blob0db2a7bd815f3df052784e08ed800c09b2515d15
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)
15 NS_IMETHODIMP
16 nsColorPickerProxy::Init(mozIDOMWindowProxy* aParent, const nsAString& aTitle,
17 const nsAString& aInitialColor,
18 const nsTArray<nsString>& aDefaultColors) {
19 BrowserChild* browserChild = BrowserChild::GetFrom(aParent);
20 if (!browserChild) {
21 return NS_ERROR_FAILURE;
24 browserChild->SendPColorPickerConstructor(this, aTitle, aInitialColor,
25 aDefaultColors);
26 return NS_OK;
29 NS_IMETHODIMP
30 nsColorPickerProxy::Open(
31 nsIColorPickerShownCallback* aColorPickerShownCallback) {
32 NS_ENSURE_STATE(!mCallback);
33 mCallback = aColorPickerShownCallback;
35 SendOpen();
36 return NS_OK;
39 mozilla::ipc::IPCResult nsColorPickerProxy::RecvUpdate(
40 const nsAString& aColor) {
41 if (mCallback) {
42 mCallback->Update(aColor);
44 return IPC_OK();
47 mozilla::ipc::IPCResult nsColorPickerProxy::Recv__delete__(
48 const nsAString& aColor) {
49 if (mCallback) {
50 mCallback->Done(aColor);
51 mCallback = nullptr;
53 return IPC_OK();