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