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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 extension->id().c_str(), | 90 extension->id().c_str(), |
91 icon_size, | 91 icon_size, |
92 match, | 92 match, |
93 grayscale ? "?grayscale=true" : "")); | 93 grayscale ? "?grayscale=true" : "")); |
94 CHECK(icon_url.is_valid()); | 94 CHECK(icon_url.is_valid()); |
95 return icon_url; | 95 return icon_url; |
96 } | 96 } |
97 | 97 |
98 // static | 98 // static |
99 SkBitmap* ExtensionIconSource::LoadImageByResourceId(int resource_id) { | 99 SkBitmap* ExtensionIconSource::LoadImageByResourceId(int resource_id) { |
100 std::string contents = ResourceBundle::GetSharedInstance() | 100 base::StringPiece contents = |
101 .GetRawDataResourceForScale(resource_id, | 101 ResourceBundle::GetSharedInstance().GetRawDataResourceForScale( |
102 ui::SCALE_FACTOR_100P).as_string(); | 102 resource_id, ui::SCALE_FACTOR_100P); |
103 | 103 |
104 // Convert and return it. | 104 // Convert and return it. |
105 const unsigned char* data = | 105 const unsigned char* data = |
106 reinterpret_cast<const unsigned char*>(contents.data()); | 106 reinterpret_cast<const unsigned char*>(contents.data()); |
107 return ToBitmap(data, contents.length()); | 107 return ToBitmap(data, contents.length()); |
108 } | 108 } |
109 | 109 |
110 std::string ExtensionIconSource::GetSource() const { | 110 std::string ExtensionIconSource::GetSource() const { |
111 return chrome::kChromeUIExtensionIconHost; | 111 return chrome::kChromeUIExtensionIconHost; |
112 } | 112 } |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 std::map<int, ExtensionIconRequest*>::iterator i = | 343 std::map<int, ExtensionIconRequest*>::iterator i = |
344 request_map_.find(request_id); | 344 request_map_.find(request_id); |
345 if (i == request_map_.end()) | 345 if (i == request_map_.end()) |
346 return; | 346 return; |
347 | 347 |
348 delete i->second; | 348 delete i->second; |
349 request_map_.erase(i); | 349 request_map_.erase(i); |
350 } | 350 } |
351 | 351 |
352 } // namespace extensions | 352 } // namespace extensions |
OLD | NEW |