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_EXTENSION_ICON_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSION_ICON_SOURCE_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_EXTENSION_ICON_SOURCE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 ExtensionIconSet::MatchType match, | 61 ExtensionIconSet::MatchType match, |
62 bool grayscale, | 62 bool grayscale, |
63 bool* exists); | 63 bool* exists); |
64 | 64 |
65 // A public utility function for accessing the bitmap of the image specified | 65 // A public utility function for accessing the bitmap of the image specified |
66 // by |resource_id|. | 66 // by |resource_id|. |
67 static SkBitmap* LoadImageByResourceId(int resource_id); | 67 static SkBitmap* LoadImageByResourceId(int resource_id); |
68 | 68 |
69 // ChromeURLDataManager::DataSource | 69 // ChromeURLDataManager::DataSource |
70 | 70 |
71 virtual std::string GetMimeType(const std::string&) const; | 71 virtual std::string GetMimeType(const std::string&) const OVERRIDE; |
72 | 72 |
73 virtual void StartDataRequest(const std::string& path, | 73 virtual void StartDataRequest(const std::string& path, |
74 bool is_incognito, | 74 bool is_incognito, |
75 int request_id); | 75 int request_id) OVERRIDE; |
76 | 76 |
77 private: | 77 private: |
78 // Encapsulates the request parameters for |request_id|. | 78 // Encapsulates the request parameters for |request_id|. |
79 struct ExtensionIconRequest; | 79 struct ExtensionIconRequest; |
80 | 80 |
81 // Returns the bitmap for the webstore icon. | 81 // Returns the bitmap for the webstore icon. |
82 const SkBitmap* GetWebStoreImage(); | 82 const SkBitmap* GetWebStoreImage(); |
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(); |
(...skipping 23 matching lines...) Expand all Loading... |
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(SkBitmap* image, |
118 const ExtensionResource& resource, | 118 const ExtensionResource& resource, |
119 int id); | 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 |
129 // Parses and savse an ExtensionIconRequest for the URL |path| for the | 129 // Parses and savse an ExtensionIconRequest for the URL |path| for the |
(...skipping 34 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_EXTENSION_ICON_SOURCE_H_ | 173 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSION_ICON_SOURCE_H_ |
OLD | NEW |