| OLD | NEW |
| 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 #import "chrome/browser/cocoa/extensions/browser_action_button.h" | 5 #import "chrome/browser/cocoa/extensions/browser_action_button.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas_paint.h" | 7 #include "app/gfx/canvas_paint.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "chrome/browser/cocoa/extensions/extension_action_context_menu.h" | 9 #include "chrome/browser/cocoa/extensions/extension_action_context_menu.h" |
| 10 #include "chrome/browser/extensions/image_loading_tracker.h" | 10 #include "chrome/browser/extensions/image_loading_tracker.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 registrar_.Add(this, NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, | 48 registrar_.Add(this, NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, |
| 49 Source<ExtensionAction>(extension->browser_action())); | 49 Source<ExtensionAction>(extension->browser_action())); |
| 50 } | 50 } |
| 51 | 51 |
| 52 ~ExtensionImageTrackerBridge() { | 52 ~ExtensionImageTrackerBridge() { |
| 53 if (tracker_) | 53 if (tracker_) |
| 54 tracker_->StopTrackingImageLoad(); | 54 tracker_->StopTrackingImageLoad(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // ImageLoadingTracker::Observer implementation. | 57 // ImageLoadingTracker::Observer implementation. |
| 58 void OnImageLoaded(SkBitmap* image, size_t index) { | 58 void OnImageLoaded(ImageLoadingTracker* source, SkBitmap* image, |
| 59 size_t index) { |
| 59 if (image) | 60 if (image) |
| 60 [owner_ setDefaultIcon:gfx::SkBitmapToNSImage(*image)]; | 61 [owner_ setDefaultIcon:gfx::SkBitmapToNSImage(*image)]; |
| 61 tracker_ = NULL; | 62 tracker_ = NULL; |
| 62 [owner_ updateState]; | 63 [owner_ updateState]; |
| 63 } | 64 } |
| 64 | 65 |
| 65 // Overridden from NotificationObserver. | 66 // Overridden from NotificationObserver. |
| 66 void Observe(NotificationType type, | 67 void Observe(NotificationType type, |
| 67 const NotificationSource& source, | 68 const NotificationSource& source, |
| 68 const NotificationDetails& details) { | 69 const NotificationDetails& details) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 extensionAction_->PaintBadge(&canvas, boundingRect, tabId_); | 189 extensionAction_->PaintBadge(&canvas, boundingRect, tabId_); |
| 189 } | 190 } |
| 190 | 191 |
| 191 [NSGraphicsContext restoreGraphicsState]; | 192 [NSGraphicsContext restoreGraphicsState]; |
| 192 } | 193 } |
| 193 | 194 |
| 194 @synthesize tabId = tabId_; | 195 @synthesize tabId = tabId_; |
| 195 @synthesize extensionAction = extensionAction_; | 196 @synthesize extensionAction = extensionAction_; |
| 196 | 197 |
| 197 @end | 198 @end |
| OLD | NEW |