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

Unified Diff: chrome/browser/color_select_helper.h

Issue 9203001: Implement input type=color UI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed comment Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/color_select_helper.h
diff --git a/chrome/browser/color_select_helper.h b/chrome/browser/color_select_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..f48c0076b7aee3b886a9fb0790eab67dd6347fc1
--- /dev/null
+++ b/chrome/browser/color_select_helper.h
@@ -0,0 +1,53 @@
+// 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_HELPER_H_
+#define CHROME_BROWSER_COLOR_SELECT_HELPER_H_
+#pragma once
+
+#include "content/public/browser/web_contents_observer.h"
+
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/ui/color_chooser.h"
+#include "chrome/browser/ui/color_chooser_dialog.h"
+
+class ColorSelectHelper
+ : public ColorChooser::Listener,
+ public ColorChooserDialog::Listener {
+ public:
+ explicit ColorSelectHelper();
+ virtual ~ColorSelectHelper();
+
+ virtual void DidChooseColor(WebKit::WebColor color) OVERRIDE;
+ virtual void DidEnd() OVERRIDE;
+
+ // Called when web page asks to open the color chooser.
+ void OpenColorChooser(content::WebContents* tab,
+ const WebKit::WebColor& color);
+
+ // Called when the originating element is no longer available and the color
+ // chooser should end.
+ void EndColorChooser(content::WebContents* tab);
+
+ // Called when input element's value changes and the color chooser should
+ // reflect that.
+ void SetSelectedColorInColorChooser(content::WebContents* tab,
+ const WebKit::WebColor& color);
+
+ virtual RenderViewHost* GetRenderViewHost() OVERRIDE;
+
+ private:
+
+ // The RenderViewHost for the page showing the color chooser.
+ // EndColorChooser and SetSelectedColorInColorChooser from other
+ // RenderViewHosts will be ignored.
+ content::WebContents* tab_;
+
+ // Dialog box used for choosing color.
+ scoped_ptr<ColorChooser> color_chooser_;
+
+ DISALLOW_COPY_AND_ASSIGN(ColorSelectHelper);
+};
+
+#endif // CHROME_BROWSER_COLOR_SELECT_HELPER_H_

Powered by Google App Engine
This is Rietveld 408576698