summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_prefs.cc
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-24 17:49:08 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-24 17:49:08 +0000
commit05c82189519642144323493e1d0cd65c41ce81ce (patch)
treeabb760e7c2d610ab059eec1222fc3d15b6b30db5 /chrome/browser/extensions/extension_prefs.cc
parenteb40bc39aafb7933251450019e5b4bcb805982f5 (diff)
downloadchromium_src-05c82189519642144323493e1d0cd65c41ce81ce.zip
chromium_src-05c82189519642144323493e1d0cd65c41ce81ce.tar.gz
chromium_src-05c82189519642144323493e1d0cd65c41ce81ce.tar.bz2
Require user opt-in before allowing content script injection on file URLs.
BUG=47180 Review URL: http://codereview.chromium.org/2809034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50737 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_prefs.cc')
-rw-r--r--chrome/browser/extensions/extension_prefs.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc
index e73b2f6..0f9661c 100644
--- a/chrome/browser/extensions/extension_prefs.cc
+++ b/chrome/browser/extensions/extension_prefs.cc
@@ -67,6 +67,10 @@ const wchar_t kIdleInstallInfoFetchTime[] = L"fetch_time";
// A preference that, if true, will allow this extension to run in incognito
// mode.
const wchar_t kPrefIncognitoEnabled[] = L"incognito";
+
+// A preference to control whether an extension is allowed to inject script in
+// pages with file URLs.
+const wchar_t kPrefAllowFileAccess[] = L"allowFileAccess";
}
////////////////////////////////////////////////////////////////////////////////
@@ -352,6 +356,17 @@ void ExtensionPrefs::SetIsIncognitoEnabled(const std::string& extension_id,
prefs_->SavePersistentPrefs();
}
+bool ExtensionPrefs::AllowFileAccess(const std::string& extension_id) {
+ return ReadExtensionPrefBoolean(extension_id, kPrefAllowFileAccess);
+}
+
+void ExtensionPrefs::SetAllowFileAccess(const std::string& extension_id,
+ bool allow) {
+ UpdateExtensionPref(extension_id, kPrefAllowFileAccess,
+ Value::CreateBooleanValue(allow));
+ prefs_->SavePersistentPrefs();
+}
+
void ExtensionPrefs::GetKilledExtensionIds(std::set<std::string>* killed_ids) {
const DictionaryValue* dict = prefs_->GetDictionary(kExtensionsPref);
if (!dict || dict->empty())