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

Unified Diff: chrome/browser/ui/views/toolbar/browser_actions_container.h

Issue 419023002: Move ShowPopup logic from BrowserActionsContainer to BrowserActionView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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/views/toolbar/browser_actions_container.h
diff --git a/chrome/browser/ui/views/toolbar/browser_actions_container.h b/chrome/browser/ui/views/toolbar/browser_actions_container.h
index 51a03ef087d0004cf9a7da4227eae1574f677fa9..bded26886d57edd87ba4e8f90bead04437c89ebe 100644
--- a/chrome/browser/ui/views/toolbar/browser_actions_container.h
+++ b/chrome/browser/ui/views/toolbar/browser_actions_container.h
@@ -8,23 +8,17 @@
#include "base/observer_list.h"
#include "chrome/browser/extensions/extension_keybinding_registry.h"
#include "chrome/browser/extensions/extension_toolbar_model.h"
-#include "chrome/browser/ui/views/chrome_views_export.h"
#include "chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h"
-#include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views.h"
-#include "chrome/browser/ui/views/extensions/extension_popup.h"
#include "chrome/browser/ui/views/toolbar/browser_action_view.h"
-#include "chrome/browser/ui/views/toolbar/browser_actions_container_observer.h"
#include "content/public/browser/notification_observer.h"
#include "ui/gfx/animation/animation_delegate.h"
#include "ui/gfx/animation/tween.h"
-#include "ui/views/controls/button/menu_button.h"
#include "ui/views/controls/button/menu_button_listener.h"
#include "ui/views/controls/resize_area_delegate.h"
#include "ui/views/drag_controller.h"
#include "ui/views/view.h"
-#include "ui/views/widget/widget_observer.h"
-class BrowserActionButton;
+class BrowserActionsContainerObserver;
class ExtensionKeybindingRegistryViews;
class ExtensionPopup;
@@ -135,7 +129,6 @@ class BrowserActionsContainer
public gfx::AnimationDelegate,
public extensions::ExtensionToolbarModel::Observer,
public BrowserActionOverflowMenuController::Observer,
- public views::WidgetObserver,
public BrowserActionView::Delegate,
public extensions::ExtensionKeybindingRegistry::Delegate {
public:
@@ -236,16 +229,15 @@ class BrowserActionsContainer
virtual void NotifyMenuDeleted(
BrowserActionOverflowMenuController* controller) OVERRIDE;
- // Overridden from views::WidgetObserver:
- virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
-
// Overridden from BrowserActionView::Delegate:
- virtual void InspectPopup(ExtensionAction* action) OVERRIDE;
virtual int GetCurrentTabId() const OVERRIDE;
- virtual void OnBrowserActionExecuted(BrowserActionButton* button) OVERRIDE;
virtual void OnBrowserActionVisibilityChanged() OVERRIDE;
virtual bool ShownInsideMenu() const OVERRIDE;
virtual void OnBrowserActionViewDragDone() OVERRIDE;
+ virtual views::View* GetOverflowReferenceView() OVERRIDE;
+ virtual void SetPopupOwner(BrowserActionButton* popup_owner) OVERRIDE;
+ virtual void HideActivePopup() OVERRIDE;
+ virtual extensions::ExtensionToolbarModel* GetModel() OVERRIDE;
// Overridden from extension::ExtensionKeybindingRegistry::Delegate:
virtual extensions::ActiveTabPermissionGranter*
@@ -258,18 +250,14 @@ class BrowserActionsContainer
// was shown. Showing the popup will grant tab permissions if
Yoyo Zhou 2014/07/30 01:46:33 Should this say active tab permissions?
Devlin 2014/07/30 16:14:26 For clarity, probably. Done.
// |grant_tab_permissions| is true. Only pass true for this argument for
// popups triggered interactively, not popups triggered by an API.
- bool ShowPopup(const extensions::Extension* extension,
- bool grant_tab_permissions);
-
- // Hide the current popup.
- void HidePopup();
-
- // Simulate a click on a browser action button. This should only be
- // used by unit tests.
- void TestExecuteBrowserAction(int index);
+ // If |can_override| is true, this popup can override other popups (hiding
+ // them) and does not have to be in the active window.
+ bool ShowPopupForExtension(const extensions::Extension* extension,
+ bool grant_tab_permissions,
+ bool can_override);
// Retrieve the current popup. This should only be used by unit tests.
- ExtensionPopup* TestGetPopup() { return popup_; }
+ ExtensionPopup* TestGetPopup();
// Set how many icons the container should show. This should only be used by
// unit tests.
@@ -306,8 +294,6 @@ class BrowserActionsContainer
const extensions::Extension* extension) OVERRIDE;
virtual void BrowserActionMoved(const extensions::Extension* extension,
int index) OVERRIDE;
- virtual bool BrowserActionShowPopup(
- const extensions::Extension* extension) OVERRIDE;
virtual void VisibleCountChanged() OVERRIDE;
virtual void HighlightModeChanged(bool is_highlighting) OVERRIDE;
@@ -359,14 +345,6 @@ class BrowserActionsContainer
// for incognito.
bool ShouldDisplayBrowserAction(const extensions::Extension* extension);
- // Show a popup. Returns true if a new popup was shown. Showing the popup will
- // grant tab permissions if |grant_tab_permissions| is true. Only pass true
- // for this argument for popups triggered interactively, not popups triggered
- // by an API.
- bool ShowPopup(BrowserActionButton* button,
- ExtensionPopup::ShowAction show_action,
- bool grant_tab_permissions);
-
// Whether this container is in overflow mode (as opposed to in 'main'
// mode). See class comments for details on the difference.
bool in_overflow_mode() const { return main_container_ != NULL; }
@@ -389,12 +367,9 @@ class BrowserActionsContainer
// the difference between main and overflow.
BrowserActionsContainer* main_container_;
- // The current popup and the button it came from. NULL if no popup.
- ExtensionPopup* popup_;
-
// The button that triggered the current popup (just a reference to a button
// from browser_action_views_).
- BrowserActionButton* popup_button_;
+ BrowserActionButton* popup_owner_;
// The model that tracks the order of the toolbar icons.
extensions::ExtensionToolbarModel* model_;

Powered by Google App Engine
This is Rietveld 408576698