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

Side by Side Diff: chrome/browser/extensions/extension_service.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 EnableExtension(extension->id()); 1439 EnableExtension(extension->id());
1440 } 1440 }
1441 1441
1442 OnBlacklistUpdated(); 1442 OnBlacklistUpdated();
1443 } 1443 }
1444 1444
1445 void ExtensionService::AddExtension(const Extension* extension) { 1445 void ExtensionService::AddExtension(const Extension* extension) {
1446 // TODO(jstritar): We may be able to get rid of this branch by overriding the 1446 // TODO(jstritar): We may be able to get rid of this branch by overriding the
1447 // default extension state to DISABLED when the --disable-extensions flag 1447 // default extension state to DISABLED when the --disable-extensions flag
1448 // is set (http://crbug.com/29067). 1448 // is set (http://crbug.com/29067).
1449 if (!extensions_enabled() && 1449 if (!extensions_enabled() && !extension->is_theme() &&
1450 !extension->is_theme() &&
1451 extension->location() != Manifest::COMPONENT && 1450 extension->location() != Manifest::COMPONENT &&
1452 !Manifest::IsExternalLocation(extension->location())) { 1451 !Manifest::IsExternalLocation(extension->location()) &&
1452 !IsExtensionWhitelisted(extension->id())) {
1453 return; 1453 return;
1454 } 1454 }
1455 1455
1456 bool is_extension_upgrade = false; 1456 bool is_extension_upgrade = false;
1457 bool is_extension_loaded = false; 1457 bool is_extension_loaded = false;
1458 const Extension* old = GetInstalledExtension(extension->id()); 1458 const Extension* old = GetInstalledExtension(extension->id());
1459 if (old) { 1459 if (old) {
1460 is_extension_loaded = true; 1460 is_extension_loaded = true;
1461 int version_compare_result = 1461 int version_compare_result =
1462 extension->version()->CompareTo(*(old->version())); 1462 extension->version()->CompareTo(*(old->version()));
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
2467 } 2467 }
2468 2468
2469 void ExtensionService::OnProfileDestructionStarted() { 2469 void ExtensionService::OnProfileDestructionStarted() {
2470 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2470 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2471 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2471 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2472 it != ids_to_unload.end(); 2472 it != ids_to_unload.end();
2473 ++it) { 2473 ++it) {
2474 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2474 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2475 } 2475 }
2476 } 2476 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698