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

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

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