Backed out changeset 62f7af8fe549 (bug 1843981) for causing valgrind bustage. CLOSED...
[gecko.git] / dom / ipc / ColorPickerParent.h
blob00b08280349c4108fba2488ceecdcbb8bc29faf9
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 {
16 public:
17 ColorPickerParent(const nsString& aTitle, const nsString& aInitialColor,
18 const nsTArray<nsString>& aDefaultColors)
19 : mTitle(aTitle),
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 {
29 public:
30 explicit ColorPickerShownCallback(ColorPickerParent* aColorPickerParnet)
31 : mColorPickerParent(aColorPickerParnet) {}
33 NS_DECL_ISUPPORTS
34 NS_DECL_NSICOLORPICKERSHOWNCALLBACK
36 void Destroy();
38 private:
39 ~ColorPickerShownCallback() = default;
40 RefPtr<ColorPickerParent> mColorPickerParent;
43 private:
44 virtual ~ColorPickerParent() = default;
46 bool CreateColorPicker();
48 RefPtr<ColorPickerShownCallback> mCallback;
49 nsCOMPtr<nsIColorPicker> mPicker;
51 nsString mTitle;
52 nsString mInitialColor;
53 nsTArray<nsString> mDefaultColors;
56 } // namespace mozilla::dom
58 #endif // mozilla_dom_ColorPickerParent_h