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

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

Issue 6154001: Move animation code to new ui/base/animation directory.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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) 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_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 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "app/animation_delegate.h"
14 #include "app/tween.h"
15 #include "base/task.h" 13 #include "base/task.h"
16 #include "chrome/browser/extensions/extension_context_menu_model.h" 14 #include "chrome/browser/extensions/extension_context_menu_model.h"
17 #include "chrome/browser/extensions/extension_toolbar_model.h" 15 #include "chrome/browser/extensions/extension_toolbar_model.h"
18 #include "chrome/browser/extensions/image_loading_tracker.h" 16 #include "chrome/browser/extensions/image_loading_tracker.h"
19 #include "chrome/browser/views/browser_bubble.h" 17 #include "chrome/browser/views/browser_bubble.h"
20 #include "chrome/browser/views/extensions/browser_action_overflow_menu_controlle r.h" 18 #include "chrome/browser/views/extensions/browser_action_overflow_menu_controlle r.h"
21 #include "chrome/browser/views/extensions/extension_popup.h" 19 #include "chrome/browser/views/extensions/extension_popup.h"
22 #include "chrome/common/notification_observer.h" 20 #include "chrome/common/notification_observer.h"
23 #include "chrome/common/notification_registrar.h" 21 #include "chrome/common/notification_registrar.h"
22 #include "ui/base/animation/animation_delegate.h"
23 #include "ui/base/animation/tween.h"
24 #include "views/controls/button/menu_button.h" 24 #include "views/controls/button/menu_button.h"
25 #include "views/controls/menu/view_menu_delegate.h" 25 #include "views/controls/menu/view_menu_delegate.h"
26 #include "views/controls/resize_area.h" 26 #include "views/controls/resize_area.h"
27 #include "views/view.h" 27 #include "views/view.h"
28 28
29 class Browser; 29 class Browser;
30 class BrowserActionsContainer; 30 class BrowserActionsContainer;
31 class BrowserActionOverflowMenuController; 31 class BrowserActionOverflowMenuController;
32 class BrowserActionsContainer; 32 class BrowserActionsContainer;
33 class Extension; 33 class Extension;
34 class ExtensionAction; 34 class ExtensionAction;
35 class ExtensionPopup; 35 class ExtensionPopup;
36 class PrefService; 36 class PrefService;
37 class Profile; 37 class Profile;
38 class SlideAnimation;
39 38
40 namespace gfx { 39 namespace gfx {
41 class CanvasSkia; 40 class CanvasSkia;
42 } 41 }
43 42
43 namespace ui {
44 class SlideAnimation;
45 }
46
44 namespace views { 47 namespace views {
45 class Menu2; 48 class Menu2;
46 } 49 }
47 50
48 //////////////////////////////////////////////////////////////////////////////// 51 ////////////////////////////////////////////////////////////////////////////////
49 // BrowserActionButton 52 // BrowserActionButton
50 53
51 // The BrowserActionButton is a specialization of the MenuButton class. 54 // The BrowserActionButton is a specialization of the MenuButton class.
52 // It acts on a ExtensionAction, in this case a BrowserAction and handles 55 // It acts on a ExtensionAction, in this case a BrowserAction and handles
53 // loading the image for the button asynchronously on the file thread. 56 // loading the image for the button asynchronously on the file thread.
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // because we won't have enough space to show the new Browser Action until the 250 // because we won't have enough space to show the new Browser Action until the
248 // animation ends and we don't want the chevron to flash into view while we are 251 // animation ends and we don't want the chevron to flash into view while we are
249 // growing the container. 252 // growing the container.
250 // 253 //
251 //////////////////////////////////////////////////////////////////////////////// 254 ////////////////////////////////////////////////////////////////////////////////
252 class BrowserActionsContainer 255 class BrowserActionsContainer
253 : public views::View, 256 : public views::View,
254 public views::ViewMenuDelegate, 257 public views::ViewMenuDelegate,
255 public views::DragController, 258 public views::DragController,
256 public views::ResizeArea::ResizeAreaDelegate, 259 public views::ResizeArea::ResizeAreaDelegate,
257 public AnimationDelegate, 260 public ui::AnimationDelegate,
258 public ExtensionToolbarModel::Observer, 261 public ExtensionToolbarModel::Observer,
259 public BrowserActionOverflowMenuController::Observer, 262 public BrowserActionOverflowMenuController::Observer,
260 public ExtensionContextMenuModel::PopupDelegate, 263 public ExtensionContextMenuModel::PopupDelegate,
261 public ExtensionPopup::Observer { 264 public ExtensionPopup::Observer {
262 public: 265 public:
263 BrowserActionsContainer(Browser* browser, views::View* owner_view); 266 BrowserActionsContainer(Browser* browser, views::View* owner_view);
264 virtual ~BrowserActionsContainer(); 267 virtual ~BrowserActionsContainer();
265 268
266 static void RegisterUserPrefs(PrefService* prefs); 269 static void RegisterUserPrefs(PrefService* prefs);
267 270
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 const gfx::Point& press_pt, 341 const gfx::Point& press_pt,
339 OSExchangeData* data); 342 OSExchangeData* data);
340 virtual int GetDragOperations(View* sender, const gfx::Point& p); 343 virtual int GetDragOperations(View* sender, const gfx::Point& p);
341 virtual bool CanStartDrag(View* sender, 344 virtual bool CanStartDrag(View* sender,
342 const gfx::Point& press_pt, 345 const gfx::Point& press_pt,
343 const gfx::Point& p); 346 const gfx::Point& p);
344 347
345 // Overridden from ResizeArea::ResizeAreaDelegate: 348 // Overridden from ResizeArea::ResizeAreaDelegate:
346 virtual void OnResize(int resize_amount, bool done_resizing); 349 virtual void OnResize(int resize_amount, bool done_resizing);
347 350
348 // Overridden from AnimationDelegate: 351 // Overridden from ui::AnimationDelegate:
349 virtual void AnimationProgressed(const Animation* animation); 352 virtual void AnimationProgressed(const ui::Animation* animation);
350 virtual void AnimationEnded(const Animation* animation); 353 virtual void AnimationEnded(const ui::Animation* animation);
351 354
352 // Overridden from BrowserActionOverflowMenuController::Observer: 355 // Overridden from BrowserActionOverflowMenuController::Observer:
353 virtual void NotifyMenuDeleted( 356 virtual void NotifyMenuDeleted(
354 BrowserActionOverflowMenuController* controller); 357 BrowserActionOverflowMenuController* controller);
355 358
356 // Overridden from ExtensionContextMenuModel::PopupDelegate 359 // Overridden from ExtensionContextMenuModel::PopupDelegate
357 virtual void InspectPopup(ExtensionAction* action); 360 virtual void InspectPopup(ExtensionAction* action);
358 361
359 // Overriden from ExtensionPopup::Delegate 362 // Overriden from ExtensionPopup::Delegate
360 virtual void ExtensionPopupIsClosing(ExtensionPopup* popup); 363 virtual void ExtensionPopupIsClosing(ExtensionPopup* popup);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 435
433 // Returns the absolute minimum size you can shrink the container down to and 436 // Returns the absolute minimum size you can shrink the container down to and
434 // still show it. This assumes a visible chevron because the only way we 437 // still show it. This assumes a visible chevron because the only way we
435 // would not have a chevron when shrinking down this far is if there were no 438 // would not have a chevron when shrinking down this far is if there were no
436 // icons, in which case the container wouldn't be shown at all. 439 // icons, in which case the container wouldn't be shown at all.
437 int ContainerMinSize() const; 440 int ContainerMinSize() const;
438 441
439 // Animate to the target size (unless testing, in which case we go straight to 442 // Animate to the target size (unless testing, in which case we go straight to
440 // the target size). This also saves the target number of visible icons in 443 // the target size). This also saves the target number of visible icons in
441 // the pref if we're not off the record. 444 // the pref if we're not off the record.
442 void SaveDesiredSizeAndAnimate(Tween::Type type, size_t num_visible_icons); 445 void SaveDesiredSizeAndAnimate(ui::Tween::Type type,
446 size_t num_visible_icons);
443 447
444 // Returns true if this extension should be shown in this toolbar. This can 448 // Returns true if this extension should be shown in this toolbar. This can
445 // return false if we are in an incognito window and the extension is disabled 449 // return false if we are in an incognito window and the extension is disabled
446 // for incognito. 450 // for incognito.
447 bool ShouldDisplayBrowserAction(const Extension* extension); 451 bool ShouldDisplayBrowserAction(const Extension* extension);
448 452
449 // The vector of browser actions (icons/image buttons for each action). Note 453 // The vector of browser actions (icons/image buttons for each action). Note
450 // that not every BrowserAction in the ToolbarModel will necessarily be in 454 // that not every BrowserAction in the ToolbarModel will necessarily be in
451 // this collection. Some extensions may be disabled in incognito windows. 455 // this collection. Some extensions may be disabled in incognito windows.
452 BrowserActionViews browser_action_views_; 456 BrowserActionViews browser_action_views_;
(...skipping 23 matching lines...) Expand all
476 views::ResizeArea* resize_area_; 480 views::ResizeArea* resize_area_;
477 481
478 // The chevron for accessing the overflow items. 482 // The chevron for accessing the overflow items.
479 views::MenuButton* chevron_; 483 views::MenuButton* chevron_;
480 484
481 // The menu to show for the overflow button (chevron). This class manages its 485 // The menu to show for the overflow button (chevron). This class manages its
482 // own lifetime so that it can stay alive during drag and drop operations. 486 // own lifetime so that it can stay alive during drag and drop operations.
483 BrowserActionOverflowMenuController* overflow_menu_; 487 BrowserActionOverflowMenuController* overflow_menu_;
484 488
485 // The animation that happens when the container snaps to place. 489 // The animation that happens when the container snaps to place.
486 scoped_ptr<SlideAnimation> resize_animation_; 490 scoped_ptr<ui::SlideAnimation> resize_animation_;
487 491
488 // Don't show the chevron while animating. 492 // Don't show the chevron while animating.
489 bool suppress_chevron_; 493 bool suppress_chevron_;
490 494
491 // This is used while the user is resizing (and when the animations are in 495 // This is used while the user is resizing (and when the animations are in
492 // progress) to know how wide the delta is between the current state and what 496 // progress) to know how wide the delta is between the current state and what
493 // we should draw. 497 // we should draw.
494 int resize_amount_; 498 int resize_amount_;
495 499
496 // Keeps track of the absolute pixel width the container should have when we 500 // Keeps track of the absolute pixel width the container should have when we
497 // are done animating. 501 // are done animating.
498 int animation_target_size_; 502 int animation_target_size_;
499 503
500 // The x position for where to draw the drop indicator. -1 if no indicator. 504 // The x position for where to draw the drop indicator. -1 if no indicator.
501 int drop_indicator_position_; 505 int drop_indicator_position_;
502 506
503 ScopedRunnableMethodFactory<BrowserActionsContainer> task_factory_; 507 ScopedRunnableMethodFactory<BrowserActionsContainer> task_factory_;
504 508
505 // Handles delayed showing of the overflow menu when hovering. 509 // Handles delayed showing of the overflow menu when hovering.
506 ScopedRunnableMethodFactory<BrowserActionsContainer> show_menu_task_factory_; 510 ScopedRunnableMethodFactory<BrowserActionsContainer> show_menu_task_factory_;
507 511
508 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); 512 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer);
509 }; 513 };
510 514
511 #endif // CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_ 515 #endif // CHROME_BROWSER_UI_VIEWS_BROWSER_ACTIONS_CONTAINER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmark_bar_view.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