Index: chrome/common/extensions/extension.cc |
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc |
index d68e91f2fb64c6015050cbb7631b48bf73722be5..dd194eb17e6ad877c9f8e6bedf7e1f61094db324 100644 |
--- a/chrome/common/extensions/extension.cc |
+++ b/chrome/common/extensions/extension.cc |
@@ -320,29 +320,34 @@ ContextualAction* Extension::LoadContextualActionHelper( |
result->set_extension_id(id()); |
result->set_type(action_type); |
- ListValue* icons; |
+ ListValue* icons = NULL; |
// Read the page action |icons|. |
if (!page_action->HasKey(keys::kPageActionIcons) || |
!page_action->GetList(keys::kPageActionIcons, &icons) || |
icons->GetSize() == 0) { |
- *error = ExtensionErrorUtils::FormatErrorMessage( |
- errors::kInvalidPageActionIconPaths, IntToString(definition_index)); |
- return NULL; |
- } |
- |
- int icon_count = 0; |
- for (ListValue::const_iterator iter = icons->begin(); |
- iter != icons->end(); ++iter) { |
- std::string path; |
- if (!(*iter)->GetAsString(&path) || path.empty()) { |
+ // Icons are only required for page actions. |
+ if (action_type == ContextualAction::PAGE_ACTION) { |
*error = ExtensionErrorUtils::FormatErrorMessage( |
- errors::kInvalidPageActionIconPath, |
- IntToString(definition_index), IntToString(icon_count)); |
+ errors::kInvalidPageActionIconPaths, IntToString(definition_index)); |
return NULL; |
} |
+ } |
- result->AddIconPath(path); |
- ++icon_count; |
+ int icon_count = 0; |
+ if (icons) { |
+ for (ListValue::const_iterator iter = icons->begin(); |
+ iter != icons->end(); ++iter) { |
+ std::string path; |
+ if (!(*iter)->GetAsString(&path) || path.empty()) { |
+ *error = ExtensionErrorUtils::FormatErrorMessage( |
+ errors::kInvalidPageActionIconPath, |
+ IntToString(definition_index), IntToString(icon_count)); |
+ return NULL; |
+ } |
+ |
+ result->AddIconPath(path); |
+ ++icon_count; |
+ } |
} |
if (action_type == ContextualAction::BROWSER_ACTION) { |