Index: chrome/browser/color_select_observer.h |
diff --git a/chrome/browser/color_select_observer.h b/chrome/browser/color_select_observer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..39fcdf230f86707c665b9c05d7d180104e73d5b3 |
--- /dev/null |
+++ b/chrome/browser/color_select_observer.h |
@@ -0,0 +1,63 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_COLOR_SELECT_OBSERVER_H_ |
+#define CHROME_BROWSER_COLOR_SELECT_OBSERVER_H_ |
+#pragma once |
+ |
+#include "content/public/browser/web_contents_observer.h" |
+ |
+#if defined(OS_WIN) |
+#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
|
+#else |
+#include "chrome/browser/ui/color_chooser.h" |
+#endif |
+ |
+class RenderViewHost; |
+struct ViewHostMsg_SetSelectedColorInColorChooser_Params; |
+ |
+class ColorSelectObserver |
+ : public content::WebContentsObserver, |
+#if defined(OS_WIN) |
+ 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.
|
+#else |
+ public ColorChooser::Listener { |
+#endif |
+ public: |
+ explicit ColorSelectObserver(content::WebContents* web_contents); |
+ virtual ~ColorSelectObserver(); |
+ |
+ virtual void DidChooseColor(WebKit::WebColor color) OVERRIDE; |
+ virtual void DidEnd() OVERRIDE; |
+ |
+ private: |
+ // TabContentsObserver overrides. |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ |
+ // Called when web page asks to open the color chooser. |
+ void OnOpenColorChooser( |
+ const ViewHostMsg_SetSelectedColorInColorChooser_Params& params); |
+ |
+ // Called when the originating element is no longer available and the color |
+ // chooser should end. |
+ void OnEndColorChooser(); |
+ |
+ // Called when input element's value changes and the color chooser should |
+ // reflect that. |
+ void OnSetSelectedColorInColorChooser( |
+ const ViewHostMsg_SetSelectedColorInColorChooser_Params& params); |
+ |
+ // The RenderViewHost for the page showing the color chooser. |
+ // EndColorChooser and SetSelectedColorInColorChooser from other |
+ // RenderViewHosts will be ignored. |
+ RenderViewHost* render_view_host_; |
+#if defined(OS_WIN) |
+ // Dialog box used for choosing color. |
+ scoped_refptr<ColorChooserDialog> color_chooser_dialog_; |
+#endif |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ColorSelectObserver); |
+}; |
+ |
+#endif // CHROME_BROWSER_COLOR_SELECT_OBSERVER_H_ |