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

Side by Side Diff: chrome/browser/cocoa/location_bar_view_mac.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_COCOA_LOCATION_BAR_VIEW_MAC_H_ 5 #ifndef CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_
6 #define CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ 6 #define CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_
7 7
8 #include <string> 8 #include <string>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // When a new page action is created, all the icons are destroyed and 234 // When a new page action is created, all the icons are destroyed and
235 // recreated; at this point we need to calculate sizes to lay out the 235 // recreated; at this point we need to calculate sizes to lay out the
236 // icons even though no images are available yet. For this case, we return 236 // icons even though no images are available yet. For this case, we return
237 // the default image size for a page icon. 237 // the default image size for a page icon.
238 virtual NSSize GetPreferredImageSize(); 238 virtual NSSize GetPreferredImageSize();
239 239
240 // Either notify listeners or show a popup depending on the Page Action. 240 // Either notify listeners or show a popup depending on the Page Action.
241 virtual void OnMousePressed(NSRect bounds); 241 virtual void OnMousePressed(NSRect bounds);
242 242
243 // Overridden from ImageLoadingTracker. 243 // Overridden from ImageLoadingTracker.
244 virtual void OnImageLoaded(SkBitmap* image, size_t index); 244 virtual void OnImageLoaded(
245 SkBitmap* image, ExtensionResource resource, int index);
245 246
246 // Called to notify the Page Action that it should determine whether to be 247 // Called to notify the Page Action that it should determine whether to be
247 // visible or hidden. |contents| is the TabContents that is active, |url| 248 // visible or hidden. |contents| is the TabContents that is active, |url|
248 // is the current page URL. 249 // is the current page URL.
249 void UpdateVisibility(TabContents* contents, const GURL& url); 250 void UpdateVisibility(TabContents* contents, const GURL& url);
250 251
251 // Sets the tooltip for this Page Action image. 252 // Sets the tooltip for this Page Action image.
252 void SetToolTip(NSString* tooltip); 253 void SetToolTip(NSString* tooltip);
253 void SetToolTip(std::string tooltip); 254 void SetToolTip(std::string tooltip);
254 255
255 // Returns the tooltip for this Page Action image or |nil| if there is none. 256 // Returns the tooltip for this Page Action image or |nil| if there is none.
256 virtual const NSString* GetToolTip(); 257 virtual const NSString* GetToolTip();
257 258
258 // Overridden to return a menu. 259 // Overridden to return a menu.
259 virtual NSMenu* GetMenu(); 260 virtual NSMenu* GetMenu();
260 261
261 protected: 262 protected:
262 // For unit testing only. 263 // For unit testing only.
263 PageActionImageView() : owner_(NULL), 264 PageActionImageView() : owner_(NULL),
264 profile_(NULL), 265 profile_(NULL),
265 page_action_(NULL), 266 page_action_(NULL),
266 tracker_(NULL), 267 tracker_(this),
267 current_tab_id_(-1), 268 current_tab_id_(-1),
268 preview_enabled_(false) {} 269 preview_enabled_(false) {}
269 270
270 private: 271 private:
271 // Overridden from NotificationObserver: 272 // Overridden from NotificationObserver:
272 virtual void Observe(NotificationType type, 273 virtual void Observe(NotificationType type,
273 const NotificationSource& source, 274 const NotificationSource& source,
274 const NotificationDetails& details); 275 const NotificationDetails& details);
275 276
276 // The location bar view that owns us. 277 // The location bar view that owns us.
277 LocationBarViewMac* owner_; 278 LocationBarViewMac* owner_;
278 279
279 // The current profile (not owned by us). 280 // The current profile (not owned by us).
280 Profile* profile_; 281 Profile* profile_;
281 282
282 // The Page Action that this view represents. The Page Action is not owned 283 // The Page Action that this view represents. The Page Action is not owned
283 // by us, it resides in the extension of this particular profile. 284 // by us, it resides in the extension of this particular profile.
284 ExtensionAction* page_action_; 285 ExtensionAction* page_action_;
285 286
286 // A cache of images the Page Actions might need to show, mapped by path. 287 // A cache of images the Page Actions might need to show, mapped by path.
287 typedef std::map<std::string, SkBitmap> PageActionMap; 288 typedef std::map<std::string, SkBitmap> PageActionMap;
288 PageActionMap page_action_icons_; 289 PageActionMap page_action_icons_;
289 290
290 // The object that is waiting for the image loading to complete 291 // The object that is waiting for the image loading to complete
291 // asynchronously. 292 // asynchronously.
292 ImageLoadingTracker* tracker_; 293 ImageLoadingTracker tracker_;
293 294
294 // The tab id we are currently showing the icon for. 295 // The tab id we are currently showing the icon for.
295 int current_tab_id_; 296 int current_tab_id_;
296 297
297 // The URL we are currently showing the icon for. 298 // The URL we are currently showing the icon for.
298 GURL current_url_; 299 GURL current_url_;
299 300
300 // The string to show for a tooltip. 301 // The string to show for a tooltip.
301 scoped_nsobject<NSString> tooltip_; 302 scoped_nsobject<NSString> tooltip_;
302 303
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 // The transition type to use for the navigation. 429 // The transition type to use for the navigation.
429 PageTransition::Type transition_; 430 PageTransition::Type transition_;
430 431
431 // Used to register for notifications received by NotificationObserver. 432 // Used to register for notifications received by NotificationObserver.
432 NotificationRegistrar registrar_; 433 NotificationRegistrar registrar_;
433 434
434 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); 435 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac);
435 }; 436 };
436 437
437 #endif // CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ 438 #endif // CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/extensions/extension_action_context_menu.mm ('k') | chrome/browser/cocoa/location_bar_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698