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 View; | 14 class View; |
15 class Widget; | 15 class Widget; |
16 } | 16 } |
17 | 17 |
| 18 class ExtensionActionViewController; |
| 19 |
18 // The view that surrounds an ExtensionAction and owns the | 20 // The view that surrounds an ExtensionAction and owns the |
19 // ExtensionActionViewController. Since different actions can subclass | 21 // ExtensionActionViewController. Since different actions can subclass |
20 // different views, we don't derive views::View directly here. | 22 // different views, we don't derive views::View directly here. |
21 class ExtensionActionViewDelegate { | 23 class ExtensionActionViewDelegate { |
22 public: | 24 public: |
23 // Returns |this| as a view. We need this because our subclasses implement | 25 // 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. | 26 // different kinds of views, and inheriting View here is a really bad idea. |
25 virtual views::View* GetAsView() = 0; | 27 virtual views::View* GetAsView() = 0; |
26 | 28 |
27 // Returns true if this view is being shown inside a menu. | 29 // Returns true if this view is being shown inside a menu. |
28 virtual bool IsShownInMenu() = 0; | 30 virtual bool IsShownInMenu() = 0; |
29 | 31 |
30 // Returns the FocusManager to use when registering accelerators. | 32 // Returns the FocusManager to use when registering accelerators. |
31 virtual views::FocusManager* GetFocusManagerForAccelerator() = 0; | 33 virtual views::FocusManager* GetFocusManagerForAccelerator() = 0; |
32 | 34 |
33 // Returns the parent for the associated context menu. | 35 // Returns the parent for the associated context menu. |
34 virtual views::Widget* GetParentForContextMenu() = 0; | 36 virtual views::Widget* GetParentForContextMenu() = 0; |
35 | 37 |
| 38 // 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 // returns the preferred control. |
| 41 virtual ExtensionActionViewController* GetPreferredPopupViewController() = 0; |
| 42 |
36 // Returns the reference view for the extension action's popup. | 43 // Returns the reference view for the extension action's popup. |
37 virtual views::View* GetReferenceViewForPopup() = 0; | 44 virtual views::View* GetReferenceViewForPopup() = 0; |
38 | 45 |
39 // Returns the current web contents. | 46 // Returns the current web contents. |
40 virtual content::WebContents* GetCurrentWebContents() = 0; | 47 virtual content::WebContents* GetCurrentWebContents() = 0; |
41 | 48 |
42 // Hides whatever popup is active (even if it's not this one). | 49 // Hides whatever popup is active (even if it's not this one). |
43 virtual void HideActivePopup() = 0; | 50 virtual void HideActivePopup() = 0; |
44 | 51 |
45 // Called when the icon is updated; this is forwarded from the icon factory. | 52 // Called when the icon is updated; this is forwarded from the icon factory. |
(...skipping 12 matching lines...) Expand all Loading... |
58 // Called once the context menu has closed. | 65 // Called once the context menu has closed. |
59 // This may not be called if the context menu is showing and |this| is | 66 // This may not be called if the context menu is showing and |this| is |
60 // deleted. | 67 // deleted. |
61 virtual void OnContextMenuDone() {} | 68 virtual void OnContextMenuDone() {} |
62 | 69 |
63 protected: | 70 protected: |
64 virtual ~ExtensionActionViewDelegate() {} | 71 virtual ~ExtensionActionViewDelegate() {} |
65 }; | 72 }; |
66 | 73 |
67 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_ACTION_VIEW_DELEGATE_H_ | 74 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_ACTION_VIEW_DELEGATE_H_ |
OLD | NEW |