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

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

Issue 6772022: Make <all_urls> and file:///* in permissions trigger "Allow file access" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for landing Created 9 years, 9 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/browser/extensions/extension_prefs.h ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_prefs.cc
diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc
index 1e1a3d6213bad6203e724e734f88ea57556a9162..c727e37913865ac10370f4a61008e69af6f36f54 100644
--- a/chrome/browser/extensions/extension_prefs.cc
+++ b/chrome/browser/extensions/extension_prefs.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/extensions/extension_pref_store.h"
#include "chrome/browser/prefs/pref_notifier.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
+#include "chrome/common/url_constants.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/url_pattern.h"
#include "chrome/common/pref_names.h"
@@ -563,6 +564,7 @@ bool ExtensionPrefs::GetGrantedPermissions(
std::set<std::string> host_permissions;
ReadExtensionPrefStringSet(
extension_id, kPrefGrantedPermissionsHost, &host_permissions);
+ bool allow_file_access = AllowFileAccess(extension_id);
// The granted host permissions contain hosts from the manifest's
// "permissions" array and from the content script "matches" arrays,
@@ -579,6 +581,10 @@ bool ExtensionPrefs::GetGrantedPermissions(
*i, URLPattern::PARSE_LENIENT)) {
NOTREACHED(); // Corrupt prefs? Hand editing?
} else {
+ if (!allow_file_access && pattern.MatchesScheme(chrome::kFileScheme)) {
+ pattern.set_valid_schemes(
+ pattern.valid_schemes() & ~URLPattern::SCHEME_FILE);
+ }
host_extent->AddPattern(pattern);
}
}
@@ -634,6 +640,12 @@ void ExtensionPrefs::SetAllowFileAccess(const std::string& extension_id,
SavePrefsAndNotify();
}
+bool ExtensionPrefs::HasAllowFileAccessSetting(
+ const std::string& extension_id) const {
+ DictionaryValue* ext = GetExtensionPref(extension_id);
+ return ext && ext->HasKey(kPrefAllowFileAccess);
+}
+
ExtensionPrefs::LaunchType ExtensionPrefs::GetLaunchType(
const std::string& extension_id,
ExtensionPrefs::LaunchType default_pref_value) {
« no previous file with comments | « chrome/browser/extensions/extension_prefs.h ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698