summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_service.cc
diff options
context:
space:
mode:
authormihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-29 00:14:13 +0000
committermihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-29 00:14:13 +0000
commit83048a2179db7e3b8f290a4a0f3a7fdc5166dd4d (patch)
treea578820e10deb5a4cf26c9edf99cdfa8862a0172 /chrome/browser/extensions/extension_service.cc
parent7ac27facde2ad544c1a1e4b63d1410e48ffa5670 (diff)
downloadchromium_src-83048a2179db7e3b8f290a4a0f3a7fdc5166dd4d.zip
chromium_src-83048a2179db7e3b8f290a4a0f3a7fdc5166dd4d.tar.gz
chromium_src-83048a2179db7e3b8f290a4a0f3a7fdc5166dd4d.tar.bz2
Replace bools in extension creation with flags.
Turn require_key and strict_error_checks bool params of Extension:: InitFromValue, Extension::Create and extension_file_util::LoadExtension into a flags parameter. BUG=None TEST=compiles R=aa@chromium.org Review URL: http://codereview.chromium.org/6766002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79638 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_service.cc')
-rw-r--r--chrome/browser/extensions/extension_service.cc27
1 files changed, 18 insertions, 9 deletions
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index ed0d286..cb99385 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -199,12 +199,14 @@ void ExtensionServiceBackend::LoadSingleExtension(
FilePath extension_path = path_in;
file_util::AbsolutePath(&extension_path);
+ int flags = Extension::NO_FLAGS;
+ if (Extension::ShouldDoStrictErrorChecking(Extension::LOAD))
+ flags |= Extension::STRICT_ERROR_CHECKS;
std::string error;
scoped_refptr<const Extension> extension(extension_file_util::LoadExtension(
extension_path,
Extension::LOAD,
- false, // Don't require id
- Extension::ShouldDoStrictErrorChecking(Extension::LOAD),
+ flags,
&error));
if (!extension) {
@@ -744,13 +746,15 @@ void ExtensionService::LoadComponentExtension(
return;
}
+ int flags = Extension::REQUIRE_KEY;
+ if (Extension::ShouldDoStrictErrorChecking(Extension::COMPONENT))
+ flags |= Extension::STRICT_ERROR_CHECKS;
std::string error;
scoped_refptr<const Extension> extension(Extension::Create(
info.root_directory,
Extension::COMPONENT,
*static_cast<DictionaryValue*>(manifest.get()),
- true, // Require key
- Extension::ShouldDoStrictErrorChecking(Extension::COMPONENT),
+ flags,
&error));
if (!extension.get()) {
NOTREACHED() << error;
@@ -791,13 +795,15 @@ void ExtensionService::LoadAllExtensions() {
// thread.
base::ThreadRestrictions::ScopedAllowIO allow_io;
+ int flags = Extension::NO_FLAGS;
+ if (Extension::ShouldDoStrictErrorChecking(info->extension_location))
+ flags |= Extension::STRICT_ERROR_CHECKS;
std::string error;
scoped_refptr<const Extension> extension(
extension_file_util::LoadExtension(
info->extension_path,
info->extension_location,
- false, // Don't require key
- Extension::ShouldDoStrictErrorChecking(info->extension_location),
+ flags,
&error));
if (extension.get()) {
@@ -911,13 +917,16 @@ void ExtensionService::LoadInstalledExtension(const ExtensionInfo& info,
if (!extension_prefs_->IsExtensionAllowedByPolicy(info.extension_id)) {
error = errors::kDisabledByPolicy;
} else if (info.extension_manifest.get()) {
- bool require_key = info.extension_location != Extension::LOAD;
+ int flags = Extension::NO_FLAGS;
+ if (info.extension_location != Extension::LOAD)
+ flags |= Extension::REQUIRE_KEY;
+ if (Extension::ShouldDoStrictErrorChecking(info.extension_location))
+ flags |= Extension::STRICT_ERROR_CHECKS;
extension = Extension::Create(
info.extension_path,
info.extension_location,
*info.extension_manifest,
- require_key,
- Extension::ShouldDoStrictErrorChecking(info.extension_location),
+ flags,
&error);
} else {
error = errors::kManifestUnreadable;