OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/extensions/extension_icon_source.h" | 5 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 scoped_refptr<const Extension> extension; | 71 scoped_refptr<const Extension> extension; |
72 bool grayscale; | 72 bool grayscale; |
73 int size; | 73 int size; |
74 ExtensionIconSet::MatchType match; | 74 ExtensionIconSet::MatchType match; |
75 }; | 75 }; |
76 | 76 |
77 // static | 77 // static |
78 GURL ExtensionIconSource::GetIconURL(const Extension* extension, | 78 GURL ExtensionIconSource::GetIconURL(const Extension* extension, |
79 int icon_size, | 79 int icon_size, |
80 ExtensionIconSet::MatchType match, | 80 ExtensionIconSet::MatchType match, |
81 bool grayscale, | 81 bool grayscale) { |
82 bool* exists) { | |
83 if (exists) { | |
84 *exists = | |
85 IconsInfo::GetIconURL(extension, icon_size, match) != GURL::EmptyGURL(); | |
86 } | |
87 | |
88 GURL icon_url(base::StringPrintf("%s%s/%d/%d%s", | 82 GURL icon_url(base::StringPrintf("%s%s/%d/%d%s", |
89 chrome::kChromeUIExtensionIconURL, | 83 chrome::kChromeUIExtensionIconURL, |
90 extension->id().c_str(), | 84 extension->id().c_str(), |
91 icon_size, | 85 icon_size, |
92 match, | 86 match, |
93 grayscale ? "?grayscale=true" : "")); | 87 grayscale ? "?grayscale=true" : "")); |
94 CHECK(icon_url.is_valid()); | 88 CHECK(icon_url.is_valid()); |
95 return icon_url; | 89 return icon_url; |
96 } | 90 } |
97 | 91 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 ExtensionIconSource::ExtensionIconRequest* ExtensionIconSource::GetData( | 329 ExtensionIconSource::ExtensionIconRequest* ExtensionIconSource::GetData( |
336 int request_id) { | 330 int request_id) { |
337 return request_map_[request_id].get(); | 331 return request_map_[request_id].get(); |
338 } | 332 } |
339 | 333 |
340 void ExtensionIconSource::ClearData(int request_id) { | 334 void ExtensionIconSource::ClearData(int request_id) { |
341 request_map_.erase(request_id); | 335 request_map_.erase(request_id); |
342 } | 336 } |
343 | 337 |
344 } // namespace extensions | 338 } // namespace extensions |
OLD | NEW |