Line data Source code
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/. */
6 :
7 : #ifndef mozilla_dom_ColorPickerParent_h
8 : #define mozilla_dom_ColorPickerParent_h
9 :
10 : #include "mozilla/dom/PColorPickerParent.h"
11 : #include "nsIColorPicker.h"
12 :
13 : namespace mozilla {
14 : namespace dom {
15 :
16 : class ColorPickerParent : public PColorPickerParent
17 : {
18 : public:
19 0 : ColorPickerParent(const nsString& aTitle,
20 : const nsString& aInitialColor)
21 0 : : mTitle(aTitle)
22 0 : , mInitialColor(aInitialColor)
23 0 : {}
24 :
25 : virtual mozilla::ipc::IPCResult RecvOpen() override;
26 : virtual void ActorDestroy(ActorDestroyReason aWhy) override;
27 :
28 : class ColorPickerShownCallback final
29 : : public nsIColorPickerShownCallback
30 : {
31 : public:
32 0 : explicit ColorPickerShownCallback(ColorPickerParent* aColorPickerParnet)
33 0 : : mColorPickerParent(aColorPickerParnet)
34 0 : {}
35 :
36 : NS_DECL_ISUPPORTS
37 : NS_DECL_NSICOLORPICKERSHOWNCALLBACK
38 :
39 : void Destroy();
40 :
41 : private:
42 0 : ~ColorPickerShownCallback() {}
43 : ColorPickerParent* mColorPickerParent;
44 : };
45 :
46 : private:
47 0 : virtual ~ColorPickerParent() {}
48 :
49 : bool CreateColorPicker();
50 :
51 : RefPtr<ColorPickerShownCallback> mCallback;
52 : nsCOMPtr<nsIColorPicker> mPicker;
53 :
54 : nsString mTitle;
55 : nsString mInitialColor;
56 : };
57 :
58 : } // namespace dom
59 : } // namespace mozilla
60 :
61 : #endif // mozilla_dom_ColorPickerParent_h
|