Chromium Code Reviews| Index: chrome/browser/cocoa/extensions/browser_action_button.mm |
| =================================================================== |
| --- chrome/browser/cocoa/extensions/browser_action_button.mm (revision 42362) |
| +++ chrome/browser/cocoa/extensions/browser_action_button.mm (working copy) |
| @@ -42,13 +42,12 @@ |
| public: |
| ExtensionImageTrackerBridge(BrowserActionButton* owner, Extension* extension) |
| : owner_(owner), |
| - tracker_(NULL) { |
| + tracker_(this) { |
|
Aaron Boodman
2010/03/23 19:10:55
Does this need an ALLOW_THIS_IN_INITIALIZER ?
Finnur
2010/03/23 21:19:48
Don't think we need ALLOW_THIS here (for the same
|
| // The Browser Action API does not allow the default icon path to be |
| // changed at runtime, so we can load this now and cache it. |
| std::string path = extension->browser_action()->default_icon_path(); |
| if (!path.empty()) { |
| - tracker_ = new ImageLoadingTracker(this, 1); |
| - tracker_->PostLoadImageTask(extension->GetResource(path), |
| + tracker_.PostLoadImageTask(extension->GetResource(path), |
| gfx::Size(Extension::kBrowserActionIconMaxSize, |
| Extension::kBrowserActionIconMaxSize)); |
| } |
| @@ -57,15 +56,12 @@ |
| } |
| ~ExtensionImageTrackerBridge() { |
| - if (tracker_) |
| - tracker_->StopTrackingImageLoad(); |
| } |
| // ImageLoadingTracker::Observer implementation. |
| - void OnImageLoaded(SkBitmap* image, size_t index) { |
| + void OnImageLoaded(SkBitmap* image, int index) { |
| if (image) |
| [owner_ setDefaultIcon:gfx::SkBitmapToNSImage(*image)]; |
| - tracker_ = NULL; |
| [owner_ updateState]; |
| } |
| @@ -83,8 +79,8 @@ |
| // Weak. Owns us. |
| BrowserActionButton* owner_; |
| - // Loads the button's icons for us on the file thread. Weak. |
| - ImageLoadingTracker* tracker_; |
| + // Loads the button's icons for us on the file thread. |
| + ImageLoadingTracker tracker_; |
| // Used for registering to receive notifications and automatic clean up. |
| NotificationRegistrar registrar_; |