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

Unified Diff: chrome/browser/extensions/extension_system_impl.cc

Issue 2166513002: Create --disable-extensions-except switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test Created 4 years, 5 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/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..cd485317e621ef7f641e5308530ac32903d10f56 100644
--- a/chrome/browser/extensions/extension_system_impl.cc
+++ b/chrome/browser/extensions/extension_system_impl.cc
@@ -263,6 +263,19 @@ void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) {
quota_service_.reset(new QuotaService);
+ if (command_line->HasSwitch(switches::kDisableExtensionsExcept)) {
+ base::CommandLine::StringType path_list =
Devlin 2016/07/25 19:10:30 The fact that the next 10 lines are almost identic
catmullings 2016/07/27 01:29:46 Done.
+ command_line->GetSwitchValueNative(switches::kDisableExtensionsExcept);
+ 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);
+ extension_service_->AddExtensionToWhitelist(extension_id);
+ }
+ }
if (extensions_enabled) {
// Load any extensions specified with --load-extension.
// TODO(yoz): Seems like this should move into ExtensionService::Init.

Powered by Google App Engine
This is Rietveld 408576698