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

Unified Diff: chrome/common/extensions/extension.cc

Issue 307048: Save a little work when fetching the default title by only checking the name... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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
« no previous file with comments | « no previous file | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension.cc
===================================================================
--- chrome/common/extensions/extension.cc (revision 29521)
+++ chrome/common/extensions/extension.cc (working copy)
@@ -340,12 +340,19 @@
result->AddIconPath(default_icon);
}
- // Read the page action |default_title|.
+ // Read the page action title from |default_title| if present, |name| if not
+ // (both optional).
std::string title;
- if (!page_action->GetString(keys::kName, &title) &&
- !page_action->GetString(keys::kPageActionDefaultTitle, &title)) {
- *error = errors::kInvalidPageActionDefaultTitle;
- return NULL;
+ if (page_action->HasKey(keys::kPageActionDefaultTitle)) {
+ if (!page_action->GetString(keys::kPageActionDefaultTitle, &title)) {
+ *error = errors::kInvalidPageActionDefaultTitle;
+ return NULL;
+ }
+ } else if (page_action->HasKey(keys::kName)) {
+ if (!page_action->GetString(keys::kName, &title)) {
+ *error = errors::kInvalidPageActionName;
+ return NULL;
+ }
}
result->set_title(title);
« no previous file with comments | « no previous file | chrome/common/extensions/extension_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698