OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 } | 405 } |
406 | 406 |
407 component_loader_.reset( | 407 component_loader_.reset( |
408 new extensions::ComponentLoader(this, | 408 new extensions::ComponentLoader(this, |
409 profile->GetPrefs(), | 409 profile->GetPrefs(), |
410 g_browser_process->local_state())); | 410 g_browser_process->local_state())); |
411 | 411 |
412 app_notification_manager_->Init(); | 412 app_notification_manager_->Init(); |
413 | 413 |
414 if (extensions_enabled_) { | 414 if (extensions_enabled_) { |
415 if (!command_line->HasSwitch(switches::kImport) && | 415 CHECK(!ProfileManager::IsImportProcess(*command_line)); |
416 !command_line->HasSwitch(switches::kImportFromFile)) { | 416 extensions::ExternalProviderImpl::CreateExternalProviders( |
417 extensions::ExternalProviderImpl::CreateExternalProviders( | 417 this, profile_, &external_extension_providers_); |
418 this, profile_, &external_extension_providers_); | |
419 } | |
420 } | 418 } |
421 | 419 |
422 // Set this as the ExtensionService for extension sorting to ensure it | 420 // Set this as the ExtensionService for extension sorting to ensure it |
423 // cause syncs if required. | 421 // cause syncs if required. |
424 extension_prefs_->extension_sorting()->SetExtensionService(this); | 422 extension_prefs_->extension_sorting()->SetExtensionService(this); |
425 | 423 |
426 #if defined(ENABLE_EXTENSIONS) | 424 #if defined(ENABLE_EXTENSIONS) |
427 extension_action_storage_manager_.reset( | 425 extension_action_storage_manager_.reset( |
428 new extensions::ExtensionActionStorageManager(profile_)); | 426 new extensions::ExtensionActionStorageManager(profile_)); |
429 #endif | 427 #endif |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 component_loader_->LoadAll(); | 594 component_loader_->LoadAll(); |
597 extensions::InstalledLoader(this).LoadAllExtensions(); | 595 extensions::InstalledLoader(this).LoadAllExtensions(); |
598 | 596 |
599 // The Sideload Wipeout effort takes place during load (see above), so once | 597 // The Sideload Wipeout effort takes place during load (see above), so once |
600 // that is done the flag can be set so that we don't have to check again. | 598 // that is done the flag can be set so that we don't have to check again. |
601 if (wipeout_is_active_) { | 599 if (wipeout_is_active_) { |
602 extension_prefs_->SetSideloadWipeoutDone(); | 600 extension_prefs_->SetSideloadWipeoutDone(); |
603 wipeout_is_active_ = false; // Wipeout is only on during load. | 601 wipeout_is_active_ = false; // Wipeout is only on during load. |
604 } | 602 } |
605 | 603 |
606 // If we are running in the import process, don't bother initializing the | 604 CHECK(!ProfileManager::IsImportProcess(*CommandLine::ForCurrentProcess())); |
607 // extension service since this can interfere with the main browser process | 605 if (g_browser_process->profile_manager() && |
608 // that is already running an extension service for this profile. | 606 g_browser_process->profile_manager()->will_import()) { |
609 // TODO(aa): can we start up even less of ExtensionService? | 607 RegisterForImportFinished(); |
610 // http://crbug.com/107636 | 608 } else { |
611 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kImport) && | 609 // TODO(erikkay) this should probably be deferred to a future point |
612 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kImportFromFile)) { | 610 // rather than running immediately at startup. |
613 if (g_browser_process->profile_manager() && | 611 CheckForExternalUpdates(); |
614 g_browser_process->profile_manager()->will_import()) { | |
615 RegisterForImportFinished(); | |
616 } else { | |
617 // TODO(erikkay) this should probably be deferred to a future point | |
618 // rather than running immediately at startup. | |
619 CheckForExternalUpdates(); | |
620 | 612 |
621 // TODO(erikkay) this should probably be deferred as well. | 613 // TODO(erikkay) this should probably be deferred as well. |
622 GarbageCollectExtensions(); | 614 GarbageCollectExtensions(); |
623 } | |
624 } | 615 } |
625 | 616 |
626 if (extension_prefs_->NeedsStorageGarbageCollection()) { | 617 if (extension_prefs_->NeedsStorageGarbageCollection()) { |
627 GarbageCollectIsolatedStorage(); | 618 GarbageCollectIsolatedStorage(); |
628 extension_prefs_->SetNeedsStorageGarbageCollection(false); | 619 extension_prefs_->SetNeedsStorageGarbageCollection(false); |
629 } | 620 } |
630 } | 621 } |
631 | 622 |
632 bool ExtensionService::UpdateExtension(const std::string& id, | 623 bool ExtensionService::UpdateExtension(const std::string& id, |
633 const FilePath& extension_path, | 624 const FilePath& extension_path, |
(...skipping 2515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3149 scoped_refptr<const Extension> extension = GetInstalledExtension(*it); | 3140 scoped_refptr<const Extension> extension = GetInstalledExtension(*it); |
3150 DCHECK(extension); | 3141 DCHECK(extension); |
3151 if (!extension) | 3142 if (!extension) |
3152 continue; | 3143 continue; |
3153 blacklisted_extensions_.Insert(extension); | 3144 blacklisted_extensions_.Insert(extension); |
3154 UnloadExtension(*it, extension_misc::UNLOAD_REASON_BLACKLIST); | 3145 UnloadExtension(*it, extension_misc::UNLOAD_REASON_BLACKLIST); |
3155 } | 3146 } |
3156 | 3147 |
3157 IdentifyAlertableExtensions(); | 3148 IdentifyAlertableExtensions(); |
3158 } | 3149 } |
OLD | NEW |