OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_ACTION_VIEW_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_ACTION_VIEW_DELEGATE_H_ |
| 7 |
| 8 namespace content { |
| 9 class WebContents; |
| 10 } |
| 11 |
| 12 namespace views { |
| 13 class FocusManager; |
| 14 class View; |
| 15 class Widget; |
| 16 } |
| 17 |
| 18 // The view that surrounds an ExtensionAction and owns the |
| 19 // ExtensionActionViewController. Since different actions can subclass |
| 20 // different views, we don't derive views::View directly here. |
| 21 class ExtensionActionViewDelegate { |
| 22 public: |
| 23 // Returns |this| as a view. We need this because our subclasses implement |
| 24 // different kinds of views, and inheriting View here is a really bad idea. |
| 25 virtual views::View* GetAsView() = 0; |
| 26 |
| 27 // Returns true if this view is being shown inside a menu. |
| 28 virtual bool IsShownInMenu() = 0; |
| 29 |
| 30 // Returns the FocusManager to use when registering accelerators. |
| 31 virtual views::FocusManager* GetFocusManagerForAccelerator() = 0; |
| 32 |
| 33 // Returns the parent for the associated context menu. |
| 34 virtual views::Widget* GetParentForContextMenu() = 0; |
| 35 |
| 36 // Returns the reference view for the extension action's popup. |
| 37 virtual views::View* GetReferenceViewForPopup() = 0; |
| 38 |
| 39 // Returns the current web contents. |
| 40 virtual content::WebContents* GetCurrentWebContents() = 0; |
| 41 |
| 42 // Hides whatever popup is active (even if it's not this one). |
| 43 virtual void HideActivePopup() = 0; |
| 44 |
| 45 // Called when the icon is updated; this is forwarded from the icon factory. |
| 46 virtual void OnIconUpdated() = 0; |
| 47 |
| 48 // Called when a popup is shown. See ExecuteAction() for the definition of |
| 49 // |grant_tab_permissions|. |
| 50 virtual void OnPopupShown(bool grant_tab_permissions) {} |
| 51 |
| 52 // Does any additional cleanup after the popup is closed. |
| 53 virtual void CleanupPopup() {} |
| 54 |
| 55 // Called immediately before the context menu is shown. |
| 56 virtual void OnWillShowContextMenus() {} |
| 57 |
| 58 // Called once the context menu has closed. |
| 59 // This may not be called if the context menu is showing and |this| is |
| 60 // deleted. |
| 61 virtual void OnContextMenuDone() {} |
| 62 |
| 63 protected: |
| 64 virtual ~ExtensionActionViewDelegate() {} |
| 65 }; |
| 66 |
| 67 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_ACTION_VIEW_DELEGATE_H_ |
OLD | NEW |