Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2085)

Unified Diff: chrome/browser/ui/extensions/extension_action_view_controller.h

Issue 1168383002: Implement sidebar support for extension action popups Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix assertion failure at extension_view_host.cc Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 56f325f9b0dc172421ca3117c43a06f3033fc896..bdefdfe0e3aca15d762f72fbcc8d46539bb068e1 100644
--- a/chrome/browser/ui/extensions/extension_action_view_controller.h
+++ b/chrome/browser/ui/extensions/extension_action_view_controller.h
@@ -60,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;
@@ -74,6 +75,9 @@ 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.
bool GetExtensionCommand(extensions::Command* command);
@@ -84,6 +88,7 @@ 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_host_; }
void set_icon_observer(ExtensionActionIconFactory::Observer* icon_observer) {
icon_observer_ = icon_observer;
@@ -94,6 +99,13 @@ class ExtensionActionViewController
const gfx::Size& size);
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;
@@ -128,6 +140,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,
@@ -161,6 +180,9 @@ class ExtensionActionViewController
// The extension popup's host if the popup is visible; null otherwise.
extensions::ExtensionViewHost* popup_host_;
+ // The extension sidebar's host if the sidebar is visible; null otherwise.
+ scoped_ptr<extensions::ExtensionViewHost> sidebar_host_;
+
// The context menu model for the extension.
scoped_refptr<ExtensionContextMenuModel> context_menu_model_;
« no previous file with comments | « chrome/browser/extensions/sidebar_browsertest.cc ('k') | chrome/browser/ui/extensions/extension_action_view_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698