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

Side by Side Diff: chrome/browser/ui/views/color_chooser_aura.cc

Issue 10442020: Initial implementation of ColorChooser for Aura. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/public/browser/color_chooser.h" 5 #include "content/public/browser/color_chooser.h"
6 #include "content/public/browser/web_contents.h"
7 #include "ui/views/color_chooser/color_chooser_listener.h"
8 #include "ui/views/color_chooser/color_chooser_view.h"
9 #include "ui/views/widget/widget.h"
6 10
7 #include "base/logging.h" 11
12 namespace {
13
14 class ColorChooserAura : public content::ColorChooser,
15 public views::ColorChooserListener {
16 public:
17 ColorChooserAura(int identifier,
18 content::WebContents* tab,
19 SkColor initial_color);
20
21 private:
22 content::WebContents* tab_;
Ben Goodger (Google) 2012/06/18 17:00:46 members after methods
Jun Mukai 2012/06/19 08:40:00 Done.
23 views::ColorChooserView* view_;
24
25 // views::ColorChooserListener overrides:
26 virtual void OnColorChosen(SkColor color) OVERRIDE;
27 virtual void OnColorChooserDialogClosed() OVERRIDE;
28
29 // content::ColorChooser overrides:
30 virtual void End() OVERRIDE;
31 virtual void SetSelectedColor(SkColor color) OVERRIDE;
32 };
Ben Goodger (Google) 2012/06/18 17:00:46 DISALLOW_COPY_AND_ASSIGN
Jun Mukai 2012/06/19 08:40:00 Done.
33
34 ColorChooserAura::ColorChooserAura(int identifier,
35 content::WebContents* tab,
36 SkColor initial_color)
37 : ColorChooser(identifier),
38 tab_(tab) {
39 view_ = new views::ColorChooserView(this, initial_color);
40 views::Widget* widget = views::Widget::CreateWindow(view_);
41 widget->SetAlwaysOnTop(true);
42 widget->Show();
43 }
44
45 void ColorChooserAura::OnColorChosen(SkColor color) {
46 if (tab_)
47 tab_->DidChooseColorInColorChooser(identifier(), color);
48 }
49
50 void ColorChooserAura::OnColorChooserDialogClosed() {
51 if (tab_)
52 tab_->DidEndColorChooser(identifier());
53 }
54
55 void ColorChooserAura::End() {
56 view_->OnOwningWindowClosed();
57 }
58
59 void ColorChooserAura::SetSelectedColor(SkColor color) {
60 view_->OnColorChanged(color);
61 }
62
63 } // namespace
8 64
9 // static 65 // static
10 content::ColorChooser* content::ColorChooser::Create( 66 content::ColorChooser* content::ColorChooser::Create(
11 int identifier, content::WebContents* tab, SkColor initial_color) { 67 int identifier, content::WebContents* tab, SkColor initial_color) {
12 NOTIMPLEMENTED(); 68 return new ColorChooserAura(identifier, tab, initial_color);
13 return NULL;
14 } 69 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/color_chooser_dialog.h » ('j') | chrome/browser/ui/views/color_chooser_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698