Chromium Code Reviews| 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/common/extensions/api/extension_action/action_info.h" | 5 #include "chrome/common/extensions/api/extension_action/action_info.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/common/extensions/api/commands/commands_handler.h" | 10 #include "chrome/common/extensions/api/commands/commands_handler.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 if (dict->HasKey(keys::kPageActionIcons) && | 66 if (dict->HasKey(keys::kPageActionIcons) && |
| 67 dict->GetList(keys::kPageActionIcons, &icons)) { | 67 dict->GetList(keys::kPageActionIcons, &icons)) { |
| 68 base::ListValue::const_iterator iter = icons->begin(); | 68 base::ListValue::const_iterator iter = icons->begin(); |
| 69 std::string path; | 69 std::string path; |
| 70 if (iter == icons->end() || | 70 if (iter == icons->end() || |
| 71 !(*iter)->GetAsString(&path) || | 71 !(*iter)->GetAsString(&path) || |
| 72 !manifest_handler_helpers::NormalizeAndValidatePath(&path)) { | 72 !manifest_handler_helpers::NormalizeAndValidatePath(&path)) { |
| 73 *error = base::ASCIIToUTF16(errors::kInvalidPageActionIconPath); | 73 *error = base::ASCIIToUTF16(errors::kInvalidPageActionIconPath); |
| 74 return std::unique_ptr<ActionInfo>(); | 74 return std::unique_ptr<ActionInfo>(); |
| 75 } | 75 } |
| 76 result->default_icon.Add(extension_misc::EXTENSION_ICON_ACTION, path); | 76 // 19 is the old size for extension icons (the size that was in use at the |
| 77 // time of kPageActionIcons). | |
|
Peter Kasting
2016/10/26 03:28:47
Nit: Shorter: "Extension icons were 19 DIP when kP
Evan Stade
2016/11/02 00:41:13
Done.
| |
| 78 result->default_icon.Add(19, path); | |
| 77 } | 79 } |
| 78 | 80 |
| 79 std::string id; | 81 std::string id; |
| 80 if (dict->HasKey(keys::kPageActionId)) { | 82 if (dict->HasKey(keys::kPageActionId)) { |
| 81 if (!dict->GetString(keys::kPageActionId, &id)) { | 83 if (!dict->GetString(keys::kPageActionId, &id)) { |
| 82 *error = base::ASCIIToUTF16(errors::kInvalidPageActionId); | 84 *error = base::ASCIIToUTF16(errors::kInvalidPageActionId); |
| 83 return std::unique_ptr<ActionInfo>(); | 85 return std::unique_ptr<ActionInfo>(); |
| 84 } | 86 } |
| 85 result->id = id; | 87 result->id = id; |
| 86 } | 88 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 | 216 |
| 215 // static | 217 // static |
| 216 bool ActionInfo::IsVerboseInstallMessage(const Extension* extension) { | 218 bool ActionInfo::IsVerboseInstallMessage(const Extension* extension) { |
| 217 const ActionInfo* page_action_info = GetPageActionInfo(extension); | 219 const ActionInfo* page_action_info = GetPageActionInfo(extension); |
| 218 return page_action_info && | 220 return page_action_info && |
| 219 (CommandsInfo::GetPageActionCommand(extension) || | 221 (CommandsInfo::GetPageActionCommand(extension) || |
| 220 !page_action_info->default_icon.empty()); | 222 !page_action_info->default_icon.empty()); |
| 221 } | 223 } |
| 222 | 224 |
| 223 } // namespace extensions | 225 } // namespace extensions |
| OLD | NEW |