Chromium Code Reviews| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 #include "extensions/common/permissions/permission_message_provider.h" | 98 #include "extensions/common/permissions/permission_message_provider.h" |
| 99 #include "extensions/common/permissions/permissions_data.h" | 99 #include "extensions/common/permissions/permissions_data.h" |
| 100 | 100 |
| 101 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) | 101 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
| 102 #include "chrome/browser/supervised_user/supervised_user_service.h" | 102 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 103 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 103 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 104 #endif | 104 #endif |
| 105 | 105 |
| 106 #if defined(OS_CHROMEOS) | 106 #if defined(OS_CHROMEOS) |
| 107 #include "chrome/browser/chromeos/extensions/install_limiter.h" | 107 #include "chrome/browser/chromeos/extensions/install_limiter.h" |
| 108 #include "chrome/browser/chromeos/profiles/profile_helper.h" | |
| 108 #include "storage/browser/fileapi/file_system_backend.h" | 109 #include "storage/browser/fileapi/file_system_backend.h" |
| 109 #include "storage/browser/fileapi/file_system_context.h" | 110 #include "storage/browser/fileapi/file_system_context.h" |
| 110 #endif | 111 #endif |
| 111 | 112 |
| 112 using content::BrowserContext; | 113 using content::BrowserContext; |
| 113 using content::BrowserThread; | 114 using content::BrowserThread; |
| 114 using content::DevToolsAgentHost; | 115 using content::DevToolsAgentHost; |
| 115 using extensions::APIPermission; | 116 using extensions::APIPermission; |
| 116 using extensions::AppSorting; | 117 using extensions::AppSorting; |
| 117 using extensions::CrxInstaller; | 118 using extensions::CrxInstaller; |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 434 void ExtensionService::Init() { | 435 void ExtensionService::Init() { |
| 435 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 436 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 436 TRACE_EVENT0("browser,startup", "ExtensionService::Init"); | 437 TRACE_EVENT0("browser,startup", "ExtensionService::Init"); |
| 437 SCOPED_UMA_HISTOGRAM_TIMER("Extensions.ExtensionServiceInitTime"); | 438 SCOPED_UMA_HISTOGRAM_TIMER("Extensions.ExtensionServiceInitTime"); |
| 438 | 439 |
| 439 DCHECK(!is_ready()); // Can't redo init. | 440 DCHECK(!is_ready()); // Can't redo init. |
| 440 DCHECK_EQ(registry_->enabled_extensions().size(), 0u); | 441 DCHECK_EQ(registry_->enabled_extensions().size(), 0u); |
| 441 | 442 |
| 442 // LoadAllExtensions() calls OnLoadedInstalledExtensions(). | 443 // LoadAllExtensions() calls OnLoadedInstalledExtensions(). |
| 443 component_loader_->LoadAll(); | 444 component_loader_->LoadAll(); |
| 444 extensions::InstalledLoader(this).LoadAllExtensions(); | 445 bool load_saved_extensions = true; |
| 446 #if defined(OS_CHROMEOS) | |
| 447 if (chromeos::ProfileHelper::IsSigninProfile(profile_)) | |
| 448 load_saved_extensions = false; | |
| 449 #endif | |
| 450 if (load_saved_extensions) | |
| 451 extensions::InstalledLoader(this).LoadAllExtensions(); | |
| 452 else | |
| 453 OnLoadedInstalledExtensions(); // Callback from LoadAllExtensions. | |
|
Devlin
2017/03/22 22:57:39
nit: elaborate a bit on this comment. Also, this f
achuithb
2017/03/23 00:26:26
Done.
I thought about refactoring this, but I thi
| |
| 445 LoadExtensionsFromCommandLineFlag(switches::kDisableExtensionsExcept); | 454 LoadExtensionsFromCommandLineFlag(switches::kDisableExtensionsExcept); |
| 446 if (extensions_enabled_) | 455 if (extensions_enabled_) |
| 447 LoadExtensionsFromCommandLineFlag(switches::kLoadExtension); | 456 LoadExtensionsFromCommandLineFlag(switches::kLoadExtension); |
| 448 // ChromeDriver has no way of determining the Chrome version until after | 457 // ChromeDriver has no way of determining the Chrome version until after |
| 449 // launch, so it needs to continue passing load-component-extension until it | 458 // launch, so it needs to continue passing load-component-extension until it |
| 450 // stops supporting Chrome 56 (when M58 is released). These extensions are | 459 // stops supporting Chrome 56 (when M58 is released). These extensions are |
| 451 // loaded as regular extensions, not component extensions, and are thus safe. | 460 // loaded as regular extensions, not component extensions, and are thus safe. |
| 452 // TODO(samuong): Remove this when we release Chrome 58 to stable channel. | 461 // TODO(samuong): Remove this when we release Chrome 58 to stable channel. |
| 453 if (command_line_->HasSwitch(switches::kEnableAutomation) && | 462 if (command_line_->HasSwitch(switches::kEnableAutomation) && |
| 454 command_line_->HasSwitch(kDeprecatedLoadComponentExtension)) { | 463 command_line_->HasSwitch(kDeprecatedLoadComponentExtension)) { |
| (...skipping 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2542 } | 2551 } |
| 2543 | 2552 |
| 2544 void ExtensionService::OnProfileDestructionStarted() { | 2553 void ExtensionService::OnProfileDestructionStarted() { |
| 2545 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2554 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
| 2546 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2555 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
| 2547 it != ids_to_unload.end(); | 2556 it != ids_to_unload.end(); |
| 2548 ++it) { | 2557 ++it) { |
| 2549 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2558 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
| 2550 } | 2559 } |
| 2551 } | 2560 } |
| OLD | NEW |