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 #ifndef CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // image was not found or it failed to decode. |resource| is the | 52 // image was not found or it failed to decode. |resource| is the |
53 // ExtensionResource where the |image| came from and the |index| represents | 53 // ExtensionResource where the |image| came from and the |index| represents |
54 // the index of the image just loaded (starts at 0 and increments every | 54 // the index of the image just loaded (starts at 0 and increments every |
55 // time LoadImage is called). | 55 // time LoadImage is called). |
56 virtual void OnImageLoaded(SkBitmap* image, | 56 virtual void OnImageLoaded(SkBitmap* image, |
57 const ExtensionResource& resource, | 57 const ExtensionResource& resource, |
58 int index) = 0; | 58 int index) = 0; |
59 }; | 59 }; |
60 | 60 |
61 explicit ImageLoadingTracker(Observer* observer); | 61 explicit ImageLoadingTracker(Observer* observer); |
62 ~ImageLoadingTracker(); | 62 virtual ~ImageLoadingTracker(); |
63 | 63 |
64 // Specify image resource to load. If the loaded image is larger than | 64 // Specify image resource to load. If the loaded image is larger than |
65 // |max_size| it will be resized to those dimensions. IMPORTANT NOTE: this | 65 // |max_size| it will be resized to those dimensions. IMPORTANT NOTE: this |
66 // function may call back your observer synchronously (ie before it returns) | 66 // function may call back your observer synchronously (ie before it returns) |
67 // if the image was found in the cache. | 67 // if the image was found in the cache. |
68 void LoadImage(const Extension* extension, | 68 void LoadImage(const Extension* extension, |
69 const ExtensionResource& resource, | 69 const ExtensionResource& resource, |
70 const gfx::Size& max_size, | 70 const gfx::Size& max_size, |
71 CacheParam cache); | 71 CacheParam cache); |
72 | 72 |
(...skipping 30 matching lines...) Expand all Loading... |
103 // integer identifies the id assigned to the request. If the extension is | 103 // integer identifies the id assigned to the request. If the extension is |
104 // deleted while fetching the image the entry is removed from the map. | 104 // deleted while fetching the image the entry is removed from the map. |
105 LoadMap load_map_; | 105 LoadMap load_map_; |
106 | 106 |
107 NotificationRegistrar registrar_; | 107 NotificationRegistrar registrar_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(ImageLoadingTracker); | 109 DISALLOW_COPY_AND_ASSIGN(ImageLoadingTracker); |
110 }; | 110 }; |
111 | 111 |
112 #endif // CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ | 112 #endif // CHROME_BROWSER_EXTENSIONS_IMAGE_LOADING_TRACKER_H_ |
OLD | NEW |