| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 bool ExtensionAction::ParseIconFromCanvasDictionary( | 124 bool ExtensionAction::ParseIconFromCanvasDictionary( |
| 125 const base::DictionaryValue& dict, | 125 const base::DictionaryValue& dict, |
| 126 gfx::ImageSkia* icon) { | 126 gfx::ImageSkia* icon) { |
| 127 for (base::DictionaryValue::Iterator iter(dict); !iter.IsAtEnd(); | 127 for (base::DictionaryValue::Iterator iter(dict); !iter.IsAtEnd(); |
| 128 iter.Advance()) { | 128 iter.Advance()) { |
| 129 const base::Value* image_data; | 129 const base::Value* image_data; |
| 130 std::string binary_string64; | 130 std::string binary_string64; |
| 131 IPC::Message pickle; | 131 IPC::Message pickle; |
| 132 if (iter.value().GetAsBinary(&image_data)) { | 132 if (iter.value().GetAsBinary(&image_data)) { |
| 133 pickle = IPC::Message(image_data->GetBuffer(), image_data->GetSize()); | 133 pickle = IPC::Message(image_data->GetBlob().data(), |
| 134 image_data->GetBlob().size()); |
| 134 } else if (iter.value().GetAsString(&binary_string64)) { | 135 } else if (iter.value().GetAsString(&binary_string64)) { |
| 135 std::string binary_string; | 136 std::string binary_string; |
| 136 if (!base::Base64Decode(binary_string64, &binary_string)) | 137 if (!base::Base64Decode(binary_string64, &binary_string)) |
| 137 return false; | 138 return false; |
| 138 pickle = IPC::Message(binary_string.c_str(), binary_string.length()); | 139 pickle = IPC::Message(binary_string.c_str(), binary_string.length()); |
| 139 } else { | 140 } else { |
| 140 continue; | 141 continue; |
| 141 } | 142 } |
| 142 base::PickleIterator pickle_iter(pickle); | 143 base::PickleIterator pickle_iter(pickle); |
| 143 SkBitmap bitmap; | 144 SkBitmap bitmap; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 return icon.Width(); | 313 return icon.Width(); |
| 313 // If there is a default icon, the icon width will be set depending on our | 314 // If there is a default icon, the icon width will be set depending on our |
| 314 // action type. | 315 // action type. |
| 315 if (default_icon_) | 316 if (default_icon_) |
| 316 return ActionIconSize(); | 317 return ActionIconSize(); |
| 317 | 318 |
| 318 // If no icon has been set and there is no default icon, we need favicon | 319 // If no icon has been set and there is no default icon, we need favicon |
| 319 // width. | 320 // width. |
| 320 return FallbackIcon().Width(); | 321 return FallbackIcon().Width(); |
| 321 } | 322 } |
| OLD | NEW |