1f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_
6f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
8effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch#include "base/observer_list.h"
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/extensions/extension_keybinding_registry.h"
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/extensions/extension_toolbar_model.h"
112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "chrome/browser/ui/views/chrome_views_export.h"
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.h"
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views.h"
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/views/extensions/extension_popup.h"
15f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "chrome/browser/ui/views/toolbar/browser_action_view.h"
16effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch#include "chrome/browser/ui/views/toolbar/browser_actions_container_observer.h"
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/notification_observer.h"
18d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include "ui/gfx/animation/animation_delegate.h"
19d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include "ui/gfx/animation/tween.h"
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/controls/button/menu_button.h"
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/controls/button/menu_button_listener.h"
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/controls/resize_area_delegate.h"
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/drag_controller.h"
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/view.h"
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/widget/widget_observer.h"
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BrowserActionButton;
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ExtensionKeybindingRegistryViews;
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ExtensionPopup;
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace extensions {
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ActiveTabPermissionGranter;
33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class Command;
34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class Extension;
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
37d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)namespace gfx {
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SlideAnimation;
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace views {
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ResizeArea;
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)////////////////////////////////////////////////////////////////////////////////
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The BrowserActionsContainer is a container view, responsible for drawing the
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// browser action icons (extensions that add icons to the toolbar).
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The container is placed flush against the omnibox and wrench menu, and its
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// layout looks like:
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//   rI_I_IcCs
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Where the letters are as follows:
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//   r: An invisible resize area.  This is ToolbarView::kStandardSpacing pixels
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//      wide and directly adjacent to the omnibox.
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//   I: An icon.  This is as wide as the IDR_BROWSER_ACTION image.
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//   _: kItemSpacing pixels of empty space.
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//   c: kChevronSpacing pixels of empty space.  Only present if C is present.
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//   C: An optional chevron, visible for overflow.  As wide as the
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//      IDR_BROWSER_ACTIONS_OVERFLOW image.
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//   s: ToolbarView::kStandardSpacing pixels of empty space (before the wrench
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//      menu).
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The reason the container contains the trailing space "s", rather than having
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// it be handled by the parent view, is so that when the chevron is invisible
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// and the user starts dragging an icon around, we have the space to draw the
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// ultimate drop indicator.  (Otherwise, we'd be trying to draw it into the
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// padding beyond our right edge, and it wouldn't appear.)
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The BrowserActionsContainer follows a few rules, in terms of user experience:
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 1) The container can never grow beyond the space needed to show all icons
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// (hereby referred to as the max width).
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 2) The container can never shrink below the space needed to show just the
745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// initial padding and the chevron (ignoring the case where there are no icons
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// to show, in which case the container won't be visible anyway).
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 3) The container snaps into place (to the pixel count that fits the visible
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// icons) to make sure there is no wasted space at the edges of the container.
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 4) If the user adds or removes icons (read: installs/uninstalls browser
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// actions) we grow and shrink the container as needed - but ONLY if the
805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// container was at max width to begin with.
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 5) If the container is NOT at max width (has an overflow menu), we respect
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// that size when adding and removing icons and DON'T grow/shrink the container.
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This means that new icons (which always appear at the far right) will show up
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// in the overflow menu. The install bubble for extensions points to the chevron
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// menu in this case.
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Resizing the BrowserActionsContainer:
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The ResizeArea view sends OnResize messages to the BrowserActionsContainer
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// class as the user drags it. This modifies the value for |resize_amount_|.
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// That indicates to the container that a resize is in progress and is used to
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// calculate the size in GetPreferredSize(), though that function never exceeds
935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// the defined minimum and maximum size of the container.
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// When the user releases the mouse (ends the resize), we calculate a target
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// size for the container (animation_target_size_), clamp that value to the
975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// containers min and max and then animate from the *current* position (that the
985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// user has dragged the view to) to the target size.
995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Animating the BrowserActionsContainer:
1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Animations are used when snapping the container to a value that fits all
1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// visible icons. This can be triggered when the user finishes resizing the
1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// container or when Browser Actions are added/removed.
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// We always animate from the current width (container_width_) to the target
1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// size (animation_target_size_), using |resize_amount| to keep track of the
1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// animation progress.
1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// NOTE: When adding Browser Actions to a maximum width container (no overflow)
1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// we make sure to suppress the chevron menu if it wasn't visible. This is
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// because we won't have enough space to show the new Browser Action until the
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// animation ends and we don't want the chevron to flash into view while we are
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// growing the container.
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)////////////////////////////////////////////////////////////////////////////////
1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BrowserActionsContainer
1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    : public views::View,
1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      public views::MenuButtonListener,
1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      public views::ResizeAreaDelegate,
121d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)      public gfx::AnimationDelegate,
122effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch      public extensions::ExtensionToolbarModel::Observer,
1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      public BrowserActionOverflowMenuController::Observer,
1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      public views::WidgetObserver,
1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      public BrowserActionView::Delegate,
1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      public extensions::ExtensionKeybindingRegistry::Delegate {
1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BrowserActionsContainer(Browser* browser, views::View* owner_view);
1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~BrowserActionsContainer();
1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void Init();
1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Get the number of browser actions being displayed.
1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int num_browser_actions() const { return browser_action_views_.size(); }
1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Whether we are performing resize animation on the container.
1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool animating() const { return animation_target_size_ > 0; }
1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the chevron, if any.
1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  views::View* chevron() { return chevron_; }
1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const views::View* chevron() const { return chevron_; }
1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the profile this container is associated with.
1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Profile* profile() const { return profile_; }
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Get a particular browser action view.
1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BrowserActionView* GetBrowserActionViewAt(int index) {
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return browser_action_views_[index];
1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Retrieve the BrowserActionView for a certain extension |action|.
1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BrowserActionView* GetBrowserActionView(ExtensionAction* action);
1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Update the views to reflect the state of the browser action icons.
1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void RefreshBrowserActionViews();
1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sets up the browser action view vector.
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CreateBrowserActionViews();
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Delete all browser action views.
1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void DeleteBrowserActionViews();
1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
16346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // Returns how many browser actions are currently visible. If the intent is
16446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // to find how many are visible once the container finishes animation, see
16546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // VisibleBrowserActionsAfterAnimation() below.
1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  size_t VisibleBrowserActions() const;
1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
16846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // Returns how many browser actions will be visible once the container
16946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // finishes animating to a new size, or (if not animating) the currently
17046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  // visible icons.
17146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  size_t VisibleBrowserActionsAfterAnimation() const;
17246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
173a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Executes |command| registered by |extension|.
174a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  void ExecuteExtensionCommand(const extensions::Extension* extension,
175a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                               const extensions::Command& command);
176a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
177effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // Add or remove an observer.
178effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  void AddObserver(BrowserActionsContainerObserver* observer);
179effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  void RemoveObserver(BrowserActionsContainerObserver* observer);
180effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from views::View:
182cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual gfx::Size GetPreferredSize() const OVERRIDE;
183cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual gfx::Size GetMinimumSize() const OVERRIDE;
1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Layout() OVERRIDE;
1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool GetDropFormats(int* formats,
1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE;
1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool AreDropTypesRequired() OVERRIDE;
1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool CanDrop(const ui::OSExchangeData& data) OVERRIDE;
1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE;
1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE;
1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnDragExited() OVERRIDE;
1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE;
193a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from views::MenuButtonListener:
1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnMenuButtonClicked(views::View* source,
1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                   const gfx::Point& point) OVERRIDE;
1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from views::DragController:
2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void WriteDragDataForView(View* sender,
2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                    const gfx::Point& press_pt,
2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                    ui::OSExchangeData* data) OVERRIDE;
2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual int GetDragOperationsForView(View* sender,
2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                       const gfx::Point& p) OVERRIDE;
2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool CanStartDragForView(View* sender,
2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                   const gfx::Point& press_pt,
2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                   const gfx::Point& p) OVERRIDE;
2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from views::ResizeAreaDelegate:
2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnResize(int resize_amount, bool done_resizing) OVERRIDE;
2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
212d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Overridden from gfx::AnimationDelegate:
213d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
214d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from BrowserActionOverflowMenuController::Observer:
2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void NotifyMenuDeleted(
2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      BrowserActionOverflowMenuController* controller) OVERRIDE;
2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from views::WidgetObserver:
2212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE;
2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from BrowserActionView::Delegate:
2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void InspectPopup(ExtensionAction* action) OVERRIDE;
2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual int GetCurrentTabId() const OVERRIDE;
2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnBrowserActionExecuted(BrowserActionButton* button) OVERRIDE;
2275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnBrowserActionVisibilityChanged() OVERRIDE;
2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from extension::ExtensionKeybindingRegistry::Delegate:
2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual extensions::ActiveTabPermissionGranter*
2315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      GetActiveTabPermissionGranter() OVERRIDE;
2325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Moves a browser action with |id| to |new_index|.
2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void MoveBrowserAction(const std::string& extension_id, size_t new_index);
2355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
236a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Shows the popup for |extension| if possible. Returns true if a new popup
237a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // was shown. Showing the popup will grant tab permissions if
238a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // |grant_tab_permissions| is true. Only pass true for this argument for
239a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // popups triggered interactively, not popups triggered by an API.
240a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  bool ShowPopup(const extensions::Extension* extension,
241a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                 bool grant_tab_permissions);
242a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
2435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Hide the current popup.
2445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void HidePopup();
2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Simulate a click on a browser action button.  This should only be
2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // used by unit tests.
2485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void TestExecuteBrowserAction(int index);
2495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Retrieve the current popup.  This should only be used by unit tests.
2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ExtensionPopup* TestGetPopup() { return popup_; }
2525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Set how many icons the container should show. This should only be used by
2545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // unit tests.
2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void TestSetIconVisibilityCount(size_t icons);
2565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // During testing we can disable animations by setting this flag to true,
2585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // so that the bar resizes instantly, instead of having to poll it while it
2595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // animates to open/closed status.
2605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static bool disable_animations_during_testing_;
2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected:
2635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from views::View:
264a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)  virtual void ViewHierarchyChanged(
265a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)      const ViewHierarchyChangedDetails& details) OVERRIDE;
2665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
2675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnThemeChanged() OVERRIDE;
2685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
270effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  friend class BrowserActionView;  // So it can access IconWidth().
2715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  friend class ShowFolderMenuTask;
2725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  typedef std::vector<BrowserActionView*> BrowserActionViews;
2745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the width of an icon, optionally with its padding.
2765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static int IconWidth(bool include_padding);
2775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the height of an icon.
2795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static int IconHeight();
2805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
281effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // extensions::ExtensionToolbarModel::Observer implementation.
2825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void BrowserActionAdded(const extensions::Extension* extension,
2835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                  int index) OVERRIDE;
2845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void BrowserActionRemoved(
2855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const extensions::Extension* extension) OVERRIDE;
2865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void BrowserActionMoved(const extensions::Extension* extension,
2875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                  int index) OVERRIDE;
2888bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  virtual bool BrowserActionShowPopup(
2898bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)      const extensions::Extension* extension) OVERRIDE;
2905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void VisibleCountChanged() OVERRIDE;
291effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  virtual void HighlightModeChanged(bool is_highlighting) OVERRIDE;
2925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void LoadImages();
2945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sets the initial container width.
2965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetContainerWidth();
2975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Closes the overflow menu if open.
2995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void CloseOverflowMenu();
3005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Cancels the timer for showing the drop down menu.
3025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void StopShowFolderDropMenuTimer();
3035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Show the drop down folder after a slight delay.
3055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void StartShowFolderDropMenuTimer();
3065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Show the overflow menu.
3085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ShowDropFolder();
3095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sets the drop indicator position (and schedules paint if the position has
3115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // changed).
3125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetDropIndicator(int x_pos);
3135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Given a number of |icons| and whether to |display_chevron|, returns the
3155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // amount of pixels needed to draw the entire container.  For convenience,
3165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // callers can set |icons| to -1 to mean "all icons".
3175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int IconCountToWidth(int icons, bool display_chevron) const;
3185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Given a pixel width, returns the number of icons that fit.  (This
3205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // automatically determines whether a chevron will be needed and includes it
3215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // in the calculation.)
3225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  size_t WidthToIconCount(int pixels) const;
3235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the absolute minimum size you can shrink the container down to and
3255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // still show it.  This assumes a visible chevron because the only way we
3265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // would not have a chevron when shrinking down this far is if there were no
3275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // icons, in which case the container wouldn't be shown at all.
328cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  int MinimumNonemptyWidth() const;
3295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Animate to the target size (unless testing, in which case we go straight to
3315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the target size).  This also saves the target number of visible icons in
3325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the pref if we're not incognito.
333d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  void SaveDesiredSizeAndAnimate(gfx::Tween::Type type,
3345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                 size_t num_visible_icons);
3355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if this extension should be shown in this toolbar. This can
3375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // return false if we are in an incognito window and the extension is disabled
3385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // for incognito.
3395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool ShouldDisplayBrowserAction(const extensions::Extension* extension);
3405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3418bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // Show a popup. Returns true if a new popup was shown. Showing the popup will
342a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // grant tab permissions if |grant_tab_permissions| is true. Only pass true
343a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // for this argument for popups triggered interactively, not popups triggered
344a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // by an API.
3458bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bool ShowPopup(BrowserActionButton* button,
3468bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)                 ExtensionPopup::ShowAction show_action,
347a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                 bool grant_tab_permissions);
3485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The vector of browser actions (icons/image buttons for each action). Note
3505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // that not every BrowserAction in the ToolbarModel will necessarily be in
3515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // this collection. Some extensions may be disabled in incognito windows.
3525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BrowserActionViews browser_action_views_;
3535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Profile* profile_;
3555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The Browser object the container is associated with.
3575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Browser* browser_;
3585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The view that owns us.
3605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  views::View* owner_view_;
3615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The current popup and the button it came from.  NULL if no popup.
3635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ExtensionPopup* popup_;
3645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The button that triggered the current popup (just a reference to a button
3665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // from browser_action_views_).
3675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BrowserActionButton* popup_button_;
3685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The model that tracks the order of the toolbar icons.
370effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  extensions::ExtensionToolbarModel* model_;
3715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The current width of the container.
3735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int container_width_;
3745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The resize area for the container.
3765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  views::ResizeArea* resize_area_;
3775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The chevron for accessing the overflow items.
3795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  views::MenuButton* chevron_;
3805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
381effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // The painter used when we are highlighting a subset of extensions.
382effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  scoped_ptr<views::Painter> highlight_painter_;
383effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
3845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The menu to show for the overflow button (chevron). This class manages its
3855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // own lifetime so that it can stay alive during drag and drop operations.
3865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BrowserActionOverflowMenuController* overflow_menu_;
3875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The animation that happens when the container snaps to place.
389d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  scoped_ptr<gfx::SlideAnimation> resize_animation_;
3905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Don't show the chevron while animating.
3925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool suppress_chevron_;
3935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This is used while the user is resizing (and when the animations are in
3955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // progress) to know how wide the delta is between the current state and what
3965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // we should draw.
3975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int resize_amount_;
3985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Keeps track of the absolute pixel width the container should have when we
4005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // are done animating.
4015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int animation_target_size_;
4025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The x position for where to draw the drop indicator. -1 if no indicator.
4045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int drop_indicator_position_;
4055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The class that registers for keyboard shortcuts for extension commands.
4075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_;
4085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  base::WeakPtrFactory<BrowserActionsContainer> task_factory_;
4105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Handles delayed showing of the overflow menu when hovering.
4125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_;
4135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
414effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  ObserverList<BrowserActionsContainerObserver> observers_;
415effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
4165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer);
4175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
4185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
419f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#endif  // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_
420