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

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

Powered by Google App Engine
This is Rietveld 408576698