OLD | NEW |
---|---|
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 using extensions::PermissionSet; | 130 using extensions::PermissionSet; |
131 using extensions::SharedModuleInfo; | 131 using extensions::SharedModuleInfo; |
132 using extensions::SharedModuleService; | 132 using extensions::SharedModuleService; |
133 using extensions::UnloadedExtensionInfo; | 133 using extensions::UnloadedExtensionInfo; |
134 | 134 |
135 namespace { | 135 namespace { |
136 | 136 |
137 // Wait this many seconds after an extensions becomes idle before updating it. | 137 // Wait this many seconds after an extensions becomes idle before updating it. |
138 const int kUpdateIdleDelay = 5; | 138 const int kUpdateIdleDelay = 5; |
139 | 139 |
140 // Comma-separated list of directories with extensions to load. | |
Devlin
2017/02/14 23:57:53
TODO(samuong): Remove this. See also ExtensionServ
samuong
2017/02/15 00:02:50
Done.
| |
141 const char kLoadComponentExtension[] = "load-component-extension"; | |
Devlin
2017/02/14 23:57:53
s/kLoadComponentExtension/kDeprecatedLoadComponent
samuong
2017/02/15 00:02:50
Done.
| |
142 | |
140 } // namespace | 143 } // namespace |
141 | 144 |
142 // ExtensionService. | 145 // ExtensionService. |
143 | 146 |
144 void ExtensionService::CheckExternalUninstall(const std::string& id) { | 147 void ExtensionService::CheckExternalUninstall(const std::string& id) { |
145 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 148 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
146 | 149 |
147 // Check if the providers know about this extension. | 150 // Check if the providers know about this extension. |
148 for (const auto& provider : external_extension_providers_) { | 151 for (const auto& provider : external_extension_providers_) { |
149 DCHECK(provider->IsReady()); | 152 DCHECK(provider->IsReady()); |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
432 | 435 |
433 DCHECK(!is_ready()); // Can't redo init. | 436 DCHECK(!is_ready()); // Can't redo init. |
434 DCHECK_EQ(registry_->enabled_extensions().size(), 0u); | 437 DCHECK_EQ(registry_->enabled_extensions().size(), 0u); |
435 | 438 |
436 // LoadAllExtensions() calls OnLoadedInstalledExtensions(). | 439 // LoadAllExtensions() calls OnLoadedInstalledExtensions(). |
437 component_loader_->LoadAll(); | 440 component_loader_->LoadAll(); |
438 extensions::InstalledLoader(this).LoadAllExtensions(); | 441 extensions::InstalledLoader(this).LoadAllExtensions(); |
439 LoadExtensionsFromCommandLineFlag(switches::kDisableExtensionsExcept); | 442 LoadExtensionsFromCommandLineFlag(switches::kDisableExtensionsExcept); |
440 if (extensions_enabled_) | 443 if (extensions_enabled_) |
441 LoadExtensionsFromCommandLineFlag(switches::kLoadExtension); | 444 LoadExtensionsFromCommandLineFlag(switches::kLoadExtension); |
445 // ChromeDriver has no way of determining the Chrome version until after | |
446 // launch, so it needs to continue passing load-component-extension until it | |
447 // stops supporting Chrome 56 (when M58 is released). These extensions are | |
448 // loaded as regular extensions, not component extensions, and are thus safe. | |
449 // TODO(samuong): Remove this when we release Chrome 58 to stable channel. | |
450 if (command_line_->HasSwitch(switches::kEnableAutomation) && | |
451 command_line_->HasSwitch(kLoadComponentExtension)) { | |
452 LOG(WARNING) << "Loading extension specified by " | |
453 "--load-component-extension as a regular extension. " | |
454 "Extensions specified by --load-component-extension will " | |
455 "not be loaded starting in M58. Use --load-extension or " | |
456 "--disable-extensions-except."; | |
457 LoadExtensionsFromCommandLineFlag(kLoadComponentExtension); | |
458 } | |
442 EnabledReloadableExtensions(); | 459 EnabledReloadableExtensions(); |
443 MaybeFinishShutdownDelayed(); | 460 MaybeFinishShutdownDelayed(); |
444 SetReadyAndNotifyListeners(); | 461 SetReadyAndNotifyListeners(); |
445 | 462 |
446 // TODO(erikkay): this should probably be deferred to a future point | 463 // TODO(erikkay): this should probably be deferred to a future point |
447 // rather than running immediately at startup. | 464 // rather than running immediately at startup. |
448 CheckForExternalUpdates(); | 465 CheckForExternalUpdates(); |
449 | 466 |
450 LoadGreylistFromPrefs(); | 467 LoadGreylistFromPrefs(); |
451 } | 468 } |
(...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2502 } | 2519 } |
2503 | 2520 |
2504 void ExtensionService::OnProfileDestructionStarted() { | 2521 void ExtensionService::OnProfileDestructionStarted() { |
2505 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2522 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2506 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2523 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2507 it != ids_to_unload.end(); | 2524 it != ids_to_unload.end(); |
2508 ++it) { | 2525 ++it) { |
2509 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2526 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2510 } | 2527 } |
2511 } | 2528 } |
OLD | NEW |