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

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

Issue 3073018: Merge 53841 - Cleanup: Remove pointless GetInsets() override. Simplify |cont... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/472/src/
Patch Set: Created 10 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/views/browser_actions_container.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_VIEWS_BROWSER_ACTIONS_CONTAINER_H_ 5 #ifndef CHROME_BROWSER_VIEWS_BROWSER_ACTIONS_CONTAINER_H_
6 #define CHROME_BROWSER_VIEWS_BROWSER_ACTIONS_CONTAINER_H_ 6 #define CHROME_BROWSER_VIEWS_BROWSER_ACTIONS_CONTAINER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 ExtensionAction* browser_action() const { return browser_action_; } 61 ExtensionAction* browser_action() const { return browser_action_; }
62 Extension* extension() { return extension_; } 62 Extension* extension() { return extension_; }
63 63
64 // Called to update the display to match the browser action's state. 64 // Called to update the display to match the browser action's state.
65 void UpdateState(); 65 void UpdateState();
66 66
67 // Returns the default icon, if any. 67 // Returns the default icon, if any.
68 const SkBitmap& default_icon() const { return default_icon_; } 68 const SkBitmap& default_icon() const { return default_icon_; }
69 69
70 // Overridden from views::View. Return a 0-inset so the icon can draw all the
71 // way to the edge of the view if it wants.
72 virtual gfx::Insets GetInsets() const;
73
74 // Overridden from views::ButtonListener: 70 // Overridden from views::ButtonListener:
75 virtual void ButtonPressed(views::Button* sender, const views::Event& event); 71 virtual void ButtonPressed(views::Button* sender, const views::Event& event);
76 72
77 // Overridden from ImageLoadingTracker. 73 // Overridden from ImageLoadingTracker.
78 virtual void OnImageLoaded( 74 virtual void OnImageLoaded(
79 SkBitmap* image, ExtensionResource resource, int index); 75 SkBitmap* image, ExtensionResource resource, int index);
80 76
81 // Overridden from NotificationObserver: 77 // Overridden from NotificationObserver:
82 virtual void Observe(NotificationType type, 78 virtual void Observe(NotificationType type,
83 const NotificationSource& source, 79 const NotificationSource& source,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 // size for the container (animation_target_size_), clamp that value to the 224 // size for the container (animation_target_size_), clamp that value to the
229 // containers min and max and then animate from the *current* position (that the 225 // containers min and max and then animate from the *current* position (that the
230 // user has dragged the view to) to the target size. 226 // user has dragged the view to) to the target size.
231 // 227 //
232 // Animating the BrowserActionsContainer: 228 // Animating the BrowserActionsContainer:
233 // 229 //
234 // Animations are used when snapping the container to a value that fits all 230 // Animations are used when snapping the container to a value that fits all
235 // visible icons. This can be triggered when the user finishes resizing the 231 // visible icons. This can be triggered when the user finishes resizing the
236 // container or when Browser Actions are added/removed. 232 // container or when Browser Actions are added/removed.
237 // 233 //
238 // We always animate from the current width (container_size_.width()) to the 234 // We always animate from the current width (container_width_) to the target
239 // target size (animation_target_size_), using |resize_amount| to keep track of 235 // size (animation_target_size_), using |resize_amount| to keep track of the
240 // the animation progress. 236 // animation progress.
241 // 237 //
242 // NOTE: When adding Browser Actions to a maximum width container (no overflow) 238 // NOTE: When adding Browser Actions to a maximum width container (no overflow)
243 // we make sure to suppress the chevron menu if it wasn't visible. This is 239 // we make sure to suppress the chevron menu if it wasn't visible. This is
244 // because we won't have enough space to show the new Browser Action until the 240 // because we won't have enough space to show the new Browser Action until the
245 // animation ends and we don't want the chevron to flash into view while we are 241 // animation ends and we don't want the chevron to flash into view while we are
246 // growing the container. 242 // growing the container.
247 // 243 //
248 //////////////////////////////////////////////////////////////////////////////// 244 ////////////////////////////////////////////////////////////////////////////////
249 class BrowserActionsContainer 245 class BrowserActionsContainer
250 : public views::View, 246 : public views::View,
251 public views::ViewMenuDelegate, 247 public views::ViewMenuDelegate,
252 public views::DragController, 248 public views::DragController,
253 public views::ResizeArea::ResizeAreaDelegate, 249 public views::ResizeArea::ResizeAreaDelegate,
254 public AnimationDelegate, 250 public AnimationDelegate,
255 public ExtensionToolbarModel::Observer, 251 public ExtensionToolbarModel::Observer,
256 public BrowserActionOverflowMenuController::Observer, 252 public BrowserActionOverflowMenuController::Observer,
257 public ExtensionContextMenuModel::PopupDelegate, 253 public ExtensionContextMenuModel::PopupDelegate,
258 public ExtensionPopup::Observer { 254 public ExtensionPopup::Observer {
259 public: 255 public:
260 BrowserActionsContainer(Browser* browser, views::View* owner_view); 256 BrowserActionsContainer(Browser* browser, views::View* owner_view);
261 virtual ~BrowserActionsContainer(); 257 virtual ~BrowserActionsContainer();
262 258
263 static void RegisterUserPrefs(PrefService* prefs); 259 static void RegisterUserPrefs(PrefService* prefs);
264 260
265 // Get the number of browser actions being displayed. 261 // Get the number of browser actions being displayed.
266 int num_browser_actions() const { return browser_action_views_.size(); } 262 int num_browser_actions() const { return browser_action_views_.size(); }
267 263
268 // Whether we are performing resize animation on the container. 264 // Whether we are performing resize animation on the container.
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 // The current popup and the button it came from. NULL if no popup. 448 // The current popup and the button it came from. NULL if no popup.
453 ExtensionPopup* popup_; 449 ExtensionPopup* popup_;
454 450
455 // The button that triggered the current popup (just a reference to a button 451 // The button that triggered the current popup (just a reference to a button
456 // from browser_action_views_). 452 // from browser_action_views_).
457 BrowserActionButton* popup_button_; 453 BrowserActionButton* popup_button_;
458 454
459 // The model that tracks the order of the toolbar icons. 455 // The model that tracks the order of the toolbar icons.
460 ExtensionToolbarModel* model_; 456 ExtensionToolbarModel* model_;
461 457
462 // The current size of the container. 458 // The current width of the container.
463 gfx::Size container_size_; 459 int container_width_;
464 460
465 // The resize area for the container. 461 // The resize area for the container.
466 views::ResizeArea* resize_area_; 462 views::ResizeArea* resize_area_;
467 463
468 // The chevron for accessing the overflow items. 464 // The chevron for accessing the overflow items.
469 views::MenuButton* chevron_; 465 views::MenuButton* chevron_;
470 466
471 // The menu to show for the overflow button (chevron). This class manages its 467 // The menu to show for the overflow button (chevron). This class manages its
472 // own lifetime so that it can stay alive during drag and drop operations. 468 // own lifetime so that it can stay alive during drag and drop operations.
473 BrowserActionOverflowMenuController* overflow_menu_; 469 BrowserActionOverflowMenuController* overflow_menu_;
(...skipping 18 matching lines...) Expand all
492 488
493 ScopedRunnableMethodFactory<BrowserActionsContainer> task_factory_; 489 ScopedRunnableMethodFactory<BrowserActionsContainer> task_factory_;
494 490
495 // Handles delayed showing of the overflow menu when hovering. 491 // Handles delayed showing of the overflow menu when hovering.
496 ScopedRunnableMethodFactory<BrowserActionsContainer> show_menu_task_factory_; 492 ScopedRunnableMethodFactory<BrowserActionsContainer> show_menu_task_factory_;
497 493
498 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); 494 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer);
499 }; 495 };
500 496
501 #endif // CHROME_BROWSER_VIEWS_BROWSER_ACTIONS_CONTAINER_H_ 497 #endif // CHROME_BROWSER_VIEWS_BROWSER_ACTIONS_CONTAINER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/views/browser_actions_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698