Index: chrome/browser/ui/extensions/extension_action_view_controller.h |
diff --git a/chrome/browser/ui/extensions/extension_action_view_controller.h b/chrome/browser/ui/extensions/extension_action_view_controller.h |
index 541eef2b83ccbc8b4bbdc2e85e03506ce8024221..b0f97aa4fd3276f56bdee0cb7525f21f2b4534ed 100644 |
--- a/chrome/browser/ui/extensions/extension_action_view_controller.h |
+++ b/chrome/browser/ui/extensions/extension_action_view_controller.h |
@@ -9,6 +9,7 @@ |
#include "base/scoped_observer.h" |
#include "chrome/browser/extensions/extension_action_icon_factory.h" |
#include "chrome/browser/extensions/extension_context_menu_model.h" |
+#include "chrome/browser/extensions/sidebar_container.h" |
#include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" |
#include "extensions/browser/extension_host_observer.h" |
#include "ui/gfx/image/image.h" |
@@ -59,6 +60,7 @@ class ExtensionActionViewController |
bool WantsToRun(content::WebContents* web_contents) const override; |
bool HasPopup(content::WebContents* web_contents) const override; |
void HidePopup() override; |
+ void HideSidebar() override; |
gfx::NativeView GetPopupNativeView() override; |
ui::MenuModel* GetContextMenu() override; |
void OnContextMenuClosed() override; |
@@ -76,6 +78,8 @@ class ExtensionActionViewController |
// Closes the active popup (whether it was this action's popup or not). |
void HideActivePopup(); |
+ // Closes the active sidebar. |
+ void HideActiveSidebar(); |
// Populates |command| with the command associated with |extension|, if one |
// exists. Returns true if |command| was populated. |
@@ -87,12 +91,20 @@ class ExtensionActionViewController |
const ExtensionAction* extension_action() const { return extension_action_; } |
ToolbarActionViewDelegate* view_delegate() { return view_delegate_; } |
bool is_showing_popup() const { return popup_host_ != nullptr; } |
+ bool is_showing_sidebar() const { return sidebar_container_ != nullptr; } |
void set_icon_observer(ExtensionActionIconFactory::Observer* icon_observer) { |
icon_observer_ = icon_observer; |
} |
private: |
+ // Update button state to be pressed |
+ void PressButton(bool grant_tab_permissions); |
+ void PressButtonWithSlideOutIfEnabled(const base::Closure& closure); |
+ |
+ // Update button state to be unpressed |
+ void RaiseButton(); |
+ |
// ExtensionActionIconFactory::Observer: |
void OnIconUpdated() override; |
@@ -127,6 +139,13 @@ class ExtensionActionViewController |
const GURL& popup_url, |
bool grant_tab_permissions); |
+ // Begins the process of showing the sidebar for the extension action, |
+ // given the associated |popup_url|. |
+ // The sidebar may not be shown synchronously if the extension is hidden and |
+ // first needs to slide itself out. |
+ // Returns true if a sidebar will be shown. |
+ bool TriggerSidebarWithUrl(const GURL& popup_url); |
+ |
// Shows the popup with the given |host|. |
void ShowPopup(scoped_ptr<extensions::ExtensionViewHost> host, |
bool grant_tab_permissions, |
@@ -155,6 +174,9 @@ class ExtensionActionViewController |
// The extension popup's host if the popup is visible; null otherwise. |
extensions::ExtensionViewHost* popup_host_; |
+ // The sidebar container if the sidebar is visible. |
+ scoped_ptr<extensions::SidebarContainer> sidebar_container_; |
+ |
// The context menu model for the extension. |
scoped_refptr<ExtensionContextMenuModel> context_menu_model_; |