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

Side by Side Diff: chrome/browser/color_select_helper.h

Issue 7685006: Implement input type=color UI (common part) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: forgot to turn off flag Created 9 years, 1 month 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
(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 #if defined(ENABLE_INPUT_COLOR)
10
11 #include "content/browser/tab_contents/tab_contents_observer.h"
12
13 #if defined(OS_WIN)
14 #include "chrome/browser/ui/color_chooser_dialog.h"
15 #else
16 #include "chrome/browser/ui/color_chooser.h"
17 #endif
18
19 class RenderViewHost;
20 struct ViewHostMsg_SetSelectedColorInColorChooser_Params;
21
22 // This class requests to the color chooser. It implements listener interface
23 // for the color chooser.
24 class ColorSelectHelper
25 #if defined(OS_WIN)
26 : public ColorChooserDialog::Listener {
27 #else
28 : public ColorChooser::Listener {
29 #endif
30 public:
31 explicit ColorSelectHelper();
32 virtual ~ColorSelectHelper();
33
34 void OpenColorChooser(RenderViewHost* render_view_host,
35 WebKit::WebColor color);
36 void CleanupColorChooser(RenderViewHost* render_view_host);
37 void SetSelectedColorInColorChooser(RenderViewHost* render_view_host,
38 WebKit::WebColor color);
39
40 virtual void DidChooseColor(WebKit::WebColor color);
41 virtual void DidCleanup();
42
43 private:
44 // The RenderViewHost for the page showing the color chooser.
45 // CleanupColorChooser and SetSelectedColorInColorChooser from other
46 // RenderViewHosts will be ignored.
47 RenderViewHost* render_view_host_;
48 #if defined(OS_WIN)
49 // Dialog box used for choosing color.
50 scoped_refptr<ColorChooserDialog> color_chooser_dialog_;
51 #endif
yosin_UTC9 2011/12/06 07:11:17 We want to have DISALLOW_COPY_AND_ASSIGN(ColorSele
52 };
53
54 class ColorSelectObserver : public TabContentsObserver {
55 public:
56 explicit ColorSelectObserver(TabContents* tab_contents);
57 virtual ~ColorSelectObserver();
58
59 private:
60 // TabContentsObserver overrides.
61 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
62
63 // Called when web page asks to open the color chooser.
64 void OnOpenColorChooser(
65 const ViewHostMsg_SetSelectedColorInColorChooser_Params& params);
66
67 // Called when the originating element is no longer available and the color
68 // chooser should cleanup.
69 void OnCleanupColorChooser();
70
71 // Called when input element's value changes and the color chooser should
72 // reflect that.
73 void OnSetSelectedColorInColorChooser(
74 const ViewHostMsg_SetSelectedColorInColorChooser_Params& params);
75
76 // ColorSelectHelper, lazily created.
77 scoped_ptr<ColorSelectHelper> color_select_helper_;
78
79 DISALLOW_COPY_AND_ASSIGN(ColorSelectObserver);
80 };
81
82 #endif // defined(ENABLE_INPUT_COLOR)
83
84 #endif // CHROME_BROWSER_COLOR_SELECT_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698