| 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 6e3283d8047ea9e7cce52a9cb553921fd5fcf398..98d2464e356334348ece318151dc27b1f8e6fb64 100644
|
| --- a/chrome/browser/ui/views/toolbar/browser_actions_container.h
|
| +++ b/chrome/browser/ui/views/toolbar/browser_actions_container.h
|
| @@ -9,8 +9,8 @@
|
| #include "chrome/browser/extensions/extension_keybinding_registry.h"
|
| #include "chrome/browser/extensions/extension_toolbar_model.h"
|
| #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views.h"
|
| +#include "chrome/browser/ui/views/toolbar/browser_action_view.h"
|
| #include "chrome/browser/ui/views/toolbar/chevron_menu_button.h"
|
| -#include "chrome/browser/ui/views/toolbar/toolbar_action_view.h"
|
| #include "ui/gfx/animation/animation_delegate.h"
|
| #include "ui/gfx/animation/tween.h"
|
| #include "ui/views/controls/button/menu_button_listener.h"
|
| @@ -36,10 +36,9 @@
|
| }
|
|
|
| // The BrowserActionsContainer is a container view, responsible for drawing the
|
| -// toolbar action icons (including extension icons and icons for component
|
| -// toolbar actions). It comes intwo flavors, a main container (when residing on
|
| -// the toolbar) and an overflow container (that resides in the main application
|
| -// menu, aka the Chrome menu).
|
| +// browser action icons (extensions that add icons to the toolbar). It comes in
|
| +// two flavors, a main container (when residing on the toolbar) and an overflow
|
| +// container (that resides in the main application menu, aka the Chrome menu).
|
| //
|
| // When in 'main' mode, the container supports the full functionality of a
|
| // BrowserActionContainer, but in 'overflow' mode the container is effectively
|
| @@ -127,7 +126,7 @@
|
| public views::ResizeAreaDelegate,
|
| public gfx::AnimationDelegate,
|
| public extensions::ExtensionToolbarModel::Observer,
|
| - public ToolbarActionView::Delegate,
|
| + public BrowserActionView::Delegate,
|
| public extensions::ExtensionKeybindingRegistry::Delegate {
|
| public:
|
| // Horizontal spacing between most items in the container, as well as after
|
| @@ -142,8 +141,8 @@
|
|
|
| void Init();
|
|
|
| - // Get the number of toolbar actions being displayed.
|
| - size_t num_toolbar_actions() const { return toolbar_action_views_.size(); }
|
| + // Get the number of browser actions being displayed.
|
| + size_t num_browser_actions() const { return browser_action_views_.size(); }
|
|
|
| // Whether we are performing resize animation on the container.
|
| bool animating() const { return animation_target_size_ > 0; }
|
| @@ -160,43 +159,44 @@
|
| return extension_keybinding_registry_.get();
|
| }
|
|
|
| - // Get a particular toolbar action view.
|
| - ToolbarActionView* GetToolbarActionViewAt(int index) {
|
| - return toolbar_action_views_[index];
|
| + // Get a particular browser action view.
|
| + BrowserActionView* GetBrowserActionViewAt(int index) {
|
| + return browser_action_views_[index];
|
| }
|
|
|
| // Returns the ID of the action represented by the view at |index|.
|
| const std::string& GetIdAt(size_t index);
|
|
|
| - // Returns the ToolbarActionView* associated with the given |extension|, or
|
| + // Returns the BrowserActionView* associated with the given |extension|, or
|
| // NULL if none exists.
|
| - ToolbarActionView* GetViewForExtension(
|
| + BrowserActionView* GetViewForExtension(
|
| const extensions::Extension* extension);
|
|
|
| - // Update the views to reflect the state of the toolbar actions.
|
| - void RefreshToolbarActionViews();
|
| -
|
| - // Sets up the toolbar action view vector.
|
| - void CreateToolbarActionViews();
|
| -
|
| - // Delete all toolbar action views.
|
| - void DeleteToolbarActionViews();
|
| -
|
| - // Returns how many actions are currently visible. If the intent is to find
|
| - // how many are visible once the container finishes animation, see
|
| + // Update the views to reflect the state of the browser action icons.
|
| + void RefreshBrowserActionViews();
|
| +
|
| + // Sets up the browser action view vector.
|
| + void CreateBrowserActionViews();
|
| +
|
| + // Delete all browser action views.
|
| + void DeleteBrowserActionViews();
|
| +
|
| + // Returns how many browser actions are currently visible. If the intent is
|
| + // to find how many are visible once the container finishes animation, see
|
| // VisibleBrowserActionsAfterAnimation() below.
|
| size_t VisibleBrowserActions() const;
|
|
|
| - // Returns how many actions will be visible once the container finishes
|
| - // animating to a new size, or (if not animating) the currently visible icons.
|
| + // Returns how many browser actions will be visible once the container
|
| + // finishes animating to a new size, or (if not animating) the currently
|
| + // visible icons.
|
| size_t VisibleBrowserActionsAfterAnimation() const;
|
|
|
| // Executes |command| registered by |extension|.
|
| void ExecuteExtensionCommand(const extensions::Extension* extension,
|
| const extensions::Command& command);
|
|
|
| - // Notify the container that an extension has been moved to the overflow
|
| - // container.
|
| + // Notify the browser action container that an extension has been moved to
|
| + // the overflow container.
|
| void NotifyActionMovedToOverflow();
|
|
|
| // Add or remove an observer.
|
| @@ -234,15 +234,15 @@
|
| virtual void AnimationProgressed(const gfx::Animation* animation) override;
|
| virtual void AnimationEnded(const gfx::Animation* animation) override;
|
|
|
| - // Overridden from ToolbarActionView::Delegate:
|
| + // Overridden from BrowserActionView::Delegate:
|
| virtual content::WebContents* GetCurrentWebContents() override;
|
| virtual bool ShownInsideMenu() const override;
|
| - virtual void OnToolbarActionViewDragDone() override;
|
| + virtual void OnBrowserActionViewDragDone() override;
|
| virtual views::MenuButton* GetOverflowReferenceView() override;
|
| - virtual void SetPopupOwner(ToolbarActionView* popup_owner) override;
|
| + virtual void SetPopupOwner(BrowserActionView* popup_owner) override;
|
| virtual void HideActivePopup() override;
|
| - virtual ToolbarActionView* GetMainViewForAction(
|
| - ToolbarActionView* view) override;
|
| + virtual BrowserActionView* GetMainViewForAction(
|
| + BrowserActionView* view) override;
|
|
|
| // Overridden from extension::ExtensionKeybindingRegistry::Delegate:
|
| virtual extensions::ActiveTabPermissionGranter*
|
| @@ -273,7 +273,7 @@
|
| // A struct representing the position at which an action will be dropped.
|
| struct DropPosition;
|
|
|
| - typedef std::vector<ToolbarActionView*> ToolbarActionViews;
|
| + typedef std::vector<BrowserActionView*> BrowserActionViews;
|
|
|
| // extensions::ExtensionToolbarModel::Observer implementation.
|
| virtual void ToolbarExtensionAdded(const extensions::Extension* extension,
|
| @@ -293,15 +293,15 @@
|
|
|
| void LoadImages();
|
|
|
| - // Called when an action's visibility may have changed.
|
| + // Called when a browser action's visibility may have changed.
|
| void OnBrowserActionVisibilityChanged();
|
|
|
| // Returns the preferred width of the container in order to show all icons
|
| // that should be visible and, optionally, the chevron.
|
| int GetPreferredWidth();
|
|
|
| - // Sets the chevron to be visible or not based on whether all actions are
|
| - // displayed.
|
| + // Sets the chevron to be visible or not based on whether all browser actions
|
| + // are displayed.
|
| void SetChevronVisibility();
|
|
|
| // Given a number of |icons|, returns the pixels needed to draw the entire
|
| @@ -338,8 +338,10 @@
|
| // Whether or not the container has been initialized.
|
| bool initialized_;
|
|
|
| - // The vector of toolbar actions (icons/image buttons for each action).
|
| - ToolbarActionViews toolbar_action_views_;
|
| + // The vector of browser actions (icons/image buttons for each action). Note
|
| + // that not every BrowserAction in the ToolbarModel will necessarily be in
|
| + // this collection. Some extensions may be disabled in incognito windows.
|
| + BrowserActionViews browser_action_views_;
|
|
|
| Profile* profile_;
|
|
|
| @@ -352,8 +354,8 @@
|
| BrowserActionsContainer* main_container_;
|
|
|
| // The view that triggered the current popup (just a reference to a view
|
| - // from toolbar_action_views_).
|
| - ToolbarActionView* popup_owner_;
|
| + // from browser_action_views_).
|
| + BrowserActionView* popup_owner_;
|
|
|
| // The model that tracks the order of the toolbar icons.
|
| extensions::ExtensionToolbarModel* model_;
|
|
|