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 <string> | 9 #include <string> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // 3) The default extension / application icon if there are still no matches. | 50 // 3) The default extension / application icon if there are still no matches. |
51 // | 51 // |
52 class ExtensionIconSource : public ChromeURLDataManager::DataSource, | 52 class ExtensionIconSource : public ChromeURLDataManager::DataSource, |
53 public ImageLoadingTracker::Observer { | 53 public ImageLoadingTracker::Observer { |
54 public: | 54 public: |
55 explicit ExtensionIconSource(Profile* profile); | 55 explicit ExtensionIconSource(Profile* profile); |
56 virtual ~ExtensionIconSource(); | 56 virtual ~ExtensionIconSource(); |
57 | 57 |
58 // Gets the URL of the |extension| icon in the given |size|, falling back | 58 // Gets the URL of the |extension| icon in the given |size|, falling back |
59 // based on the |match| type. If |grayscale|, the URL will be for the | 59 // based on the |match| type. If |grayscale|, the URL will be for the |
60 // desaturated version of the icon. | 60 // desaturated version of the icon. |exists|, if non-NULL, will be set to true |
| 61 // if the icon exists; false if it will lead to a default or not-present |
| 62 // image. |
61 static GURL GetIconURL(const Extension* extension, | 63 static GURL GetIconURL(const Extension* extension, |
62 Extension::Icons icon_size, | 64 Extension::Icons icon_size, |
63 ExtensionIconSet::MatchType match, | 65 ExtensionIconSet::MatchType match, |
64 bool grayscale); | 66 bool grayscale, |
| 67 bool* exists); |
65 | 68 |
66 // A public utility function for accessing the bitmap of the image specified | 69 // A public utility function for accessing the bitmap of the image specified |
67 // by |resource_id|. | 70 // by |resource_id|. |
68 static SkBitmap* LoadImageByResourceId(int resource_id); | 71 static SkBitmap* LoadImageByResourceId(int resource_id); |
69 | 72 |
70 // ChromeURLDataManager::DataSource | 73 // ChromeURLDataManager::DataSource |
71 | 74 |
72 virtual std::string GetMimeType(const std::string&) const; | 75 virtual std::string GetMimeType(const std::string&) const; |
73 | 76 |
74 virtual void StartDataRequest(const std::string& path, | 77 virtual void StartDataRequest(const std::string& path, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 scoped_ptr<SkBitmap> default_app_data_; | 158 scoped_ptr<SkBitmap> default_app_data_; |
156 | 159 |
157 scoped_ptr<SkBitmap> default_extension_data_; | 160 scoped_ptr<SkBitmap> default_extension_data_; |
158 | 161 |
159 CancelableRequestConsumerT<int, 0> cancelable_consumer_; | 162 CancelableRequestConsumerT<int, 0> cancelable_consumer_; |
160 | 163 |
161 DISALLOW_COPY_AND_ASSIGN(ExtensionIconSource); | 164 DISALLOW_COPY_AND_ASSIGN(ExtensionIconSource); |
162 }; | 165 }; |
163 | 166 |
164 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSION_ICON_SOURCE_H_ | 167 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSION_ICON_SOURCE_H_ |
OLD | NEW |