| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/extensions/image_loading_tracker.h" | 5 #include "chrome/browser/extensions/image_loading_tracker.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "chrome/common/chrome_notification_types.h" | 9 #include "chrome/common/chrome_notification_types.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| 11 #include "chrome/common/extensions/extension_resource.h" | 11 #include "chrome/common/extensions/extension_resource.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
| 14 #include "skia/ext/image_operations.h" | 14 #include "skia/ext/image_operations.h" |
| 15 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
| 16 #include "webkit/glue/image_decoder.h" | 16 #include "webkit/glue/image_decoder.h" |
| 17 | 17 |
| 18 using content::BrowserThread; |
| 19 |
| 18 ImageLoadingTracker::Observer::~Observer() {} | 20 ImageLoadingTracker::Observer::~Observer() {} |
| 19 | 21 |
| 20 //////////////////////////////////////////////////////////////////////////////// | 22 //////////////////////////////////////////////////////////////////////////////// |
| 21 // ImageLoadingTracker::ImageLoader | 23 // ImageLoadingTracker::ImageLoader |
| 22 | 24 |
| 23 // A RefCounted class for loading images on the File thread and reporting back | 25 // A RefCounted class for loading images on the File thread and reporting back |
| 24 // on the UI thread. | 26 // on the UI thread. |
| 25 class ImageLoadingTracker::ImageLoader | 27 class ImageLoadingTracker::ImageLoader |
| 26 : public base::RefCountedThreadSafe<ImageLoader> { | 28 : public base::RefCountedThreadSafe<ImageLoader> { |
| 27 public: | 29 public: |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // Remove all entries in the load_map_ referencing the extension. This ensures | 193 // Remove all entries in the load_map_ referencing the extension. This ensures |
| 192 // we don't attempt to cache the image when the load completes. | 194 // we don't attempt to cache the image when the load completes. |
| 193 for (LoadMap::iterator i = load_map_.begin(); i != load_map_.end();) { | 195 for (LoadMap::iterator i = load_map_.begin(); i != load_map_.end();) { |
| 194 if (i->second == extension) { | 196 if (i->second == extension) { |
| 195 load_map_.erase(i++); | 197 load_map_.erase(i++); |
| 196 } else { | 198 } else { |
| 197 ++i; | 199 ++i; |
| 198 } | 200 } |
| 199 } | 201 } |
| 200 } | 202 } |
| OLD | NEW |