| 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_UI_WEBUI_EXTENSIONS_EXTENSION_ICON_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_ICON_SOURCE_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_ICON_SOURCE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_ICON_SOURCE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 // Returns the bitmap for the default app image. | 84 // Returns the bitmap for the default app image. |
| 85 const SkBitmap* GetDefaultAppImage(); | 85 const SkBitmap* GetDefaultAppImage(); |
| 86 | 86 |
| 87 // Returns the bitmap for the default extension. | 87 // Returns the bitmap for the default extension. |
| 88 const SkBitmap* GetDefaultExtensionImage(); | 88 const SkBitmap* GetDefaultExtensionImage(); |
| 89 | 89 |
| 90 // Performs any remaining transformations (like desaturating the |image|), | 90 // Performs any remaining transformations (like desaturating the |image|), |
| 91 // then returns the |image| to the client and clears up any temporary data | 91 // then returns the |image| to the client and clears up any temporary data |
| 92 // associated with the |request_id|. | 92 // associated with the |request_id|. |
| 93 void FinalizeImage(SkBitmap* image, int request_id); | 93 void FinalizeImage(const SkBitmap* image, int request_id); |
| 94 | 94 |
| 95 // Loads the default image for |request_id| and returns to the client. | 95 // Loads the default image for |request_id| and returns to the client. |
| 96 void LoadDefaultImage(int request_id); | 96 void LoadDefaultImage(int request_id); |
| 97 | 97 |
| 98 // Tries loading component extension image. These usually come from resources | 98 // Tries loading component extension image. These usually come from resources |
| 99 // instead of file system. Returns false if a given |icon| does not have | 99 // instead of file system. Returns false if a given |icon| does not have |
| 100 // a corresponding image in bundled resources. | 100 // a corresponding image in bundled resources. |
| 101 bool TryLoadingComponentExtensionImage(const ExtensionResource& icon, | 101 bool TryLoadingComponentExtensionImage(const ExtensionResource& icon, |
| 102 int request_id); | 102 int request_id); |
| 103 | 103 |
| 104 // Loads the extension's |icon| for the given |request_id| and returns the | 104 // Loads the extension's |icon| for the given |request_id| and returns the |
| 105 // image to the client. | 105 // image to the client. |
| 106 void LoadExtensionImage(const ExtensionResource& icon, int request_id); | 106 void LoadExtensionImage(const ExtensionResource& icon, int request_id); |
| 107 | 107 |
| 108 // Loads the favicon image for the app associated with the |request_id|. If | 108 // Loads the favicon image for the app associated with the |request_id|. If |
| 109 // the image does not exist, we fall back to the default image. | 109 // the image does not exist, we fall back to the default image. |
| 110 void LoadFaviconImage(int request_id); | 110 void LoadFaviconImage(int request_id); |
| 111 | 111 |
| 112 // FaviconService callback | 112 // FaviconService callback |
| 113 void OnFaviconDataAvailable(FaviconService::Handle request_handle, | 113 void OnFaviconDataAvailable(FaviconService::Handle request_handle, |
| 114 history::FaviconData favicon); | 114 history::FaviconData favicon); |
| 115 | 115 |
| 116 // ImageLoadingTracker::Observer | 116 // ImageLoadingTracker::Observer |
| 117 virtual void OnImageLoaded(SkBitmap* image, | 117 virtual void OnImageLoaded(const gfx::Image* image, |
| 118 const ExtensionResource& resource, | 118 const std::string& extension_id, |
| 119 int id) OVERRIDE; | 119 int id) OVERRIDE; |
| 120 | 120 |
| 121 // Called when the extension doesn't have an icon. We fall back to multiple | 121 // Called when the extension doesn't have an icon. We fall back to multiple |
| 122 // sources, using the following order: | 122 // sources, using the following order: |
| 123 // 1) The icons as listed in the extension / app manifests. | 123 // 1) The icons as listed in the extension / app manifests. |
| 124 // 2) If a 16px icon and the extension has a launch URL, see if Chrome | 124 // 2) If a 16px icon and the extension has a launch URL, see if Chrome |
| 125 // has a corresponding favicon. | 125 // has a corresponding favicon. |
| 126 // 3) If still no matches, load the default extension / application icon. | 126 // 3) If still no matches, load the default extension / application icon. |
| 127 void LoadIconFailed(int request_id); | 127 void LoadIconFailed(int request_id); |
| 128 | 128 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 scoped_ptr<SkBitmap> default_app_data_; | 164 scoped_ptr<SkBitmap> default_app_data_; |
| 165 | 165 |
| 166 scoped_ptr<SkBitmap> default_extension_data_; | 166 scoped_ptr<SkBitmap> default_extension_data_; |
| 167 | 167 |
| 168 CancelableRequestConsumerT<int, 0> cancelable_consumer_; | 168 CancelableRequestConsumerT<int, 0> cancelable_consumer_; |
| 169 | 169 |
| 170 DISALLOW_COPY_AND_ASSIGN(ExtensionIconSource); | 170 DISALLOW_COPY_AND_ASSIGN(ExtensionIconSource); |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_ICON_SOURCE_H_ | 173 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_ICON_SOURCE_H_ |
| OLD | NEW |