| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Notifies that a drag completed. | 46 // Notifies that a drag completed. |
| 47 virtual void OnToolbarActionViewDragDone() = 0; | 47 virtual void OnToolbarActionViewDragDone() = 0; |
| 48 | 48 |
| 49 // Returns the view of the toolbar actions overflow menu to use as a | 49 // Returns the view of the toolbar actions overflow menu to use as a |
| 50 // reference point for a popup when this view isn't visible. | 50 // reference point for a popup when this view isn't visible. |
| 51 virtual views::MenuButton* GetOverflowReferenceView() = 0; | 51 virtual views::MenuButton* GetOverflowReferenceView() = 0; |
| 52 | 52 |
| 53 // Sets the delegate's active popup owner to be |popup_owner|. | 53 // Sets the delegate's active popup owner to be |popup_owner|. |
| 54 virtual void SetPopupOwner(ToolbarActionView* popup_owner) = 0; | 54 virtual void SetPopupOwner(ToolbarActionView* popup_owner) = 0; |
| 55 | 55 |
| 56 // Hides the active popup of the delegate, if one exists. | |
| 57 virtual void HideActivePopup() = 0; | |
| 58 | |
| 59 // Returns the primary ToolbarActionView associated with the given | 56 // Returns the primary ToolbarActionView associated with the given |
| 60 // |extension|. | 57 // |extension|. |
| 61 virtual ToolbarActionView* GetMainViewForAction( | 58 virtual ToolbarActionView* GetMainViewForAction( |
| 62 ToolbarActionView* view) = 0; | 59 ToolbarActionView* view) = 0; |
| 63 | 60 |
| 64 protected: | 61 protected: |
| 65 ~Delegate() override {} | 62 ~Delegate() override {} |
| 66 }; | 63 }; |
| 67 | 64 |
| 68 ToolbarActionView(ToolbarActionViewController* view_controller, | 65 ToolbarActionView(ToolbarActionViewController* view_controller, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 void OnPaintBorder(gfx::Canvas* canvas) override; | 121 void OnPaintBorder(gfx::Canvas* canvas) override; |
| 125 | 122 |
| 126 // ToolbarActionViewDelegateViews: | 123 // ToolbarActionViewDelegateViews: |
| 127 views::View* GetAsView() override; | 124 views::View* GetAsView() override; |
| 128 bool IsShownInMenu() override; | 125 bool IsShownInMenu() override; |
| 129 views::FocusManager* GetFocusManagerForAccelerator() override; | 126 views::FocusManager* GetFocusManagerForAccelerator() override; |
| 130 views::Widget* GetParentForContextMenu() override; | 127 views::Widget* GetParentForContextMenu() override; |
| 131 ToolbarActionViewController* GetPreferredPopupViewController() override; | 128 ToolbarActionViewController* GetPreferredPopupViewController() override; |
| 132 views::View* GetReferenceViewForPopup() override; | 129 views::View* GetReferenceViewForPopup() override; |
| 133 views::MenuButton* GetContextMenuButton() override; | 130 views::MenuButton* GetContextMenuButton() override; |
| 134 void HideActivePopup() override; | 131 void OnPopupShown(bool by_user) override; |
| 135 void OnPopupShown(bool grant_tab_permissions) override; | 132 void OnPopupClosed() override; |
| 136 void CleanupPopup() override; | |
| 137 | 133 |
| 138 // A lock to keep the MenuButton pressed when a menu or popup is visible. | 134 // A lock to keep the MenuButton pressed when a menu or popup is visible. |
| 139 scoped_ptr<views::MenuButton::PressedLock> pressed_lock_; | 135 scoped_ptr<views::MenuButton::PressedLock> pressed_lock_; |
| 140 | 136 |
| 141 // The controller for this toolbar action view. | 137 // The controller for this toolbar action view. |
| 142 ToolbarActionViewController* view_controller_; | 138 ToolbarActionViewController* view_controller_; |
| 143 | 139 |
| 144 // The associated browser. | 140 // The associated browser. |
| 145 Browser* browser_; | 141 Browser* browser_; |
| 146 | 142 |
| 147 // Delegate that usually represents a container for ToolbarActionView. | 143 // Delegate that usually represents a container for ToolbarActionView. |
| 148 Delegate* delegate_; | 144 Delegate* delegate_; |
| 149 | 145 |
| 150 // Used to make sure we only register the command once. | 146 // Used to make sure we only register the command once. |
| 151 bool called_register_command_; | 147 bool called_register_command_; |
| 152 | 148 |
| 153 // The cached value of whether or not the action wants to run on the current | 149 // The cached value of whether or not the action wants to run on the current |
| 154 // tab. | 150 // tab. |
| 155 bool wants_to_run_; | 151 bool wants_to_run_; |
| 156 | 152 |
| 157 // A special border to draw when the action wants to run. | 153 // A special border to draw when the action wants to run. |
| 158 scoped_ptr<views::LabelButtonBorder> wants_to_run_border_; | 154 scoped_ptr<views::LabelButtonBorder> wants_to_run_border_; |
| 159 | 155 |
| 160 content::NotificationRegistrar registrar_; | 156 content::NotificationRegistrar registrar_; |
| 161 | 157 |
| 162 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); | 158 DISALLOW_COPY_AND_ASSIGN(ToolbarActionView); |
| 163 }; | 159 }; |
| 164 | 160 |
| 165 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ | 161 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_ACTION_VIEW_H_ |
| OLD | NEW |