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

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 2149953002: Enable login screen apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Devlin comments Created 3 years, 9 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 } 433 }
433 434
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 component_loader_->LoadAll(); 443 component_loader_->LoadAll();
444 extensions::InstalledLoader(this).LoadAllExtensions(); 444 bool load_saved_extensions = true;
445 #if defined(OS_CHROMEOS)
446 if (chromeos::ProfileHelper::IsSigninProfile(profile_))
447 load_saved_extensions = false;
448 #endif
449 if (load_saved_extensions) {
450 extensions::InstalledLoader(this).LoadAllExtensions();
451 } else {
452 // InstalledLoader::LoadAllExtensions normally calls
453 // OnLoadedInstalledExtensions itself, but here we circumvent that path.
454 // Call OnLoadedInstalledExtensions directly.
455 // TODO(devlin): LoadInstalledExtensions() is synchronous - we can simplify
456 // this.
457 OnLoadedInstalledExtensions();
458 }
445 LoadExtensionsFromCommandLineFlag(switches::kDisableExtensionsExcept); 459 LoadExtensionsFromCommandLineFlag(switches::kDisableExtensionsExcept);
446 if (extensions_enabled_) 460 if (extensions_enabled_)
447 LoadExtensionsFromCommandLineFlag(switches::kLoadExtension); 461 LoadExtensionsFromCommandLineFlag(switches::kLoadExtension);
448 // ChromeDriver has no way of determining the Chrome version until after 462 // ChromeDriver has no way of determining the Chrome version until after
449 // launch, so it needs to continue passing load-component-extension until it 463 // launch, so it needs to continue passing load-component-extension until it
450 // stops supporting Chrome 56 (when M58 is released). These extensions are 464 // stops supporting Chrome 56 (when M58 is released). These extensions are
451 // loaded as regular extensions, not component extensions, and are thus safe. 465 // loaded as regular extensions, not component extensions, and are thus safe.
452 // TODO(samuong): Remove this when we release Chrome 58 to stable channel. 466 // TODO(samuong): Remove this when we release Chrome 58 to stable channel.
453 if (command_line_->HasSwitch(switches::kEnableAutomation) && 467 if (command_line_->HasSwitch(switches::kEnableAutomation) &&
454 command_line_->HasSwitch(kDeprecatedLoadComponentExtension)) { 468 command_line_->HasSwitch(kDeprecatedLoadComponentExtension)) {
(...skipping 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after
2542 } 2556 }
2543 2557
2544 void ExtensionService::OnProfileDestructionStarted() { 2558 void ExtensionService::OnProfileDestructionStarted() {
2545 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2559 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2546 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2560 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2547 it != ids_to_unload.end(); 2561 it != ids_to_unload.end();
2548 ++it) { 2562 ++it) {
2549 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2563 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2550 } 2564 }
2551 } 2565 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698