| 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_HELPER_H_ |
| 6 #define CHROME_BROWSER_COLOR_SELECT_HELPER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "content/public/browser/web_contents_observer.h" |
| 10 |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "chrome/browser/ui/color_chooser.h" |
| 13 #include "chrome/browser/ui/color_chooser_dialog.h" |
| 14 |
| 15 class ColorSelectHelper |
| 16 : public ColorChooser::Listener, |
| 17 public ColorChooserDialog::Listener { |
| 18 public: |
| 19 explicit ColorSelectHelper(); |
| 20 virtual ~ColorSelectHelper(); |
| 21 |
| 22 virtual void DidChooseColor(WebKit::WebColor color) OVERRIDE; |
| 23 virtual void DidEnd() OVERRIDE; |
| 24 |
| 25 // Called when web page asks to open the color chooser. |
| 26 void OpenColorChooser(content::WebContents* tab, |
| 27 const WebKit::WebColor& color); |
| 28 |
| 29 // Called when the originating element is no longer available and the color |
| 30 // chooser should end. |
| 31 void EndColorChooser(content::WebContents* tab); |
| 32 |
| 33 // Called when input element's value changes and the color chooser should |
| 34 // reflect that. |
| 35 void SetSelectedColorInColorChooser(content::WebContents* tab, |
| 36 const WebKit::WebColor& color); |
| 37 |
| 38 virtual RenderViewHost* GetRenderViewHost() OVERRIDE; |
| 39 |
| 40 private: |
| 41 |
| 42 // The RenderViewHost for the page showing the color chooser. |
| 43 // EndColorChooser and SetSelectedColorInColorChooser from other |
| 44 // RenderViewHosts will be ignored. |
| 45 content::WebContents* tab_; |
| 46 |
| 47 // Dialog box used for choosing color. |
| 48 scoped_ptr<ColorChooser> color_chooser_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(ColorSelectHelper); |
| 51 }; |
| 52 |
| 53 #endif // CHROME_BROWSER_COLOR_SELECT_HELPER_H_ |
| OLD | NEW |