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

Unified Diff: chrome/browser/extensions/extension_service.cc

Issue 7595005: Revert 95815 - Make extension file URL access opt-in. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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/browser/extensions/extension_service.cc
===================================================================
--- chrome/browser/extensions/extension_service.cc (revision 95819)
+++ chrome/browser/extensions/extension_service.cc (working copy)
@@ -304,7 +304,12 @@
const FilePath& extension_path, bool prompt_for_plugins) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
std::string id = Extension::GenerateIdForPath(extension_path);
- bool allow_file_access = frontend_->extension_prefs()->AllowFileAccess(id);
+ // Unpacked extensions default to allowing file access, but if that has been
+ // overridden, don't reset the value.
+ bool allow_file_access =
+ Extension::ShouldAlwaysAllowFileAccess(Extension::LOAD);
+ if (frontend_->extension_prefs()->HasAllowFileAccessSetting(id))
+ allow_file_access = frontend_->extension_prefs()->AllowFileAccess(id);
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
NewRunnableMethod(
@@ -1029,9 +1034,13 @@
file_util::AbsolutePath(&extension_path);
std::string id = Extension::GenerateIdForPath(extension_path);
+ bool allow_file_access =
+ Extension::ShouldAlwaysAllowFileAccess(Extension::LOAD);
+ if (extension_prefs()->HasAllowFileAccessSetting(id))
+ allow_file_access = extension_prefs()->AllowFileAccess(id);
int flags = Extension::NO_FLAGS;
- if (extension_prefs()->AllowFileAccess(id))
+ if (allow_file_access)
flags |= Extension::ALLOW_FILE_ACCESS;
if (Extension::ShouldDoStrictErrorChecking(Extension::LOAD))
flags |= Extension::STRICT_ERROR_CHECKS;
@@ -2196,6 +2205,13 @@
initial_enable ? Extension::ENABLED : Extension::DISABLED,
from_webstore);
+ // Unpacked extensions default to allowing file access, but if that has been
+ // overridden, don't reset the value.
+ if (Extension::ShouldAlwaysAllowFileAccess(Extension::LOAD) &&
+ !extension_prefs_->HasAllowFileAccessSetting(id)) {
+ extension_prefs_->SetAllowFileAccess(id, true);
+ }
+
NotificationService::current()->Notify(
chrome::NOTIFICATION_EXTENSION_INSTALLED,
Source<Profile>(profile_),
« no previous file with comments | « chrome/browser/extensions/extension_prefs.cc ('k') | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698