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

Side by Side Diff: chrome/browser/ui/views/browser_actions_container.h

Issue 10914122: Test ActiveTab (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_
6 #define CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_ 6 #define CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_
7 7
8 #include "chrome/browser/extensions/extension_keybinding_registry.h"
8 #include "chrome/browser/extensions/extension_toolbar_model.h" 9 #include "chrome/browser/extensions/extension_toolbar_model.h"
9 #include "chrome/browser/ui/views/browser_action_view.h" 10 #include "chrome/browser/ui/views/browser_action_view.h"
10 #include "chrome/browser/ui/views/extensions/browser_action_overflow_menu_contro ller.h" 11 #include "chrome/browser/ui/views/extensions/browser_action_overflow_menu_contro ller.h"
11 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views .h" 12 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views .h"
12 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
13 #include "ui/base/animation/animation_delegate.h" 14 #include "ui/base/animation/animation_delegate.h"
14 #include "ui/base/animation/tween.h" 15 #include "ui/base/animation/tween.h"
15 #include "ui/views/controls/button/menu_button.h" 16 #include "ui/views/controls/button/menu_button.h"
16 #include "ui/views/controls/button/menu_button_listener.h" 17 #include "ui/views/controls/button/menu_button_listener.h"
17 #include "ui/views/controls/resize_area_delegate.h" 18 #include "ui/views/controls/resize_area_delegate.h"
18 #include "ui/views/drag_controller.h" 19 #include "ui/views/drag_controller.h"
19 #include "ui/views/view.h" 20 #include "ui/views/view.h"
20 #include "ui/views/widget/widget_observer.h" 21 #include "ui/views/widget/widget_observer.h"
21 22
22 class BrowserActionButton; 23 class BrowserActionButton;
24 class ExtensionKeybindingRegistryViews;
23 class ExtensionPopup; 25 class ExtensionPopup;
24 26
27 namespace extensions {
28 class ActiveTabPermissionManager;
29 }
30
25 namespace ui { 31 namespace ui {
26 class SlideAnimation; 32 class SlideAnimation;
27 } 33 }
28 34
29 namespace views { 35 namespace views {
30 class ResizeArea; 36 class ResizeArea;
31 } 37 }
32 38
33 //////////////////////////////////////////////////////////////////////////////// 39 ////////////////////////////////////////////////////////////////////////////////
34 // 40 //
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // 109 //
104 //////////////////////////////////////////////////////////////////////////////// 110 ////////////////////////////////////////////////////////////////////////////////
105 class BrowserActionsContainer 111 class BrowserActionsContainer
106 : public views::View, 112 : public views::View,
107 public views::MenuButtonListener, 113 public views::MenuButtonListener,
108 public views::ResizeAreaDelegate, 114 public views::ResizeAreaDelegate,
109 public ui::AnimationDelegate, 115 public ui::AnimationDelegate,
110 public ExtensionToolbarModel::Observer, 116 public ExtensionToolbarModel::Observer,
111 public BrowserActionOverflowMenuController::Observer, 117 public BrowserActionOverflowMenuController::Observer,
112 public views::WidgetObserver, 118 public views::WidgetObserver,
113 public BrowserActionView::Delegate { 119 public BrowserActionView::Delegate,
120 public extensions::ExtensionKeybindingRegistry::Delegate {
114 public: 121 public:
115 BrowserActionsContainer(Browser* browser, views::View* owner_view); 122 BrowserActionsContainer(Browser* browser, views::View* owner_view);
116 virtual ~BrowserActionsContainer(); 123 virtual ~BrowserActionsContainer();
117 124
118 void Init(); 125 void Init();
119 126
120 // Get the number of browser actions being displayed. 127 // Get the number of browser actions being displayed.
121 int num_browser_actions() const { return browser_action_views_.size(); } 128 int num_browser_actions() const { return browser_action_views_.size(); }
122 129
123 // Whether we are performing resize animation on the container. 130 // Whether we are performing resize animation on the container.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 197
191 // Overridden from views::WidgetObserver: 198 // Overridden from views::WidgetObserver:
192 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; 199 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
193 200
194 // Overridden from BrowserActionView::Delegate: 201 // Overridden from BrowserActionView::Delegate:
195 virtual int GetCurrentTabId() const OVERRIDE; 202 virtual int GetCurrentTabId() const OVERRIDE;
196 virtual void OnBrowserActionExecuted(BrowserActionButton* button) OVERRIDE; 203 virtual void OnBrowserActionExecuted(BrowserActionButton* button) OVERRIDE;
197 virtual void OnBrowserActionVisibilityChanged() OVERRIDE; 204 virtual void OnBrowserActionVisibilityChanged() OVERRIDE;
198 virtual gfx::Point GetViewContentOffset() const OVERRIDE; 205 virtual gfx::Point GetViewContentOffset() const OVERRIDE;
199 206
207 // Overridden from extension::ExtensionKeybindingRegistry::Delegate:
208 virtual extensions::ActiveTabPermissionManager*
209 GetActiveTabPermissionGranter() OVERRIDE;
210
200 // Moves a browser action with |id| to |new_index|. 211 // Moves a browser action with |id| to |new_index|.
201 void MoveBrowserAction(const std::string& extension_id, size_t new_index); 212 void MoveBrowserAction(const std::string& extension_id, size_t new_index);
202 213
203 // Hide the current popup. 214 // Hide the current popup.
204 void HidePopup(); 215 void HidePopup();
205 216
206 // Simulate a click on a browser action button. This should only be 217 // Simulate a click on a browser action button. This should only be
207 // used by unit tests. 218 // used by unit tests.
208 void TestExecuteBrowserAction(int index); 219 void TestExecuteBrowserAction(int index);
209 220
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 // The resize area for the container. 339 // The resize area for the container.
329 views::ResizeArea* resize_area_; 340 views::ResizeArea* resize_area_;
330 341
331 // The chevron for accessing the overflow items. 342 // The chevron for accessing the overflow items.
332 views::MenuButton* chevron_; 343 views::MenuButton* chevron_;
333 344
334 // The menu to show for the overflow button (chevron). This class manages its 345 // The menu to show for the overflow button (chevron). This class manages its
335 // own lifetime so that it can stay alive during drag and drop operations. 346 // own lifetime so that it can stay alive during drag and drop operations.
336 BrowserActionOverflowMenuController* overflow_menu_; 347 BrowserActionOverflowMenuController* overflow_menu_;
337 348
338 // The class that registers for keyboard shortcuts for extension commands.
339 ExtensionKeybindingRegistryViews extension_keybinding_registry_;
340
341 // The animation that happens when the container snaps to place. 349 // The animation that happens when the container snaps to place.
342 scoped_ptr<ui::SlideAnimation> resize_animation_; 350 scoped_ptr<ui::SlideAnimation> resize_animation_;
343 351
344 // Don't show the chevron while animating. 352 // Don't show the chevron while animating.
345 bool suppress_chevron_; 353 bool suppress_chevron_;
346 354
347 // This is used while the user is resizing (and when the animations are in 355 // This is used while the user is resizing (and when the animations are in
348 // progress) to know how wide the delta is between the current state and what 356 // progress) to know how wide the delta is between the current state and what
349 // we should draw. 357 // we should draw.
350 int resize_amount_; 358 int resize_amount_;
351 359
352 // Keeps track of the absolute pixel width the container should have when we 360 // Keeps track of the absolute pixel width the container should have when we
353 // are done animating. 361 // are done animating.
354 int animation_target_size_; 362 int animation_target_size_;
355 363
356 // The x position for where to draw the drop indicator. -1 if no indicator. 364 // The x position for where to draw the drop indicator. -1 if no indicator.
357 int drop_indicator_position_; 365 int drop_indicator_position_;
358 366
367 // The class that registers for keyboard shortcuts for extension commands.
368 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_;
369
359 base::WeakPtrFactory<BrowserActionsContainer> task_factory_; 370 base::WeakPtrFactory<BrowserActionsContainer> task_factory_;
360 371
361 // Handles delayed showing of the overflow menu when hovering. 372 // Handles delayed showing of the overflow menu when hovering.
362 base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_; 373 base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_;
363 374
364 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); 375 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer);
365 }; 376 };
366 377
367 #endif // CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_ 378 #endif // CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_keybinding_registry.cc ('k') | chrome/browser/ui/views/browser_actions_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698