summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-23 05:14:29 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-23 05:14:29 +0000
commitabe7a89488d132d650aff0846ccd9a0b83d4a1f1 (patch)
tree11a4ec9d81858c7ed3c42433b8f1eff3f6ab4d0c /chrome/browser/renderer_host
parentd022e4e5e269c8a49262003867f7c1354ac00a38 (diff)
downloadchromium_src-abe7a89488d132d650aff0846ccd9a0b83d4a1f1.zip
chromium_src-abe7a89488d132d650aff0846ccd9a0b83d4a1f1.tar.gz
chromium_src-abe7a89488d132d650aff0846ccd9a0b83d4a1f1.tar.bz2
Disable extensions besides externally installed ones and themes.
This is mainly intended to be pulled to the 3.0 branch. It won't be submitted until another corresponding change to undo the damage is ready. BUG=13467 TEST=Added unit tests Review URL: http://codereview.chromium.org/132003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19008 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 06405ed..2463b39 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/child_process_security_policy.h"
#include "chrome/browser/extensions/extension_message_service.h"
+#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/extensions/user_script_master.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/plugin_service.h"
@@ -273,7 +274,6 @@ bool BrowserRenderProcessHost::Init() {
switches::kUseLowFragHeapCrt,
switches::kEnableWebWorkers,
switches::kEnableStatsTable,
- switches::kEnableExtensions,
switches::kDisableOutOfProcessDevTools,
switches::kAutoSpellCorrect,
switches::kDisableAudio,
@@ -288,6 +288,25 @@ bool BrowserRenderProcessHost::Init() {
}
}
+ // Tell the renderer to enable extensions if there are any extensions loaded.
+ //
+ // NOTE: This is subtly different than just passing along whether
+ // --enable-extenisons is present in the browser process. For example, there
+ // is also an extensions.enabled preference, and there may be various special
+ // cases about whether to allow extensions to load.
+ //
+ // This introduces a race condition where the first renderer never gets
+ // extensions enabled, so we also set the flag if extensions_enabled(). This
+ // isn't perfect though, because of the special cases above.
+ //
+ // TODO(aa): We need to get rid of the need to pass this flag at all. It is
+ // only used in one place in the renderer.
+ if (profile()->GetExtensionsService()) {
+ if (profile()->GetExtensionsService()->extensions()->size() > 0 ||
+ profile()->GetExtensionsService()->extensions_enabled())
+ cmd_line.AppendSwitch(switches::kEnableExtensions);
+ }
+
// Pass on the browser locale.
const std::wstring locale = g_browser_process->GetApplicationLocale();
cmd_line.AppendSwitchWithValue(switches::kLang, locale);