summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/extension.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-01 01:20:59 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-01 01:20:59 +0000
commit4fdbc1492aa5003c6fdc0df7f95b3ae9046380e2 (patch)
treee806806102de20b0fab1c1d497d1332839b6a77f /chrome/common/extensions/extension.cc
parent17d40f00b7d7a078649fb142961f612c29553ec0 (diff)
downloadchromium_src-4fdbc1492aa5003c6fdc0df7f95b3ae9046380e2.zip
chromium_src-4fdbc1492aa5003c6fdc0df7f95b3ae9046380e2.tar.gz
chromium_src-4fdbc1492aa5003c6fdc0df7f95b3ae9046380e2.tar.bz2
Add the concept of browse extent.
BUG=46636 Review URL: http://codereview.chromium.org/2862034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51327 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/extension.cc')
-rw-r--r--chrome/common/extensions/extension.cc32
1 files changed, 20 insertions, 12 deletions
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index a1b5255..a164ea4 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -532,14 +532,18 @@ bool Extension::LoadIsApp(const DictionaryValue* manifest,
return true;
}
-bool Extension::LoadWebURLs(const DictionaryValue* manifest,
- std::string* error) {
+bool Extension::LoadExtent(const DictionaryValue* manifest,
+ const wchar_t* key,
+ ExtensionExtent* extent,
+ const char* list_error,
+ const char* value_error,
+ std::string* error) {
Value* temp = NULL;
- if (!manifest->Get(keys::kWebURLs, &temp))
+ if (!manifest->Get(key, &temp))
return true;
if (temp->GetType() != Value::TYPE_LIST) {
- *error = errors::kInvalidWebURLs;
+ *error = list_error;
return false;
}
@@ -547,28 +551,28 @@ bool Extension::LoadWebURLs(const DictionaryValue* manifest,
for (size_t i = 0; i < pattern_list->GetSize(); ++i) {
std::string pattern_string;
if (!pattern_list->GetString(i, &pattern_string)) {
- *error = ExtensionErrorUtils::FormatErrorMessage(
- errors::kInvalidWebURL, UintToString(i));
+ *error = ExtensionErrorUtils::FormatErrorMessage(value_error,
+ UintToString(i));
return false;
}
URLPattern pattern(kValidWebExtentSchemes);
if (!pattern.Parse(pattern_string)) {
- *error = ExtensionErrorUtils::FormatErrorMessage(
- errors::kInvalidWebURL, UintToString(i));
+ *error = ExtensionErrorUtils::FormatErrorMessage(value_error,
+ UintToString(i));
return false;
}
// We do not allow authors to put wildcards in their paths. Instead, we
// imply one at the end.
if (pattern.path().find('*') != std::string::npos) {
- *error = ExtensionErrorUtils::FormatErrorMessage(
- errors::kInvalidWebURL, UintToString(i));
+ *error = ExtensionErrorUtils::FormatErrorMessage(value_error,
+ UintToString(i));
return false;
}
pattern.set_path(pattern.path() + '*');
- web_extent_.AddPattern(pattern);
+ extent->AddPattern(pattern);
}
return true;
@@ -1466,7 +1470,11 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key,
}
if (!LoadIsApp(manifest_value_.get(), error) ||
- !LoadWebURLs(manifest_value_.get(), error) ||
+ !LoadExtent(manifest_value_.get(), keys::kWebURLs, &web_extent_,
+ errors::kInvalidWebURLs, errors::kInvalidWebURL, error) ||
+ !LoadExtent(manifest_value_.get(), keys::kBrowseURLs, &browse_extent_,
+ errors::kInvalidBrowseURLs, errors::kInvalidBrowseURL,
+ error) ||
!LoadLaunchURL(manifest_value_.get(), error) ||
!LoadLaunchContainer(manifest_value_.get(), error) ||
!LoadLaunchFullscreen(manifest_value_.get(), error)) {