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

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

Issue 10782030: Add content pack information to Extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 12 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 | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_manifest_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
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 4aa0331a35bfc05fb1155f14557781d8d12a793a..4cf81dee861d9b86cdcaabccdaca9caf160572d2 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1350,6 +1350,13 @@ bool Extension::is_theme() const {
return manifest()->is_theme();
}
+ExtensionResource Extension::GetContentPackSiteList() const {
+ if (content_pack_site_list_.empty())
+ return ExtensionResource();
+
+ return GetResource(content_pack_site_list_);
+}
+
GURL Extension::GetBackgroundURL() const {
if (background_scripts_.empty())
return background_url_;
@@ -1455,6 +1462,47 @@ FilePath Extension::MaybeNormalizePath(const FilePath& path) {
#endif
}
+bool Extension::LoadManagedModeFeatures(string16* error) {
+ if (!manifest_->HasKey(keys::kContentPack))
+ return true;
+ DictionaryValue* content_pack_value = NULL;
+ if (!manifest_->GetDictionary(keys::kContentPack, &content_pack_value)) {
+ *error = ASCIIToUTF16(errors::kInvalidContentPack);
+ return false;
+ }
+
+ if (!LoadManagedModeSites(content_pack_value, error))
+ return false;
+ if (!LoadManagedModeConfigurations(content_pack_value, error))
+ return false;
+
+ return true;
+}
+
+bool Extension::LoadManagedModeSites(
+ const DictionaryValue* content_pack_value,
+ string16* error) {
+ if (!content_pack_value->HasKey(keys::kContentPackSites))
+ return true;
+
+ FilePath::StringType site_list_str;
+ if (!content_pack_value->GetString(keys::kContentPackSites, &site_list_str)) {
+ *error = ASCIIToUTF16(errors::kInvalidContentPackSites);
+ return false;
+ }
+
+ content_pack_site_list_ = FilePath(site_list_str);
+
+ return true;
+}
+
+bool Extension::LoadManagedModeConfigurations(
+ const DictionaryValue* content_pack_value,
+ string16* error) {
+ NOTIMPLEMENTED();
+ return true;
+}
+
// static
bool Extension::IsTrustedId(const std::string& id) {
// See http://b/4946060 for more details.
@@ -1581,6 +1629,9 @@ bool Extension::InitFromValue(int flags, string16* error) {
if (!LoadThemeFeatures(error))
return false;
+ if (!LoadManagedModeFeatures(error))
+ return false;
+
if (HasMultipleUISurfaces()) {
*error = ASCIIToUTF16(errors::kOneUISurfaceOnly);
return false;
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_manifest_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698