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

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

Issue 1075006: Eliminate all UI thread decoding of extension images.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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_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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 const SkBitmap& default_icon() const { return default_icon_; } 62 const SkBitmap& default_icon() const { return default_icon_; }
63 63
64 // Overridden from views::View. Return a 0-inset so the icon can draw all the 64 // Overridden from views::View. Return a 0-inset so the icon can draw all the
65 // way to the edge of the view if it wants. 65 // way to the edge of the view if it wants.
66 virtual gfx::Insets GetInsets() const; 66 virtual gfx::Insets GetInsets() const;
67 67
68 // Overridden from views::ButtonListener: 68 // Overridden from views::ButtonListener:
69 virtual void ButtonPressed(views::Button* sender, const views::Event& event); 69 virtual void ButtonPressed(views::Button* sender, const views::Event& event);
70 70
71 // Overridden from ImageLoadingTracker. 71 // Overridden from ImageLoadingTracker.
72 virtual void OnImageLoaded(SkBitmap* image, size_t index); 72 virtual void OnImageLoaded(SkBitmap* image, int index);
73 73
74 // Overridden from NotificationObserver: 74 // Overridden from NotificationObserver:
75 virtual void Observe(NotificationType type, 75 virtual void Observe(NotificationType type,
76 const NotificationSource& source, 76 const NotificationSource& source,
77 const NotificationDetails& details); 77 const NotificationDetails& details);
78 78
79 // MenuButton behavior overrides. These methods all default to TextButton 79 // MenuButton behavior overrides. These methods all default to TextButton
80 // behavior unless this button is a popup. In that case, it uses MenuButton 80 // behavior unless this button is a popup. In that case, it uses MenuButton
81 // behavior. MenuButton has the notion of a child popup being shown where the 81 // behavior. MenuButton has the notion of a child popup being shown where the
82 // button will stay in the pushed state until the "menu" (a popup in this 82 // button will stay in the pushed state until the "menu" (a popup in this
(...skipping 15 matching lines...) Expand all
98 98
99 private: 99 private:
100 // The browser action this view represents. The ExtensionAction is not owned 100 // The browser action this view represents. The ExtensionAction is not owned
101 // by this class. 101 // by this class.
102 ExtensionAction* browser_action_; 102 ExtensionAction* browser_action_;
103 103
104 // The extension associated with the browser action we're displaying. 104 // The extension associated with the browser action we're displaying.
105 Extension* extension_; 105 Extension* extension_;
106 106
107 // The object that is waiting for the image loading to complete 107 // The object that is waiting for the image loading to complete
108 // asynchronously. This object can potentially outlive the BrowserActionView, 108 // asynchronously.
109 // and takes care of deleting itself. 109 ImageLoadingTracker tracker_;
110 ImageLoadingTracker* tracker_;
111 110
112 // Whether we are currently showing/just finished showing a context menu. 111 // Whether we are currently showing/just finished showing a context menu.
113 bool showing_context_menu_; 112 bool showing_context_menu_;
114 113
115 // The default icon for our browser action. This might be non-empty if the 114 // The default icon for our browser action. This might be non-empty if the
116 // browser action had a value for default_icon in the manifest. 115 // browser action had a value for default_icon in the manifest.
117 SkBitmap default_icon_; 116 SkBitmap default_icon_;
118 117
119 // The browser action shelf. 118 // The browser action shelf.
120 BrowserActionsContainer* panel_; 119 BrowserActionsContainer* panel_;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 class BrowserActionsContainer 237 class BrowserActionsContainer
239 : public views::View, 238 : public views::View,
240 public views::ViewMenuDelegate, 239 public views::ViewMenuDelegate,
241 public views::DragController, 240 public views::DragController,
242 public views::ResizeGripper::ResizeGripperDelegate, 241 public views::ResizeGripper::ResizeGripperDelegate,
243 public AnimationDelegate, 242 public AnimationDelegate,
244 public ExtensionToolbarModel::Observer, 243 public ExtensionToolbarModel::Observer,
245 public BrowserActionOverflowMenuController::Observer, 244 public BrowserActionOverflowMenuController::Observer,
246 public ExtensionContextMenuModel::PopupDelegate, 245 public ExtensionContextMenuModel::PopupDelegate,
247 public ExtensionPopup::Observer { 246 public ExtensionPopup::Observer {
248
249 friend class ShowFolderMenuTask;
250 public: 247 public:
251 BrowserActionsContainer(Browser* browser, views::View* owner_view); 248 BrowserActionsContainer(Browser* browser, views::View* owner_view);
252 virtual ~BrowserActionsContainer(); 249 virtual ~BrowserActionsContainer();
253 250
254 static void RegisterUserPrefs(PrefService* prefs); 251 static void RegisterUserPrefs(PrefService* prefs);
255 252
256 // Get the number of browser actions being displayed. 253 // Get the number of browser actions being displayed.
257 int num_browser_actions() const { return browser_action_views_.size(); } 254 int num_browser_actions() const { return browser_action_views_.size(); }
258 255
259 // Whether we are performing resize animation on the container. 256 // Whether we are performing resize animation on the container.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // Set how many icons the container should show. This should only be used by 358 // Set how many icons the container should show. This should only be used by
362 // unit tests. 359 // unit tests.
363 void TestSetIconVisibilityCount(size_t icons); 360 void TestSetIconVisibilityCount(size_t icons);
364 361
365 // During testing we can disable animations by setting this flag to true, 362 // During testing we can disable animations by setting this flag to true,
366 // so that the bar resizes instantly, instead of having to poll it while it 363 // so that the bar resizes instantly, instead of having to poll it while it
367 // animates to open/closed status. 364 // animates to open/closed status.
368 static bool disable_animations_during_testing_; 365 static bool disable_animations_during_testing_;
369 366
370 private: 367 private:
368 friend class ShowFolderMenuTask;
369
371 typedef std::vector<BrowserActionView*> BrowserActionViews; 370 typedef std::vector<BrowserActionView*> BrowserActionViews;
372 371
373 // ExtensionToolbarModel::Observer implementation. 372 // ExtensionToolbarModel::Observer implementation.
374 virtual void BrowserActionAdded(Extension* extension, int index); 373 virtual void BrowserActionAdded(Extension* extension, int index);
375 virtual void BrowserActionRemoved(Extension* extension); 374 virtual void BrowserActionRemoved(Extension* extension);
376 virtual void BrowserActionMoved(Extension* extension, int index); 375 virtual void BrowserActionMoved(Extension* extension, int index);
377 376
378 // Closes the overflow menu if open. 377 // Closes the overflow menu if open.
379 void CloseOverflowMenu(); 378 void CloseOverflowMenu();
380 379
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 477
479 ScopedRunnableMethodFactory<BrowserActionsContainer> task_factory_; 478 ScopedRunnableMethodFactory<BrowserActionsContainer> task_factory_;
480 479
481 // Handles delayed showing of the overflow menu when hovering. 480 // Handles delayed showing of the overflow menu when hovering.
482 ScopedRunnableMethodFactory<BrowserActionsContainer> show_menu_task_factory_; 481 ScopedRunnableMethodFactory<BrowserActionsContainer> show_menu_task_factory_;
483 482
484 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); 483 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer);
485 }; 484 };
486 485
487 #endif // CHROME_BROWSER_VIEWS_BROWSER_ACTIONS_CONTAINER_H_ 486 #endif // CHROME_BROWSER_VIEWS_BROWSER_ACTIONS_CONTAINER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698