summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-22 21:23:50 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-22 21:23:50 +0000
commit699c1e725012084d66b8a77781cc8cb202505932 (patch)
tree20f55df1d1ad8730592a912608fa0a6d3bd0ced3
parent3fbf204d3173b31c5971cc203531e7e8b000a987 (diff)
downloadchromium_src-699c1e725012084d66b8a77781cc8cb202505932.zip
chromium_src-699c1e725012084d66b8a77781cc8cb202505932.tar.gz
chromium_src-699c1e725012084d66b8a77781cc8cb202505932.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@18959 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/crypto/rsa_private_key_unittest.cc516
-rw-r--r--chrome/browser/extensions/extensions_service.cc55
-rw-r--r--chrome/browser/extensions/extensions_service.h14
-rw-r--r--chrome/browser/extensions/extensions_service_unittest.cc21
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc19
-rw-r--r--chrome/browser/views/frame/browser_view.cc7
6 files changed, 332 insertions, 300 deletions
diff --git a/base/crypto/rsa_private_key_unittest.cc b/base/crypto/rsa_private_key_unittest.cc
index a2f57c5..3b0d846 100644
--- a/base/crypto/rsa_private_key_unittest.cc
+++ b/base/crypto/rsa_private_key_unittest.cc
@@ -49,110 +49,110 @@ TEST(RSAPrivateKeyUnitTest, InitRandomTest) {
// with the openssl command line tool.
TEST(RSAPrivateKeyUnitTest, PublicKeyTest) {
const uint8 private_key_info[] = {
- 0x30, 0x82, 0x02, 0x78, 0x02, 0x01, 0x00, 0x30,
- 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
-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 0x02, 0x87, 0xe4, 0xfd, 0x61, 0xca,
+ 0x00, 0x42, 0x19, 0xf0, 0xda, 0x5a, 0x53, 0xe3,
0xb1, 0xc5, 0x15, 0xf3
};
const uint8 expected_public_key_info[] = {
- 0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, 0x2a,
- 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01,
- 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, 0x81,
- 0x89, 0x02, 0x81, 0x81, 0x00, 0xb8, 0x7f, 0x2b,
- 0x20, 0xdc, 0x7c, 0x9b, 0x0c, 0xdc, 0x51, 0x61,
- 0x99, 0x0d, 0x36, 0x0f, 0xd4, 0x66, 0x88, 0x08,
- 0x55, 0x84, 0xd5, 0x3a, 0xbf, 0x2b, 0xa4, 0x64,
- 0x85, 0x7b, 0x0c, 0x04, 0x13, 0x3f, 0x8d, 0xf4,
- 0xbc, 0x38, 0x0d, 0x49, 0xfe, 0x6b, 0xc4, 0x5a,
- 0xb0, 0x40, 0x53, 0x3a, 0xd7, 0x66, 0x09, 0x0f,
- 0x9e, 0x36, 0x74, 0x30, 0xda, 0x8a, 0x31, 0x4f,
- 0x1f, 0x14, 0x50, 0xd7, 0xc7, 0x20, 0x94, 0x17,
- 0xde, 0x4e, 0xb9, 0x57, 0x5e, 0x7e, 0x0a, 0xe5,
- 0xb2, 0x65, 0x7a, 0x89, 0x4e, 0xb6, 0x47, 0xff,
- 0x1c, 0xbd, 0xb7, 0x38, 0x13, 0xaf, 0x47, 0x85,
- 0x84, 0x32, 0x33, 0xf3, 0x17, 0x49, 0xbf, 0xe9,
- 0x96, 0xd0, 0xd6, 0x14, 0x6f, 0x13, 0x8d, 0xc5,
- 0xfc, 0x2c, 0x72, 0xba, 0xac, 0xea, 0x7e, 0x18,
- 0x53, 0x56, 0xa6, 0x83, 0xa2, 0xce, 0x93, 0x93,
- 0xe7, 0x1f, 0x0f, 0xe6, 0x0f, 0x02, 0x03, 0x01,
- 0x00, 0x01
+ 0x30, 0x81, 0x9f, 0x30, 0x0d, 0x06, 0x09, 0x2a,
+ 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01,
+ 0x05, 0x00, 0x03, 0x81, 0x8d, 0x00, 0x30, 0x81,
+ 0x89, 0x02, 0x81, 0x81, 0x00, 0xb8, 0x7f, 0x2b,
+ 0x20, 0xdc, 0x7c, 0x9b, 0x0c, 0xdc, 0x51, 0x61,
+ 0x99, 0x0d, 0x36, 0x0f, 0xd4, 0x66, 0x88, 0x08,
+ 0x55, 0x84, 0xd5, 0x3a, 0xbf, 0x2b, 0xa4, 0x64,
+ 0x85, 0x7b, 0x0c, 0x04, 0x13, 0x3f, 0x8d, 0xf4,
+ 0xbc, 0x38, 0x0d, 0x49, 0xfe, 0x6b, 0xc4, 0x5a,
+ 0xb0, 0x40, 0x53, 0x3a, 0xd7, 0x66, 0x09, 0x0f,
+ 0x9e, 0x36, 0x74, 0x30, 0xda, 0x8a, 0x31, 0x4f,
+ 0x1f, 0x14, 0x50, 0xd7, 0xc7, 0x20, 0x94, 0x17,
+ 0xde, 0x4e, 0xb9, 0x57, 0x5e, 0x7e, 0x0a, 0xe5,
+ 0xb2, 0x65, 0x7a, 0x89, 0x4e, 0xb6, 0x47, 0xff,
+ 0x1c, 0xbd, 0xb7, 0x38, 0x13, 0xaf, 0x47, 0x85,
+ 0x84, 0x32, 0x33, 0xf3, 0x17, 0x49, 0xbf, 0xe9,
+ 0x96, 0xd0, 0xd6, 0x14, 0x6f, 0x13, 0x8d, 0xc5,
+ 0xfc, 0x2c, 0x72, 0xba, 0xac, 0xea, 0x7e, 0x18,
+ 0x53, 0x56, 0xa6, 0x83, 0xa2, 0xce, 0x93, 0x93,
+ 0xe7, 0x1f, 0x0f, 0xe6, 0x0f, 0x02, 0x03, 0x01,
+ 0x00, 0x01
};
std::vector<uint8> input;
@@ -186,168 +186,168 @@ TEST(RSAPrivateKeyUnitTest, PublicKeyTest) {
// This test case verifies these two failures modes don't occur.
TEST(RSAPrivateKeyUnitTest, ShortIntegers) {
const uint8 short_integer_with_high_bit[] = {
- 0x30, 0x82, 0x02, 0x77, 0x02, 0x01, 0x00, 0x30,
- 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
- 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82,
- 0x02, 0x61, 0x30, 0x82, 0x02, 0x5d, 0x02, 0x01,
- 0x00, 0x02, 0x81, 0x81, 0x00, 0x92, 0x59, 0x32,
- 0x7d, 0x8e, 0xaf, 0x2e, 0xd5, 0xb2, 0x5c, 0x67,
- 0xc8, 0x7d, 0x48, 0xb7, 0x84, 0x12, 0xd0, 0x76,
- 0xda, 0xe1, 0xa3, 0x1e, 0x40, 0x01, 0x14, 0x5c,
- 0xef, 0x26, 0x6e, 0x28, 0xa2, 0xf7, 0xa5, 0xb4,
- 0x02, 0x37, 0xd0, 0x53, 0x10, 0xcb, 0x7c, 0x6a,
- 0xf4, 0x53, 0x9f, 0xb8, 0xe0, 0x83, 0x93, 0xd1,
- 0x19, 0xd8, 0x28, 0xd1, 0xd1, 0xd8, 0x87, 0x8f,
- 0x92, 0xfd, 0x73, 0xc0, 0x4d, 0x3e, 0x07, 0x22,
- 0x1f, 0xc1, 0x20, 0xb0, 0x70, 0xb2, 0x3b, 0xea,
- 0xb1, 0xe5, 0x0a, 0xfd, 0x56, 0x49, 0x5e, 0x39,
- 0x90, 0x91, 0xce, 0x04, 0x83, 0x29, 0xaa, 0xfd,
- 0x12, 0xa4, 0x42, 0x26, 0x6c, 0x6e, 0x79, 0x70,
- 0x77, 0x03, 0xb2, 0x07, 0x01, 0x3d, 0x85, 0x81,
- 0x95, 0x9e, 0xda, 0x5a, 0xa3, 0xf4, 0x2d, 0x38,
- 0x04, 0x58, 0xf5, 0x6b, 0xc9, 0xf1, 0xb5, 0x65,
- 0xfe, 0x66, 0x0d, 0xa2, 0xd5, 0x02, 0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0x52, 0x38, 0xf9, 0x59, 0x91, 0x2d,
+ 0x90, 0x82, 0xe3, 0x31, 0x1b, 0x48, 0xb7, 0x42,
+ 0xfa, 0x1d, 0x83, 0xd5, 0x3d, 0x02, 0xc2, 0x12,
+ 0x71, 0x10, 0x3a, 0xbd, 0x92, 0x8f, 0x9b, 0xa2,
+ 0x6b, 0x2d, 0x21, 0xa4, 0x65, 0xe9, 0xfa, 0x8c,
+ 0x30, 0x2a, 0x89, 0xce, 0xd0, 0xa7, 0x67, 0xd8,
0x45, 0x84, 0xb0
};
const uint8 short_integer_without_high_bit[] = {
- 0x30, 0x82, 0x02, 0x76, 0x02, 0x01, 0x00, 0x30,
- 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,
- 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82,
- 0x02, 0x60, 0x30, 0x82, 0x02, 0x5c, 0x02, 0x01,
- 0x00, 0x02, 0x81, 0x81, 0x00, 0xc3, 0x9e, 0x8d,
- 0xc4, 0x6d, 0x38, 0xe8, 0x0e, 0x9f, 0x84, 0x03,
- 0x40, 0x8e, 0x81, 0x2e, 0x56, 0x67, 0x78, 0x11,
- 0x85, 0x27, 0x81, 0x52, 0xf2, 0x1b, 0x3e, 0x5b,
- 0xf8, 0xab, 0xfc, 0xaf, 0xca, 0x5c, 0x26, 0xd5,
- 0xfa, 0xd4, 0x55, 0x50, 0x38, 0xb9, 0x9d, 0x89,
- 0x92, 0x7e, 0x34, 0xcf, 0x37, 0x82, 0x48, 0x2d,
- 0xaa, 0xc4, 0x6a, 0x0e, 0x93, 0xea, 0xad, 0x8a,
- 0x33, 0xf0, 0x42, 0x23, 0xe0, 0x4c, 0x98, 0xbf,
- 0x01, 0x00, 0x1b, 0xfe, 0x06, 0x15, 0xc6, 0xe3,
- 0x80, 0x79, 0x6d, 0xfe, 0x48, 0xcd, 0x40, 0xbb,
- 0xf9, 0x58, 0xe6, 0xbf, 0xd5, 0x4c, 0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, 0x8e,
+ 0xff, 0x03, 0x12, 0x09, 0x2a, 0xac, 0x21, 0x44,
+ 0xb7, 0x3e, 0x91, 0x9c, 0x09, 0xf6, 0xd7, 0x02,
+ 0x41, 0x00, 0xc0, 0xa1, 0xbb, 0x70, 0xdc, 0xf8,
+ 0xeb, 0x17, 0x61, 0xd4, 0x8c, 0x7c, 0x3b, 0x82,
+ 0x91, 0x58, 0xff, 0xf9, 0x19, 0xac, 0x3a, 0x73,
+ 0xa7, 0x20, 0xe5, 0x22, 0x02, 0xc4, 0xf6, 0xb9,
+ 0xb9, 0x43, 0x53, 0x35, 0x88, 0xe1, 0x05, 0xb6,
+ 0x43, 0x9b, 0x39, 0xc8, 0x04, 0x4d, 0x2b, 0x01,
+ 0xf7, 0xe6, 0x1b, 0x8d, 0x7e, 0x89, 0xe3, 0x43,
+ 0xd4, 0xf3, 0xab, 0x28, 0xd4, 0x5a, 0x1f, 0x20,
0xea, 0xbe
};
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index a9f81ca..7960664 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -216,22 +216,26 @@ ExtensionsService::ExtensionsService(Profile* profile,
: extension_prefs_(new ExtensionPrefs(profile->GetPrefs())),
backend_loop_(backend_loop),
install_directory_(profile->GetPath().AppendASCII(kInstallDirectoryName)),
- extensions_enabled_(
- CommandLine::ForCurrentProcess()->
- HasSwitch(switches::kEnableExtensions)),
+ extensions_enabled_(false),
show_extensions_prompts_(true),
ready_(false) {
// We pass ownership of this object to the Backend.
DictionaryValue* extensions = extension_prefs_->CopyCurrentExtensions();
backend_ = new ExtensionsServiceBackend(
install_directory_, g_browser_process->resource_dispatcher_host(),
- frontend_loop, extensions);
+ frontend_loop, extensions, extensions_enabled());
}
ExtensionsService::~ExtensionsService() {
UnloadAllExtensions();
}
+void ExtensionsService::SetExtensionsEnabled(bool enabled) {
+ extensions_enabled_ = true;
+ backend_loop_->PostTask(FROM_HERE, NewRunnableMethod(backend_.get(),
+ &ExtensionsServiceBackend::set_extensions_enabled, enabled));
+}
+
void ExtensionsService::Init() {
DCHECK(extensions_.size() == 0);
@@ -354,13 +358,14 @@ void ExtensionsService::OnLoadedInstalledExtensions() {
void ExtensionsService::OnExtensionsLoaded(ExtensionList* new_extensions) {
scoped_ptr<ExtensionList> cleanup(new_extensions);
- // Filter out any extensions we don't want to enable. Themes are always
- // enabled, but other extensions are only loaded if --enable-extensions is
- // present.
+ // Filter out any extensions that shouldn't be loaded. Themes are always
+ // loaded, but other extensions are only loaded if the extensions system is
+ // enabled.
ExtensionList enabled_extensions;
for (ExtensionList::iterator iter = new_extensions->begin();
iter != new_extensions->end(); ++iter) {
- if (extensions_enabled() || (*iter)->IsTheme()) {
+ if (extensions_enabled() || (*iter)->IsTheme() ||
+ (*iter)->location() == Extension::EXTERNAL_REGISTRY) {
Extension* old = GetExtensionById((*iter)->id());
if (old) {
if ((*iter)->version()->CompareTo(*(old->version())) > 0) {
@@ -451,12 +456,14 @@ void ExtensionsService::SetProviderForTesting(
ExtensionsServiceBackend::ExtensionsServiceBackend(
const FilePath& install_directory, ResourceDispatcherHost* rdh,
- MessageLoop* frontend_loop, DictionaryValue* extension_prefs)
+ MessageLoop* frontend_loop, DictionaryValue* extension_prefs,
+ bool extensions_enabled)
: frontend_(NULL),
install_directory_(install_directory),
resource_dispatcher_host_(rdh),
alert_on_error_(false),
- frontend_loop_(frontend_loop) {
+ frontend_loop_(frontend_loop),
+ extensions_enabled_(false) {
external_extension_providers_[Extension::EXTERNAL_PREF] =
linked_ptr<ExternalExtensionProvider>(
new ExternalPrefExtensionProvider(extension_prefs));
@@ -956,28 +963,22 @@ void ExtensionsServiceBackend::OnExtensionUnpacked(
return;
}
- if (!frontend_->extensions_enabled() && !extension.IsTheme()) {
-#if defined(OS_WIN)
- if (frontend_->show_extensions_prompts()) {
- win_util::MessageBox(GetForegroundWindow(),
- L"Extensions are not enabled. Add --enable-extensions to the "
- L"command-line to enable extensions.\n\n"
- L"This is a temporary message and it will be removed when extensions "
- L"UI is finalized.",
- l10n_util::GetString(IDS_PRODUCT_NAME).c_str(), MB_OK);
- }
-#endif
+ Extension::Location location = Extension::INTERNAL;
+ LookupExternalExtension(extension.id(), NULL, &location);
+
+ // We currently only allow themes and registry-installed extensions to be
+ // installed.
+ if (!extensions_enabled_ &&
+ !extension.IsTheme() &&
+ location != Extension::EXTERNAL_REGISTRY) {
ReportExtensionInstallError(extension_path,
- "Extensions are not enabled.");
+ "Extensions are not enabled (yet!)");
return;
}
- Extension::Location location = Extension::INTERNAL;
- LookupExternalExtension(extension.id(), NULL, &location);
#if defined(OS_WIN)
- bool from_external = Extension::IsExternalLocation(location);
-
- if (!extension.IsTheme() && !from_external &&
+ if (!extension.IsTheme() &&
+ !Extension::IsExternalLocation(location) &&
frontend_->show_extensions_prompts() &&
win_util::MessageBox(GetForegroundWindow(),
L"Are you sure you want to install this extension?\n\n"
diff --git a/chrome/browser/extensions/extensions_service.h b/chrome/browser/extensions/extensions_service.h
index f2f0b56..87c387f 100644
--- a/chrome/browser/extensions/extensions_service.h
+++ b/chrome/browser/extensions/extensions_service.h
@@ -132,12 +132,13 @@ class ExtensionsService
// The name of the file that the current active version number is stored in.
static const char* kCurrentVersionFileName;
- void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; }
+ void SetExtensionsEnabled(bool enabled);
+ bool extensions_enabled() { return extensions_enabled_; }
+
void set_show_extensions_prompts(bool enabled) {
show_extensions_prompts_ = enabled;
}
- bool extensions_enabled() { return extensions_enabled_; }
bool show_extensions_prompts() {
return show_extensions_prompts_;
}
@@ -209,10 +210,13 @@ class ExtensionsServiceBackend
ExtensionsServiceBackend(const FilePath& install_directory,
ResourceDispatcherHost* rdh,
MessageLoop* frontend_loop,
- DictionaryValue* extension_prefs);
+ DictionaryValue* extension_prefs,
+ bool extensions_enabled);
virtual ~ExtensionsServiceBackend();
+ void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; }
+
// Loads the installed extensions.
// Errors are reported through ExtensionErrorReporter. On completion,
// OnExtensionsLoaded() is called with any successfully loaded extensions.
@@ -399,6 +403,10 @@ class ExtensionsServiceBackend
// The message loop to use to call the frontend.
MessageLoop* frontend_loop_;
+ // Whether non-theme extensions are enabled (themes and externally registered
+ // extensions are always enabled).
+ bool extensions_enabled_;
+
// A map of all external extension providers.
typedef std::map<Extension::Location,
linked_ptr<ExternalExtensionProvider> > ProviderMap;
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc
index e2dd984..e41a84a 100644
--- a/chrome/browser/extensions/extensions_service_unittest.cc
+++ b/chrome/browser/extensions/extensions_service_unittest.cc
@@ -131,7 +131,7 @@ class ExtensionsServiceTest
profile_.reset(new TestingProfile());
service_ = new ExtensionsService(profile_.get(), &loop_, &loop_);
- service_->set_extensions_enabled(true);
+ service_->SetExtensionsEnabled(true);
service_->set_show_extensions_prompts(false);
// When we start up, we want to make sure there is no external provider,
@@ -191,7 +191,7 @@ class ExtensionsServiceTest
}
void SetExtensionsEnabled(bool enabled) {
- service_->set_extensions_enabled(enabled);
+ service_->SetExtensionsEnabled(enabled);
}
void SetMockExternalProvider(Extension::Location location,
@@ -498,8 +498,6 @@ TEST_F(ExtensionsServiceTest, InstallExtension) {
// Test Packaging and installing an extension.
// TODO(rafaelw): add more tests for failure cases.
TEST_F(ExtensionsServiceTest, PackExtension) {
- SetExtensionsEnabled(true);
-
FilePath extensions_path;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extensions_path));
extensions_path = extensions_path.AppendASCII("extensions");
@@ -530,8 +528,6 @@ TEST_F(ExtensionsServiceTest, PackExtension) {
// The privkey.pem is a PrivateKey, and the pcks8 -topk8 creates a
// PrivateKeyInfo ASN.1 structure, we our RSAPrivateKey expects.
TEST_F(ExtensionsServiceTest, PackExtensionOpenSSLKey) {
- SetExtensionsEnabled(true);
-
FilePath extensions_path;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extensions_path));
extensions_path = extensions_path.AppendASCII("extensions");
@@ -804,6 +800,9 @@ TEST_F(ExtensionsServiceTest, GenerateID) {
#if defined(OS_WIN)
TEST_F(ExtensionsServiceTest, ExternalInstallRegistry) {
+ // This should all work, even when normal extension installation is disabled.
+ SetExtensionsEnabled(false);
+
// Verify that starting with no providers loads no extensions.
service_->Init();
loop_.RunAllPending();
@@ -1013,4 +1012,14 @@ TEST_F(ExtensionsServiceTest, ExternalInstallPref) {
extension_path = extension_path.AppendASCII(good_crx);
EXPECT_FALSE(file_util::PathExists(extension_path)) <<
extension_path.ToWStringHack();
+
+ // This shouldn't work if extensions are disabled.
+ SetExtensionsEnabled(false);
+
+ pref_provider->UpdateOrAddExtension(good_crx, "1.0", source_path);
+ service_->CheckForUpdates();
+ loop_.RunAllPending();
+
+ ASSERT_EQ(0u, loaded_.size());
+ ASSERT_EQ(1u, GetErrors().size());
}
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 06405ed..a865349 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,23 @@ 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()->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);
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 8aa44b6..d01ee94 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -1402,11 +1402,8 @@ void BrowserView::Init() {
status_bubble_.reset(new StatusBubbleViews(GetWidget()));
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableExtensions)) {
- extension_shelf_ = new ExtensionShelf(browser_.get());
- AddChildView(extension_shelf_);
- }
+ extension_shelf_ = new ExtensionShelf(browser_.get());
+ AddChildView(extension_shelf_);
#if defined(OS_WIN)
InitSystemMenu();