| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 // Shows the context menu (if one exists) for the toolbar action. | 135 // Shows the context menu (if one exists) for the toolbar action. |
| 136 void DoShowContextMenu(ui::MenuSourceType source_type); | 136 void DoShowContextMenu(ui::MenuSourceType source_type); |
| 137 | 137 |
| 138 // Closes the currently-active menu, if needed. This is the case when there | 138 // Closes the currently-active menu, if needed. This is the case when there |
| 139 // is an active menu that wouldn't close automatically when a new one is | 139 // is an active menu that wouldn't close automatically when a new one is |
| 140 // opened. | 140 // opened. |
| 141 // Returns true if a menu was closed, false otherwise. | 141 // Returns true if a menu was closed, false otherwise. |
| 142 bool CloseActiveMenuIfNeeded(); | 142 bool CloseActiveMenuIfNeeded(); |
| 143 | 143 |
| 144 // Unfortunately, due to the dual-nature of a ToolbarActionView as both a |
| 145 // label button and a menu button, activation can happen as part of either |
| 146 // ButtonPressed() or Activate(). Handle both in this function. |
| 147 void HandleActivation(const gfx::Point& menu_point, |
| 148 ui::MenuSourceType source_type); |
| 149 |
| 144 // A lock to keep the MenuButton pressed when a menu or popup is visible. | 150 // A lock to keep the MenuButton pressed when a menu or popup is visible. |
| 145 scoped_ptr<views::MenuButton::PressedLock> pressed_lock_; | 151 scoped_ptr<views::MenuButton::PressedLock> pressed_lock_; |
| 146 | 152 |
| 147 // The controller for this toolbar action view. | 153 // The controller for this toolbar action view. |
| 148 ToolbarActionViewController* view_controller_; | 154 ToolbarActionViewController* view_controller_; |
| 149 | 155 |
| 150 // The associated profile. | 156 // The associated profile. |
| 151 Profile* profile_; | 157 Profile* profile_; |
| 152 | 158 |
| 153 // Delegate that usually represents a container for ToolbarActionView. | 159 // Delegate that usually represents a container for ToolbarActionView. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 171 base::Closure followup_context_menu_task_; | 177 base::Closure followup_context_menu_task_; |
| 172 | 178 |
| 173 content::NotificationRegistrar registrar_; | 179 content::NotificationRegistrar registrar_; |
| 174 | 180 |
| 175 base::WeakPtrFactory<ToolbarActionView> weak_factory_; | 181 base::WeakPtrFactory<ToolbarActionView> weak_factory_; |
| 176 | 182 |
| 177 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); | 183 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); |
| 178 }; | 184 }; |
| 179 | 185 |
| 180 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ | 186 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
| OLD | NEW |