summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-19 01:26:13 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-19 01:26:13 +0000
commitf93fe78db9c83619fd55aeccdade102915404c28 (patch)
treecba3becbcc66eb1d04baff57fe830bff1a1d46cc /chrome
parent5ba0a2cc590e74be37190774d6b8db1f418d7906 (diff)
downloadchromium_src-f93fe78db9c83619fd55aeccdade102915404c28.zip
chromium_src-f93fe78db9c83619fd55aeccdade102915404c28.tar.gz
chromium_src-f93fe78db9c83619fd55aeccdade102915404c28.tar.bz2
Support controlling extensions with a pref in addition to command-line.
Review URL: http://codereview.chromium.org/20481 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10000 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/profile.cc9
-rw-r--r--chrome/common/pref_names.cc4
-rw-r--r--chrome/common/pref_names.h3
3 files changed, 14 insertions, 2 deletions
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 66f75d8..4602c91 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -72,6 +72,8 @@ void Profile::RegisterUserPrefs(PrefService* prefs) {
IDS_SPELLCHECK_DICTIONARY);
#endif
prefs->RegisterBooleanPref(prefs::kEnableSpellCheck, true);
+ prefs->RegisterBooleanPref(prefs::kEnableUserScripts, false);
+ prefs->RegisterBooleanPref(prefs::kEnableExtensions, false);
}
// static
@@ -352,10 +354,13 @@ void ProfileImpl::InitExtensions() {
return; // Already initialized.
const CommandLine* command_line = CommandLine::ForCurrentProcess();
+ PrefService* prefs = GetPrefs();
bool user_scripts_enabled =
- command_line->HasSwitch(switches::kEnableUserScripts);
+ command_line->HasSwitch(switches::kEnableUserScripts) ||
+ prefs->GetBoolean(prefs::kEnableUserScripts);
bool extensions_enabled =
- command_line->HasSwitch(switches::kEnableExtensions);
+ command_line->HasSwitch(switches::kEnableExtensions) ||
+ prefs->GetBoolean(prefs::kEnableExtensions);
FilePath script_dir;
if (user_scripts_enabled) {
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index b10f4f0..3213362 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -464,4 +464,8 @@ const wchar_t kNumFoldersInOtherBookmarkFolder[] =
// Number of keywords.
const wchar_t kNumKeywords[] = L"user_experience_metrics.num_keywords";
+// Whether Extensions or User Scripts are enabled.
+const wchar_t kEnableExtensions[] = L"extensions.enabled";
+const wchar_t kEnableUserScripts[] = L"extensions.user_scripts_enabled";
+
} // namespace prefs
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index f1f47a6..dd5e35d 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -163,6 +163,9 @@ extern const wchar_t kNumBookmarksInOtherBookmarkFolder[];
extern const wchar_t kNumFoldersInOtherBookmarkFolder[];
extern const wchar_t kNumKeywords[];
+
+extern const wchar_t kEnableExtensions[];
+extern const wchar_t kEnableUserScripts[];
}
#endif // CHROME_COMMON_PREF_NAMES_H_