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