Index: chrome/browser/extensions/extension_service.cc |
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc |
index 05dcec701adbd639f9d770008eeec2f2e3a65dc9..8c8cc6529d34e22c579f70dee4b0c42b2be55620 100644 |
--- a/chrome/browser/extensions/extension_service.cc |
+++ b/chrome/browser/extensions/extension_service.cc |
@@ -1257,21 +1257,12 @@ 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; |
- if (extension_prefs_->AllowFileAccess(info->extension_id)) |
- flags |= Extension::ALLOW_FILE_ACCESS; |
- if (extension_prefs_->IsFromWebStore(info->extension_id)) |
- flags |= Extension::FROM_WEBSTORE; |
- if (extension_prefs_->IsFromBookmark(info->extension_id)) |
- flags |= Extension::FROM_BOOKMARK; |
std::string error; |
scoped_refptr<const Extension> extension( |
extension_file_util::LoadExtension( |
info->extension_path, |
info->extension_location, |
- flags, |
+ GetExtensionCreateFlagsForInstalledExtension(info), |
&error)); |
if (extension.get()) { |
@@ -1428,22 +1419,11 @@ void ExtensionService::LoadInstalledExtension(const ExtensionInfo& info, |
if (!extension_prefs_->IsExtensionAllowedByPolicy(info.extension_id)) { |
error = errors::kDisabledByPolicy; |
} else if (info.extension_manifest.get()) { |
- 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; |
- if (extension_prefs_->AllowFileAccess(info.extension_id)) |
- flags |= Extension::ALLOW_FILE_ACCESS; |
- if (extension_prefs_->IsFromWebStore(info.extension_id)) |
- flags |= Extension::FROM_WEBSTORE; |
- if (extension_prefs_->IsFromBookmark(info.extension_id)) |
- flags |= Extension::FROM_BOOKMARK; |
extension = Extension::Create( |
info.extension_path, |
info.extension_location, |
*info.extension_manifest, |
- flags, |
+ GetExtensionCreateFlagsForInstalledExtension(&info), |
&error); |
} else { |
error = errors::kManifestUnreadable; |
@@ -1470,6 +1450,22 @@ void ExtensionService::LoadInstalledExtension(const ExtensionInfo& info, |
AddExtension(extension); |
} |
+int ExtensionService::GetExtensionCreateFlagsForInstalledExtension( |
Mihai Parparita -not on Chrome
2011/10/16 22:41:46
Seems like this could be a static/in an unnamed na
|
+ const ExtensionInfo* info) { |
+ int flags = Extension::NO_FLAGS; |
+ if (info->extension_location != Extension::LOAD) |
Mihai Parparita -not on Chrome
2011/10/16 22:41:46
Body is indented one too many times.
|
+ flags |= Extension::REQUIRE_KEY; |
+ if (Extension::ShouldDoStrictErrorChecking(info->extension_location)) |
+ flags |= Extension::STRICT_ERROR_CHECKS; |
+ if (extension_prefs_->AllowFileAccess(info->extension_id)) |
+ flags |= Extension::ALLOW_FILE_ACCESS; |
+ if (extension_prefs_->IsFromWebStore(info->extension_id)) |
+ flags |= Extension::FROM_WEBSTORE; |
+ if (extension_prefs_->IsFromBookmark(info->extension_id)) |
+ flags |= Extension::FROM_BOOKMARK; |
+ return flags; |
+} |
+ |
void ExtensionService::NotifyExtensionLoaded(const Extension* extension) { |
// The ChromeURLRequestContexts need to be first to know that the extension |
// was loaded, otherwise a race can arise where a renderer that is created |