Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1323)

Unified Diff: chrome/browser/extensions/extension_file_util.cc

Issue 332021: Move page actions over to ExtensionAction2 (Closed)
Patch Set: Review feedback Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_file_util.cc
diff --git a/chrome/browser/extensions/extension_file_util.cc b/chrome/browser/extensions/extension_file_util.cc
index 60d49818b54fd743b3e2abe7ef652e0dc242e4a1..a71f2a21f6006372747df82335b0c577e75e3565 100644
--- a/chrome/browser/extensions/extension_file_util.cc
+++ b/chrome/browser/extensions/extension_file_util.cc
@@ -228,10 +228,12 @@ bool ValidateExtension(Extension* extension, std::string* error) {
}
// Validate icon location for page actions.
- const ExtensionAction* page_action = extension->page_action();
+ ExtensionAction2* page_action = extension->page_action();
if (page_action) {
- const std::vector<std::string>& icon_paths = page_action->icon_paths();
- for (std::vector<std::string>::const_iterator iter = icon_paths.begin();
+ std::vector<std::string> icon_paths(*page_action->icon_paths());
+ if (!page_action->default_icon_path().empty())
+ icon_paths.push_back(page_action->default_icon_path());
+ for (std::vector<std::string>::iterator iter = icon_paths.begin();
iter != icon_paths.end(); ++iter) {
if (extension->GetResource(*iter).GetFilePath().empty()) {
*error = StringPrintf("Could not load icon '%s' for page action.",
@@ -242,14 +244,14 @@ bool ValidateExtension(Extension* extension, std::string* error) {
}
// Validate icon location for browser actions.
+ // Note: browser actions don't use the icon_paths().
ExtensionAction2* browser_action = extension->browser_action();
if (browser_action) {
- std::vector<std::string>* icon_paths = browser_action->icon_paths();
- for (std::vector<std::string>::iterator iter = icon_paths->begin();
- iter != icon_paths->end(); ++iter) {
- if (extension->GetResource(*iter).GetFilePath().empty()) {
+ std::string default_icon_path = browser_action->default_icon_path();
+ if (!default_icon_path.empty()) {
+ if (extension->GetResource(default_icon_path).GetFilePath().empty()) {
*error = StringPrintf("Could not load icon '%s' for browser action.",
- iter->c_str());
+ default_icon_path.c_str());
return false;
}
}
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_page_actions_module.h » ('j') | chrome/browser/gtk/location_bar_view_gtk.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698