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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/common/extensions/api/commands/commands_handler.h" | 9 #include "chrome/common/extensions/api/commands/commands_handler.h" |
10 #include "chrome/common/extensions/extension_constants.h" | 10 #include "chrome/common/extensions/extension_constants.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 ActionInfo::ActionInfo() { | 49 ActionInfo::ActionInfo() { |
50 } | 50 } |
51 | 51 |
52 ActionInfo::~ActionInfo() { | 52 ActionInfo::~ActionInfo() { |
53 } | 53 } |
54 | 54 |
55 // static | 55 // static |
56 scoped_ptr<ActionInfo> ActionInfo::Load(const Extension* extension, | 56 scoped_ptr<ActionInfo> ActionInfo::Load(const Extension* extension, |
57 const base::DictionaryValue* dict, | 57 const base::DictionaryValue* dict, |
58 string16* error) { | 58 base::string16* error) { |
59 scoped_ptr<ActionInfo> result(new ActionInfo()); | 59 scoped_ptr<ActionInfo> result(new ActionInfo()); |
60 | 60 |
61 if (extension->manifest_version() == 1) { | 61 if (extension->manifest_version() == 1) { |
62 // kPageActionIcons is obsolete, and used by very few extensions. Continue | 62 // kPageActionIcons is obsolete, and used by very few extensions. Continue |
63 // loading it, but only take the first icon as the default_icon path. | 63 // loading it, but only take the first icon as the default_icon path. |
64 const base::ListValue* icons = NULL; | 64 const base::ListValue* icons = NULL; |
65 if (dict->HasKey(keys::kPageActionIcons) && | 65 if (dict->HasKey(keys::kPageActionIcons) && |
66 dict->GetList(keys::kPageActionIcons, &icons)) { | 66 dict->GetList(keys::kPageActionIcons, &icons)) { |
67 base::ListValue::const_iterator iter = icons->begin(); | 67 base::ListValue::const_iterator iter = icons->begin(); |
68 std::string path; | 68 std::string path; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 // static | 226 // static |
227 bool ActionInfo::IsVerboseInstallMessage(const Extension* extension) { | 227 bool ActionInfo::IsVerboseInstallMessage(const Extension* extension) { |
228 const ActionInfo* page_action_info = GetPageActionInfo(extension); | 228 const ActionInfo* page_action_info = GetPageActionInfo(extension); |
229 return page_action_info && | 229 return page_action_info && |
230 (CommandsInfo::GetPageActionCommand(extension) || | 230 (CommandsInfo::GetPageActionCommand(extension) || |
231 !page_action_info->default_icon.empty()); | 231 !page_action_info->default_icon.empty()); |
232 } | 232 } |
233 | 233 |
234 } // namespace extensions | 234 } // namespace extensions |
OLD | NEW |