OLD | NEW |
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_ACTION_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
7 | 7 |
8 #include "chrome/browser/ui/views/toolbar/toolbar_action_view_delegate_views.h" | 8 #include "chrome/browser/ui/views/toolbar/toolbar_action_view_delegate_views.h" |
9 #include "content/public/browser/notification_observer.h" | 9 #include "content/public/browser/notification_observer.h" |
10 #include "content/public/browser/notification_registrar.h" | 10 #include "content/public/browser/notification_registrar.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 ToolbarActionView(ToolbarActionViewController* view_controller, | 68 ToolbarActionView(ToolbarActionViewController* view_controller, |
69 Browser* browser, | 69 Browser* browser, |
70 Delegate* delegate); | 70 Delegate* delegate); |
71 ~ToolbarActionView() override; | 71 ~ToolbarActionView() override; |
72 | 72 |
73 // Modifies the given |border| in order to display a "popped out" for when | 73 // Modifies the given |border| in order to display a "popped out" for when |
74 // an action wants to run. | 74 // an action wants to run. |
75 static void DecorateWantsToRunBorder(views::LabelButtonBorder* border); | 75 static void DecorateWantsToRunBorder(views::LabelButtonBorder* border); |
76 | 76 |
77 // Overridden from views::View: | 77 // views::MenuButton: |
78 void GetAccessibleState(ui::AXViewState* state) override; | 78 void GetAccessibleState(ui::AXViewState* state) override; |
79 | 79 |
80 // Overridden from views::ButtonListener: | 80 // views::ButtonListener: |
81 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 81 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
82 | 82 |
83 // Overridden from content::NotificationObserver: | 83 // content::NotificationObserver: |
84 void Observe(int type, | 84 void Observe(int type, |
85 const content::NotificationSource& source, | 85 const content::NotificationSource& source, |
86 const content::NotificationDetails& details) override; | 86 const content::NotificationDetails& details) override; |
87 | 87 |
88 // MenuButton behavior overrides. These methods all default to LabelButton | 88 // MenuButton behavior overrides. These methods all default to LabelButton |
89 // behavior unless this button is a popup. In that case, it uses MenuButton | 89 // behavior unless this button is a popup. In that case, it uses MenuButton |
90 // behavior. MenuButton has the notion of a child popup being shown where the | 90 // behavior. MenuButton has the notion of a child popup being shown where the |
91 // button will stay in the pushed state until the "menu" (a popup in this | 91 // button will stay in the pushed state until the "menu" (a popup in this |
92 // case) is dismissed. | 92 // case) is dismissed. |
93 bool Activate() override; | 93 bool Activate() override; |
(...skipping 12 matching lines...) Expand all Loading... |
106 return view_controller_; | 106 return view_controller_; |
107 } | 107 } |
108 Browser* browser() { return browser_; } | 108 Browser* browser() { return browser_; } |
109 | 109 |
110 // Returns button icon so it can be accessed during tests. | 110 // Returns button icon so it can be accessed during tests. |
111 gfx::ImageSkia GetIconForTest(); | 111 gfx::ImageSkia GetIconForTest(); |
112 | 112 |
113 bool wants_to_run_for_testing() const { return wants_to_run_; } | 113 bool wants_to_run_for_testing() const { return wants_to_run_; } |
114 | 114 |
115 private: | 115 private: |
116 // Overridden from views::View: | 116 // views::MenuButton: |
| 117 gfx::Size GetPreferredSize() const override; |
| 118 const char* GetClassName() const override; |
| 119 void OnDragDone() override; |
117 void ViewHierarchyChanged( | 120 void ViewHierarchyChanged( |
118 const ViewHierarchyChangedDetails& details) override; | 121 const ViewHierarchyChangedDetails& details) override; |
119 void OnDragDone() override; | |
120 gfx::Size GetPreferredSize() const override; | |
121 void PaintChildren(gfx::Canvas* canvas, | 122 void PaintChildren(gfx::Canvas* canvas, |
122 const views::CullSet& cull_set) override; | 123 const views::CullSet& cull_set) override; |
123 void OnPaintBorder(gfx::Canvas* canvas) override; | 124 void OnPaintBorder(gfx::Canvas* canvas) override; |
124 | 125 |
125 // ToolbarActionViewDelegateViews: | 126 // ToolbarActionViewDelegateViews: |
126 views::View* GetAsView() override; | 127 views::View* GetAsView() override; |
127 bool IsShownInMenu() override; | 128 bool IsShownInMenu() override; |
128 views::FocusManager* GetFocusManagerForAccelerator() override; | 129 views::FocusManager* GetFocusManagerForAccelerator() override; |
129 views::Widget* GetParentForContextMenu() override; | 130 views::Widget* GetParentForContextMenu() override; |
130 ToolbarActionViewController* GetPreferredPopupViewController() override; | 131 ToolbarActionViewController* GetPreferredPopupViewController() override; |
(...skipping 24 matching lines...) Expand all Loading... |
155 | 156 |
156 // A special border to draw when the action wants to run. | 157 // A special border to draw when the action wants to run. |
157 scoped_ptr<views::LabelButtonBorder> wants_to_run_border_; | 158 scoped_ptr<views::LabelButtonBorder> wants_to_run_border_; |
158 | 159 |
159 content::NotificationRegistrar registrar_; | 160 content::NotificationRegistrar registrar_; |
160 | 161 |
161 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); | 162 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); |
162 }; | 163 }; |
163 | 164 |
164 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ | 165 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
OLD | NEW |