| 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_BROWSER_ACTION_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/ui/views/extensions/extension_action_view_controller.h" | 8 #include "chrome/browser/ui/views/extensions/extension_action_view_controller.h" |
| 9 #include "chrome/browser/ui/views/extensions/extension_action_view_delegate.h" | 9 #include "chrome/browser/ui/views/extensions/extension_action_view_delegate.h" |
| 10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // Returns the view of the browser actions overflow menu to use as a | 57 // Returns the view of the browser actions overflow menu to use as a |
| 58 // reference point for a popup when this view isn't visible. | 58 // reference point for a popup when this view isn't visible. |
| 59 virtual views::View* GetOverflowReferenceView() = 0; | 59 virtual views::View* GetOverflowReferenceView() = 0; |
| 60 | 60 |
| 61 // Sets the delegate's active popup owner to be |popup_owner|. | 61 // Sets the delegate's active popup owner to be |popup_owner|. |
| 62 virtual void SetPopupOwner(BrowserActionView* popup_owner) = 0; | 62 virtual void SetPopupOwner(BrowserActionView* popup_owner) = 0; |
| 63 | 63 |
| 64 // Hides the active popup of the delegate, if one exists. | 64 // Hides the active popup of the delegate, if one exists. |
| 65 virtual void HideActivePopup() = 0; | 65 virtual void HideActivePopup() = 0; |
| 66 | 66 |
| 67 // Returns the primary BrowserActionView associated with the given |
| 68 // |extension|. |
| 69 virtual BrowserActionView* GetMainViewForExtension( |
| 70 const extensions::Extension* extension) = 0; |
| 71 |
| 67 protected: | 72 protected: |
| 68 virtual ~Delegate() {} | 73 virtual ~Delegate() {} |
| 69 }; | 74 }; |
| 70 | 75 |
| 71 // The IconObserver will receive a notification when the button's icon has | 76 // The IconObserver will receive a notification when the button's icon has |
| 72 // been updated. | 77 // been updated. |
| 73 class IconObserver { | 78 class IconObserver { |
| 74 public: | 79 public: |
| 75 virtual void OnIconUpdated(const gfx::ImageSkia& icon) = 0; | 80 virtual void OnIconUpdated(const gfx::ImageSkia& icon) = 0; |
| 76 | 81 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 virtual void OnDragDone() OVERRIDE; | 157 virtual void OnDragDone() OVERRIDE; |
| 153 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 158 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
| 154 virtual void PaintChildren(gfx::Canvas* canvas, | 159 virtual void PaintChildren(gfx::Canvas* canvas, |
| 155 const views::CullSet& cull_set) OVERRIDE; | 160 const views::CullSet& cull_set) OVERRIDE; |
| 156 | 161 |
| 157 // ExtensionActionViewDelegate: | 162 // ExtensionActionViewDelegate: |
| 158 virtual views::View* GetAsView() OVERRIDE; | 163 virtual views::View* GetAsView() OVERRIDE; |
| 159 virtual bool IsShownInMenu() OVERRIDE; | 164 virtual bool IsShownInMenu() OVERRIDE; |
| 160 virtual views::FocusManager* GetFocusManagerForAccelerator() OVERRIDE; | 165 virtual views::FocusManager* GetFocusManagerForAccelerator() OVERRIDE; |
| 161 virtual views::Widget* GetParentForContextMenu() OVERRIDE; | 166 virtual views::Widget* GetParentForContextMenu() OVERRIDE; |
| 167 virtual ExtensionActionViewController* GetPreferredPopupViewController() |
| 168 OVERRIDE; |
| 162 virtual views::View* GetReferenceViewForPopup() OVERRIDE; | 169 virtual views::View* GetReferenceViewForPopup() OVERRIDE; |
| 163 virtual content::WebContents* GetCurrentWebContents() OVERRIDE; | 170 virtual content::WebContents* GetCurrentWebContents() OVERRIDE; |
| 164 virtual void HideActivePopup() OVERRIDE; | 171 virtual void HideActivePopup() OVERRIDE; |
| 165 virtual void OnIconUpdated() OVERRIDE; | 172 virtual void OnIconUpdated() OVERRIDE; |
| 166 virtual void OnPopupShown(bool grant_tab_permissions) OVERRIDE; | 173 virtual void OnPopupShown(bool grant_tab_permissions) OVERRIDE; |
| 167 virtual void CleanupPopup() OVERRIDE; | 174 virtual void CleanupPopup() OVERRIDE; |
| 168 virtual void OnWillShowContextMenus() OVERRIDE; | 175 virtual void OnWillShowContextMenus() OVERRIDE; |
| 169 virtual void OnContextMenuDone() OVERRIDE; | 176 virtual void OnContextMenuDone() OVERRIDE; |
| 170 | 177 |
| 171 // The controller for this ExtensionAction view. | 178 // The controller for this ExtensionAction view. |
| 172 scoped_ptr<ExtensionActionViewController> view_controller_; | 179 scoped_ptr<ExtensionActionViewController> view_controller_; |
| 173 | 180 |
| 174 // Delegate that usually represents a container for BrowserActionView. | 181 // Delegate that usually represents a container for BrowserActionView. |
| 175 BrowserActionView::Delegate* delegate_; | 182 BrowserActionView::Delegate* delegate_; |
| 176 | 183 |
| 177 // Used to make sure we only register the command once. | 184 // Used to make sure we only register the command once. |
| 178 bool called_registered_extension_command_; | 185 bool called_registered_extension_command_; |
| 179 | 186 |
| 180 content::NotificationRegistrar registrar_; | 187 content::NotificationRegistrar registrar_; |
| 181 | 188 |
| 182 // The observer that we need to notify when the icon of the button has been | 189 // The observer that we need to notify when the icon of the button has been |
| 183 // updated. | 190 // updated. |
| 184 IconObserver* icon_observer_; | 191 IconObserver* icon_observer_; |
| 185 | 192 |
| 186 DISALLOW_COPY_AND_ASSIGN(BrowserActionView); | 193 DISALLOW_COPY_AND_ASSIGN(BrowserActionView); |
| 187 }; | 194 }; |
| 188 | 195 |
| 189 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_ | 196 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTION_VIEW_H_ |
| OLD | NEW |