Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(639)

Side by Side Diff: chrome/browser/ui/views/color_chooser_dialog.h

Issue 10442020: Initial implementation of ColorChooser for Aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_DIALOG_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_DIALOG_H_
6 #define CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_DIALOG_H_ 6 #define CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_DIALOG_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "chrome/browser/ui/base_shell_dialog.h" 10 #include "chrome/browser/ui/base_shell_dialog.h"
11 #include "chrome/browser/ui/views/color_chooser_dialog.h" 11 #include "chrome/browser/ui/views/color_chooser_dialog.h"
12 #include "chrome/browser/ui/views/base_shell_dialog_win.h" 12 #include "chrome/browser/ui/views/base_shell_dialog_win.h"
13 #include "third_party/skia/include/core/SkColor.h" 13 #include "third_party/skia/include/core/SkColor.h"
14 14
15 namespace views {
16 class ColorChooserListener;
17 }
18
15 class ColorChooserDialog 19 class ColorChooserDialog
16 : public base::RefCountedThreadSafe<ColorChooserDialog>, 20 : public base::RefCountedThreadSafe<ColorChooserDialog>,
17 public BaseShellDialog, 21 public BaseShellDialog,
18 public BaseShellDialogImpl { 22 public BaseShellDialogImpl {
19 public: 23 public:
20 // An interface implemented by a Listener object wishing to know about the 24 ColorChooserDialog(views::ColorChooserListener* listener,
21 // the results from the color chooser dialog.
22 class Listener {
23 public:
24 virtual ~Listener() {}
25 virtual void DidChooseColor(SkColor color) = 0;
26 virtual void DidEnd() = 0;
27 };
28
29 ColorChooserDialog(Listener* listener,
30 SkColor initial_color, 25 SkColor initial_color,
31 gfx::NativeWindow owning_window); 26 gfx::NativeWindow owning_window);
32 virtual ~ColorChooserDialog(); 27 virtual ~ColorChooserDialog();
33 28
34 // BaseShellDialog: 29 // BaseShellDialog:
35 virtual bool IsRunning(HWND owning_hwnd) const OVERRIDE; 30 virtual bool IsRunning(HWND owning_hwnd) const OVERRIDE;
36 virtual void ListenerDestroyed() OVERRIDE; 31 virtual void ListenerDestroyed() OVERRIDE;
37 32
38 private: 33 private:
39 struct ExecuteOpenParams { 34 struct ExecuteOpenParams {
(...skipping 24 matching lines...) Expand all
64 59
65 // A copy of the custom colors for the current dialog to display and modify. 60 // A copy of the custom colors for the current dialog to display and modify.
66 // This allows us to safely access the colors even if multiple windows are 61 // This allows us to safely access the colors even if multiple windows are
67 // simultaneously showing color choosers (which would cause thread safety 62 // simultaneously showing color choosers (which would cause thread safety
68 // problems if we gave them direct handles to |g_custom_colors|). 63 // problems if we gave them direct handles to |g_custom_colors|).
69 COLORREF custom_colors_[16]; 64 COLORREF custom_colors_[16];
70 65
71 // The listener to notify when the user closes the dialog. This may be set to 66 // The listener to notify when the user closes the dialog. This may be set to
72 // NULL before the color chooser is closed, signalling that the listener no 67 // NULL before the color chooser is closed, signalling that the listener no
73 // longer cares about the outcome. 68 // longer cares about the outcome.
74 Listener* listener_; 69 views::ColorChooserListener* listener_;
75 70
76 DISALLOW_COPY_AND_ASSIGN(ColorChooserDialog); 71 DISALLOW_COPY_AND_ASSIGN(ColorChooserDialog);
77 }; 72 };
78 73
79 #endif // CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_DIALOG_H_ 74 #endif // CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_DIALOG_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/color_chooser_aura.cc ('k') | chrome/browser/ui/views/color_chooser_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698