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

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

Issue 276074: Fix chrome_url_overides to work with packed extensions. (Closed)
Patch Set: review 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/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 664b44a108fecf496b672a5db896b92013cd3312..978c8fab6950576baf2a78cf19a64283ce332311 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1017,13 +1017,15 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_id,
*error = errors::kInvalidChromeURLOverrides;
return false;
}
+
// Validate that the overrides are all strings
DictionaryValue::key_iterator iter = overrides->begin_keys();
while (iter != overrides->end_keys()) {
+ std::string page = WideToUTF8(*iter);
// For now, only allow the new tab page. Others will work when we remove
// this check, but let's keep it simple for now.
// TODO(erikkay) enable other pages as well
- if (WideToUTF8(*iter) != chrome::kChromeUINewTabHost) {
+ if (page != chrome::kChromeUINewTabHost) {
*error = errors::kInvalidChromeURLOverrides;
return false;
}
@@ -1033,14 +1035,18 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_id,
return false;
}
// Replace the entry with a fully qualified chrome-extension:// URL.
- GURL url = GetResourceURL(val);
- overrides->SetString(*iter, url.spec());
+ chrome_url_overrides_[page] = GetResourceURL(val);
++iter;
}
- chrome_url_overrides_.reset(
- static_cast<DictionaryValue*>(overrides->DeepCopy()));
}
+ // Although |source| is passed in as a const, it's still possible to modify
+ // it. This is dangerous since the utility process re-uses |source| after
+ // it calls InitFromValue, passing it up to the browser process which calls
+ // InitFromValue again. As a result, we need to make sure that nobody
+ // accidentally modifies it.
+ DCHECK(source.Equals(manifest_value_.get()));
+
return true;
}
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/test/data/extensions/samples/override_igoogle/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698