| 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_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/ui/extensions/extension_action_view_controller.h" | 8 #include "chrome/browser/ui/extensions/extension_action_view_controller.h" |
| 9 | 9 |
| 10 class GURL; | 10 class GURL; |
| 11 | 11 |
| 12 namespace extensions { |
| 13 class ExtensionViewHost; |
| 14 } |
| 15 |
| 12 class ExtensionActionPlatformDelegate { | 16 class ExtensionActionPlatformDelegate { |
| 13 public: | 17 public: |
| 14 virtual ~ExtensionActionPlatformDelegate() {} | 18 virtual ~ExtensionActionPlatformDelegate() {} |
| 15 | 19 |
| 16 // Returns a created ExtensionActionPlatformDelegate. This is defined in the | 20 // Returns a created ExtensionActionPlatformDelegate. This is defined in the |
| 17 // platform-specific implementation for the class. | 21 // platform-specific implementation for the class. |
| 18 static scoped_ptr<ExtensionActionPlatformDelegate> Create( | 22 static scoped_ptr<ExtensionActionPlatformDelegate> Create( |
| 19 ExtensionActionViewController* controller); | 23 ExtensionActionViewController* controller); |
| 20 | 24 |
| 21 // The following are forwarded from ToolbarActionViewController. See that | 25 // The following are forwarded from ToolbarActionViewController. See that |
| 22 // class for the definitions. | 26 // class for the definitions. |
| 23 virtual gfx::NativeView GetPopupNativeView() = 0; | 27 virtual gfx::NativeView GetPopupNativeView() = 0; |
| 24 virtual bool IsMenuRunning() const = 0; | 28 virtual bool IsMenuRunning() const = 0; |
| 25 virtual void RegisterCommand() = 0; | 29 virtual void RegisterCommand() = 0; |
| 26 | 30 |
| 27 // Called once the delegate is set, in order to do any extra initialization. | 31 // Called once the delegate is set, in order to do any extra initialization. |
| 28 virtual void OnDelegateSet() = 0; | 32 virtual void OnDelegateSet() = 0; |
| 29 | 33 |
| 30 // Returns true if there is currently a popup for this extension action. | |
| 31 virtual bool IsShowingPopup() const = 0; | |
| 32 | |
| 33 // Closes the active popup (whether it was this action's popup or not). | 34 // Closes the active popup (whether it was this action's popup or not). |
| 34 virtual void CloseActivePopup() = 0; | 35 virtual void CloseActivePopup() = 0; |
| 35 | 36 |
| 36 // Closes this action's popup. This will only be called if the popup is | 37 // Closes this action's popup. This will only be called if the popup is |
| 37 // showing. | 38 // showing. |
| 38 virtual void CloseOwnPopup() = 0; | 39 virtual void CloseOwnPopup() = 0; |
| 39 | 40 |
| 40 // Shows the popup for the extension action, given the associated |popup_url|. | 41 // Shows the popup for the extension action, given the associated |popup_url|. |
| 41 // |grant_tab_permissions| is true if active tab permissions should be given | 42 // |grant_tab_permissions| is true if active tab permissions should be given |
| 42 // to the extension; this is only true if the popup is opened through a user | 43 // to the extension; this is only true if the popup is opened through a user |
| 43 // action. | 44 // action. |
| 44 // Returns true if a popup is successfully shown. | 45 // Returns the ExtensionViewHost of the created popup, if a popup is |
| 45 virtual bool ShowPopupWithUrl( | 46 // successfully shown. |
| 47 virtual extensions::ExtensionViewHost* ShowPopupWithUrl( |
| 46 ExtensionActionViewController::PopupShowAction show_action, | 48 ExtensionActionViewController::PopupShowAction show_action, |
| 47 const GURL& popup_url, | 49 const GURL& popup_url, |
| 48 bool grant_tab_permissions) = 0; | 50 bool grant_tab_permissions) = 0; |
| 49 }; | 51 }; |
| 50 | 52 |
| 51 #endif // CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_H_ | 53 #endif // CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_H_ |
| OLD | NEW |