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/extensions/extension_action.h" | 5 #include "chrome/browser/extensions/extension_action.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 if (dict.GetBinary(kIconSizes[i].size_string, &image_data)) { | 150 if (dict.GetBinary(kIconSizes[i].size_string, &image_data)) { |
151 pickle = IPC::Message(image_data->GetBuffer(), image_data->GetSize()); | 151 pickle = IPC::Message(image_data->GetBuffer(), image_data->GetSize()); |
152 } else if (dict.GetString(kIconSizes[i].size_string, &binary_string64)) { | 152 } else if (dict.GetString(kIconSizes[i].size_string, &binary_string64)) { |
153 std::string binary_string; | 153 std::string binary_string; |
154 if (!base::Base64Decode(binary_string64, &binary_string)) | 154 if (!base::Base64Decode(binary_string64, &binary_string)) |
155 return false; | 155 return false; |
156 pickle = IPC::Message(binary_string.c_str(), binary_string.length()); | 156 pickle = IPC::Message(binary_string.c_str(), binary_string.length()); |
157 } else { | 157 } else { |
158 continue; | 158 continue; |
159 } | 159 } |
160 PickleIterator iter(pickle); | 160 base::PickleIterator iter(pickle); |
161 SkBitmap bitmap; | 161 SkBitmap bitmap; |
162 if (!IPC::ReadParam(&pickle, &iter, &bitmap)) | 162 if (!IPC::ReadParam(&pickle, &iter, &bitmap)) |
163 return false; | 163 return false; |
164 CHECK(!bitmap.isNull()); | 164 CHECK(!bitmap.isNull()); |
165 float scale = ui::GetScaleForScaleFactor(kIconSizes[i].scale); | 165 float scale = ui::GetScaleForScaleFactor(kIconSizes[i].scale); |
166 icon->AddRepresentation(gfx::ImageSkiaRep(bitmap, scale)); | 166 icon->AddRepresentation(gfx::ImageSkiaRep(bitmap, scale)); |
167 } | 167 } |
168 return true; | 168 return true; |
169 } | 169 } |
170 | 170 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 // If there is a default icon, the icon width will be set depending on our | 382 // If there is a default icon, the icon width will be set depending on our |
383 // action type. | 383 // action type. |
384 if (default_icon_) | 384 if (default_icon_) |
385 return GetIconSizeForType(action_type()); | 385 return GetIconSizeForType(action_type()); |
386 | 386 |
387 // If no icon has been set and there is no default icon, we need favicon | 387 // If no icon has been set and there is no default icon, we need favicon |
388 // width. | 388 // width. |
389 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 389 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
390 IDR_EXTENSIONS_FAVICON).Width(); | 390 IDR_EXTENSIONS_FAVICON).Width(); |
391 } | 391 } |
OLD | NEW |