Chromium Code Reviews| Index: chrome/browser/extensions/extension_system_impl.cc |
| diff --git a/chrome/browser/extensions/extension_system_impl.cc b/chrome/browser/extensions/extension_system_impl.cc |
| index fa7596f5ad8971e9170674d058eb884391aea2e6..cd1600f28ecd012ab880cc6e83e8b404103bbb20 100644 |
| --- a/chrome/browser/extensions/extension_system_impl.cc |
| +++ b/chrome/browser/extensions/extension_system_impl.cc |
| @@ -130,6 +130,26 @@ void ExtensionSystemImpl::Shared::InitPrefs() { |
| #endif // defined(OS_CHROMEOS) |
| } |
| +void ExtensionSystemImpl::Shared::LoadExtensionsFromCommandLineFlag( |
| + const base::CommandLine* command_line, |
| + const char* switch_name) { |
| + if (command_line->HasSwitch(switch_name)) { |
| + base::CommandLine::StringType path_list = |
| + command_line->GetSwitchValueNative(switch_name); |
| + base::StringTokenizerT<base::CommandLine::StringType, |
| + base::CommandLine::StringType::const_iterator> |
| + t(path_list, FILE_PATH_LITERAL(",")); |
| + while (t.GetNext()) { |
| + std::string extension_id; |
| + UnpackedInstaller::Create(extension_service_.get()) |
| + ->LoadFromCommandLine(base::FilePath(t.token()), &extension_id); |
| + if (std::strcmp(switch_name, switches::kDisableExtensionsExcept) == 0) { |
| + extension_service_->AddExtensionToWhitelist(extension_id); |
| + } |
| + } |
| + } |
| +} |
| + |
| void ExtensionSystemImpl::Shared::RegisterManagementPolicyProviders() { |
| management_policy_->RegisterProviders( |
| ExtensionManagementFactory::GetForBrowserContext(profile_) |
| @@ -263,22 +283,14 @@ void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { |
| quota_service_.reset(new QuotaService); |
| + LoadExtensionsFromCommandLineFlag(command_line, |
| + switches::kDisableExtensionsExcept); |
| + |
| if (extensions_enabled) { |
| // Load any extensions specified with --load-extension. |
| // TODO(yoz): Seems like this should move into ExtensionService::Init. |
|
Devlin
2016/07/27 17:01:00
I agree with this fairly-ancient TODO. Can we mov
catmullings
2016/08/04 22:59:31
Done.
|
| // But maybe it's no longer important. |
| - if (command_line->HasSwitch(switches::kLoadExtension)) { |
| - base::CommandLine::StringType path_list = |
| - command_line->GetSwitchValueNative(switches::kLoadExtension); |
| - base::StringTokenizerT<base::CommandLine::StringType, |
| - base::CommandLine::StringType::const_iterator> |
| - t(path_list, FILE_PATH_LITERAL(",")); |
| - while (t.GetNext()) { |
| - std::string extension_id; |
| - UnpackedInstaller::Create(extension_service_.get())-> |
| - LoadFromCommandLine(base::FilePath(t.token()), &extension_id); |
| - } |
| - } |
| + LoadExtensionsFromCommandLineFlag(command_line, switches::kLoadExtension); |
| } |
| } |