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

Unified Diff: chrome/browser/renderer_host/browser_render_process_host.cc

Issue 132003: Disable extensions besides externally installed ones and themes. (Closed)
Patch Set: Fix ui test bustage Created 11 years, 6 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/renderer_host/browser_render_process_host.cc
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 06405ed8efcdbbeeadac3f206159b96e10c02b26..2463b39d0e257626de2ebe0a06de093cc3116701 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);
« no previous file with comments | « chrome/browser/extensions/extensions_service_unittest.cc ('k') | chrome/browser/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698