OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_EXTENSIONS_EXTENSION_ACTION_VIEW_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_ACTION_VIEW_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_ACTION_VIEW_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_ACTION_VIEW_DELEGATE_H_ |
7 | 7 |
8 namespace content { | 8 namespace content { |
9 class WebContents; | 9 class WebContents; |
10 } | 10 } |
11 | 11 |
12 namespace views { | 12 namespace views { |
13 class FocusManager; | 13 class FocusManager; |
| 14 class MenuButton; |
14 class View; | 15 class View; |
15 class Widget; | 16 class Widget; |
16 } | 17 } |
17 | 18 |
18 class ExtensionActionViewController; | 19 class ExtensionActionViewController; |
19 | 20 |
20 // The view that surrounds an ExtensionAction and owns the | 21 // The view that surrounds an ExtensionAction and owns the |
21 // ExtensionActionViewController. Since different actions can subclass | 22 // ExtensionActionViewController. Since different actions can subclass |
22 // different views, we don't derive views::View directly here. | 23 // different views, we don't derive views::View directly here. |
23 class ExtensionActionViewDelegate { | 24 class ExtensionActionViewDelegate { |
(...skipping 12 matching lines...) Expand all Loading... |
36 virtual views::Widget* GetParentForContextMenu() = 0; | 37 virtual views::Widget* GetParentForContextMenu() = 0; |
37 | 38 |
38 // In some cases (such as when an action is shown in a menu), a substitute | 39 // In some cases (such as when an action is shown in a menu), a substitute |
39 // ExtensionActionViewController should be used for showing popups. This | 40 // ExtensionActionViewController should be used for showing popups. This |
40 // returns the preferred control. | 41 // returns the preferred control. |
41 virtual ExtensionActionViewController* GetPreferredPopupViewController() = 0; | 42 virtual ExtensionActionViewController* GetPreferredPopupViewController() = 0; |
42 | 43 |
43 // Returns the reference view for the extension action's popup. | 44 // Returns the reference view for the extension action's popup. |
44 virtual views::View* GetReferenceViewForPopup() = 0; | 45 virtual views::View* GetReferenceViewForPopup() = 0; |
45 | 46 |
| 47 // Returns the MenuButton (if any) to use in showing the context menu (this |
| 48 // allows views code to update the pressed state of the button). |
| 49 virtual views::MenuButton* GetContextMenuButton() = 0; |
| 50 |
46 // Returns the current web contents. | 51 // Returns the current web contents. |
47 virtual content::WebContents* GetCurrentWebContents() = 0; | 52 virtual content::WebContents* GetCurrentWebContents() = 0; |
48 | 53 |
49 // Hides whatever popup is active (even if it's not this one). | 54 // Hides whatever popup is active (even if it's not this one). |
50 virtual void HideActivePopup() = 0; | 55 virtual void HideActivePopup() = 0; |
51 | 56 |
52 // Called when the icon is updated; this is forwarded from the icon factory. | 57 // Called when the icon is updated; this is forwarded from the icon factory. |
53 virtual void OnIconUpdated() = 0; | 58 virtual void OnIconUpdated() = 0; |
54 | 59 |
55 // Called when a popup is shown. See ExecuteAction() for the definition of | 60 // Called when a popup is shown. See ExecuteAction() for the definition of |
56 // |grant_tab_permissions|. | 61 // |grant_tab_permissions|. |
57 virtual void OnPopupShown(bool grant_tab_permissions) {} | 62 virtual void OnPopupShown(bool grant_tab_permissions) {} |
58 | 63 |
59 // Does any additional cleanup after the popup is closed. | 64 // Does any additional cleanup after the popup is closed. |
60 virtual void CleanupPopup() {} | 65 virtual void CleanupPopup() {} |
61 | 66 |
62 // Called immediately before the context menu is shown. | |
63 virtual void OnWillShowContextMenus() {} | |
64 | |
65 // Called once the context menu has closed. | |
66 // This may not be called if the context menu is showing and |this| is | |
67 // deleted. | |
68 virtual void OnContextMenuDone() {} | |
69 | |
70 protected: | 67 protected: |
71 virtual ~ExtensionActionViewDelegate() {} | 68 virtual ~ExtensionActionViewDelegate() {} |
72 }; | 69 }; |
73 | 70 |
74 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_ACTION_VIEW_DELEGATE_H_ | 71 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_ACTION_VIEW_DELEGATE_H_ |
OLD | NEW |