OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_COLOR_SELECT_OBSERVER_H_ | |
6 #define CHROME_BROWSER_COLOR_SELECT_OBSERVER_H_ | |
7 #pragma once | |
8 | |
9 #include "content/public/browser/web_contents_observer.h" | |
10 | |
11 #if defined(OS_WIN) | |
12 #include "chrome/browser/ui/color_chooser_dialog.h" | |
Ben Goodger (Google)
2012/01/17 16:29:09
Where is this file?
For that matter, why is it a
keishi
2012/01/27 04:34:08
It was in a different patch, but I've consolidated
| |
13 #else | |
14 #include "chrome/browser/ui/color_chooser.h" | |
15 #endif | |
16 | |
17 class RenderViewHost; | |
18 struct ViewHostMsg_SetSelectedColorInColorChooser_Params; | |
19 | |
20 class ColorSelectObserver | |
21 : public content::WebContentsObserver, | |
22 #if defined(OS_WIN) | |
23 public ColorChooserDialog::Listener { | |
Ben Goodger (Google)
2012/01/17 16:29:09
this kind of ifdef is very ugly and usually indica
keishi
2012/01/27 04:34:08
Removed.
| |
24 #else | |
25 public ColorChooser::Listener { | |
26 #endif | |
27 public: | |
28 explicit ColorSelectObserver(content::WebContents* web_contents); | |
29 virtual ~ColorSelectObserver(); | |
30 | |
31 virtual void DidChooseColor(WebKit::WebColor color) OVERRIDE; | |
32 virtual void DidEnd() OVERRIDE; | |
33 | |
34 private: | |
35 // TabContentsObserver overrides. | |
36 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
37 | |
38 // Called when web page asks to open the color chooser. | |
39 void OnOpenColorChooser( | |
40 const ViewHostMsg_SetSelectedColorInColorChooser_Params& params); | |
41 | |
42 // Called when the originating element is no longer available and the color | |
43 // chooser should end. | |
44 void OnEndColorChooser(); | |
45 | |
46 // Called when input element's value changes and the color chooser should | |
47 // reflect that. | |
48 void OnSetSelectedColorInColorChooser( | |
49 const ViewHostMsg_SetSelectedColorInColorChooser_Params& params); | |
50 | |
51 // The RenderViewHost for the page showing the color chooser. | |
52 // EndColorChooser and SetSelectedColorInColorChooser from other | |
53 // RenderViewHosts will be ignored. | |
54 RenderViewHost* render_view_host_; | |
55 #if defined(OS_WIN) | |
56 // Dialog box used for choosing color. | |
57 scoped_refptr<ColorChooserDialog> color_chooser_dialog_; | |
58 #endif | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(ColorSelectObserver); | |
61 }; | |
62 | |
63 #endif // CHROME_BROWSER_COLOR_SELECT_OBSERVER_H_ | |
OLD | NEW |