1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 #ifndef mozilla_dom_ColorPickerParent_h
8 #define mozilla_dom_ColorPickerParent_h
10 #include "mozilla/dom/PColorPickerParent.h"
11 #include "nsIColorPicker.h"
13 namespace mozilla::dom
{
15 class ColorPickerParent
: public PColorPickerParent
{
17 ColorPickerParent(const nsString
& aTitle
, const nsString
& aInitialColor
,
18 const nsTArray
<nsString
>& aDefaultColors
)
20 mInitialColor(aInitialColor
),
21 mDefaultColors(aDefaultColors
.Clone()) {}
23 NS_INLINE_DECL_REFCOUNTING(ColorPickerParent
, final
)
25 virtual mozilla::ipc::IPCResult
RecvOpen() override
;
26 virtual void ActorDestroy(ActorDestroyReason aWhy
) override
;
28 class ColorPickerShownCallback final
: public nsIColorPickerShownCallback
{
30 explicit ColorPickerShownCallback(ColorPickerParent
* aColorPickerParnet
)
31 : mColorPickerParent(aColorPickerParnet
) {}
34 NS_DECL_NSICOLORPICKERSHOWNCALLBACK
39 ~ColorPickerShownCallback() = default;
40 RefPtr
<ColorPickerParent
> mColorPickerParent
;
44 virtual ~ColorPickerParent() = default;
46 bool CreateColorPicker();
48 RefPtr
<ColorPickerShownCallback
> mCallback
;
49 nsCOMPtr
<nsIColorPicker
> mPicker
;
52 nsString mInitialColor
;
53 nsTArray
<nsString
> mDefaultColors
;
56 } // namespace mozilla::dom
58 #endif // mozilla_dom_ColorPickerParent_h