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

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_button.h

Issue 1492423003: Rejigger ThemeService: move exposure of ThemeProvider interface to a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix that unittest Created 5 years 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "ui/gfx/geometry/point.h" 9 #include "ui/gfx/geometry/point.h"
10 #include "ui/views/animation/ink_drop_host.h" 10 #include "ui/views/animation/ink_drop_host.h"
11 #include "ui/views/context_menu_controller.h" 11 #include "ui/views/context_menu_controller.h"
12 #include "ui/views/controls/button/button.h" 12 #include "ui/views/controls/button/button.h"
13 #include "ui/views/controls/button/label_button.h" 13 #include "ui/views/controls/button/label_button.h"
14 14
15 class Profile;
16
15 namespace ui { 17 namespace ui {
16 class MenuModel; 18 class MenuModel;
17 } 19 }
18 20
19 namespace views { 21 namespace views {
20 class InkDropAnimationController; 22 class InkDropAnimationController;
21 class MenuRunner; 23 class MenuRunner;
22 } 24 }
23 25
24 // This class provides basic drawing and mouse-over behavior for buttons 26 // This class provides basic drawing and mouse-over behavior for buttons
25 // appearing in the toolbar. 27 // appearing in the toolbar.
26 class ToolbarButton : public views::LabelButton, 28 class ToolbarButton : public views::LabelButton,
27 public views::ContextMenuController, 29 public views::ContextMenuController,
28 public views::InkDropHost { 30 public views::InkDropHost {
29 public: 31 public:
30 // Takes ownership of the |model|, which can be null if no menu 32 // Takes ownership of the |model|, which can be null if no menu
31 // is to be shown. 33 // is to be shown.
32 ToolbarButton(views::ButtonListener* listener, ui::MenuModel* model); 34 ToolbarButton(Profile* profile,
35 views::ButtonListener* listener,
36 ui::MenuModel* model);
33 ~ToolbarButton() override; 37 ~ToolbarButton() override;
34 38
35 // Set up basic mouseover border behavior. 39 // Set up basic mouseover border behavior.
36 // Should be called before first paint. 40 // Should be called before first paint.
37 void Init(); 41 void Init();
38 42
39 // Methods for handling ButtonDropDown-style menus. 43 // Methods for handling ButtonDropDown-style menus.
40 void ClearPendingMenu(); 44 void ClearPendingMenu();
41 bool IsMenuShowing() const; 45 bool IsMenuShowing() const;
42 46
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 return ink_drop_animation_controller_.get(); 82 return ink_drop_animation_controller_.get();
79 } 83 }
80 84
81 private: 85 private:
82 // views::LabelButton: 86 // views::LabelButton:
83 const char* GetClassName() const override; 87 const char* GetClassName() const override;
84 88
85 // views::InkDropHost: 89 // views::InkDropHost:
86 gfx::Point CalculateInkDropCenter() const override; 90 gfx::Point CalculateInkDropCenter() const override;
87 91
92 // The associated profile. The browser theme affects rendering.
93 Profile* profile_;
94
88 // The model that populates the attached menu. 95 // The model that populates the attached menu.
89 scoped_ptr<ui::MenuModel> model_; 96 scoped_ptr<ui::MenuModel> model_;
90 97
91 // Indicates if menu is currently showing. 98 // Indicates if menu is currently showing.
92 bool menu_showing_; 99 bool menu_showing_;
93 100
94 // Y position of mouse when left mouse button is pressed. 101 // Y position of mouse when left mouse button is pressed.
95 int y_position_on_lbuttondown_; 102 int y_position_on_lbuttondown_;
96 103
97 // Menu runner to display drop down menu. 104 // Menu runner to display drop down menu.
98 scoped_ptr<views::MenuRunner> menu_runner_; 105 scoped_ptr<views::MenuRunner> menu_runner_;
99 106
100 // Animation controller for the ink drop ripple effect. 107 // Animation controller for the ink drop ripple effect.
101 scoped_ptr<views::InkDropAnimationController> ink_drop_animation_controller_; 108 scoped_ptr<views::InkDropAnimationController> ink_drop_animation_controller_;
102 109
103 // A factory for tasks that show the dropdown context menu for the button. 110 // A factory for tasks that show the dropdown context menu for the button.
104 base::WeakPtrFactory<ToolbarButton> show_menu_factory_; 111 base::WeakPtrFactory<ToolbarButton> show_menu_factory_;
105 112
106 DISALLOW_COPY_AND_ASSIGN(ToolbarButton); 113 DISALLOW_COPY_AND_ASSIGN(ToolbarButton);
107 }; 114 };
108 115
109 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_ 116 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_BUTTON_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_action_view.cc ('k') | chrome/browser/ui/views/toolbar/toolbar_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698