| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 blacklist, | 402 blacklist, |
| 403 update_frequency)); | 403 update_frequency)); |
| 404 } | 404 } |
| 405 | 405 |
| 406 component_loader_.reset( | 406 component_loader_.reset( |
| 407 new extensions::ComponentLoader(this, | 407 new extensions::ComponentLoader(this, |
| 408 profile->GetPrefs(), | 408 profile->GetPrefs(), |
| 409 g_browser_process->local_state())); | 409 g_browser_process->local_state())); |
| 410 | 410 |
| 411 if (extensions_enabled_) { | 411 if (extensions_enabled_) { |
| 412 CHECK(!ProfileManager::IsImportProcess(*command_line)); | |
| 413 extensions::ExternalProviderImpl::CreateExternalProviders( | 412 extensions::ExternalProviderImpl::CreateExternalProviders( |
| 414 this, profile_, &external_extension_providers_); | 413 this, profile_, &external_extension_providers_); |
| 415 } | 414 } |
| 416 | 415 |
| 417 // Set this as the ExtensionService for extension sorting to ensure it | 416 // Set this as the ExtensionService for extension sorting to ensure it |
| 418 // cause syncs if required. | 417 // cause syncs if required. |
| 419 extension_prefs_->extension_sorting()->SetExtensionService(this); | 418 extension_prefs_->extension_sorting()->SetExtensionService(this); |
| 420 | 419 |
| 421 is_first_run_ = !extension_prefs_->SetAlertSystemFirstRun(); | 420 is_first_run_ = !extension_prefs_->SetAlertSystemFirstRun(); |
| 422 | 421 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 return NULL; | 557 return NULL; |
| 559 } | 558 } |
| 560 | 559 |
| 561 void ExtensionService::Init() { | 560 void ExtensionService::Init() { |
| 562 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 561 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 563 | 562 |
| 564 DCHECK(!ready_); // Can't redo init. | 563 DCHECK(!ready_); // Can't redo init. |
| 565 DCHECK_EQ(extensions_.size(), 0u); | 564 DCHECK_EQ(extensions_.size(), 0u); |
| 566 | 565 |
| 567 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 566 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 568 | |
| 569 CHECK(!ProfileManager::IsImportProcess(*cmd_line)); | |
| 570 | |
| 571 if (cmd_line->HasSwitch(switches::kInstallFromWebstore) || | 567 if (cmd_line->HasSwitch(switches::kInstallFromWebstore) || |
| 572 cmd_line->HasSwitch(switches::kLimitedInstallFromWebstore)) { | 568 cmd_line->HasSwitch(switches::kLimitedInstallFromWebstore)) { |
| 573 // The sole purpose of this launch is to install a new extension from CWS | 569 // The sole purpose of this launch is to install a new extension from CWS |
| 574 // and immediately terminate: loading already installed extensions is | 570 // and immediately terminate: loading already installed extensions is |
| 575 // unnecessary and may interfere with the inline install dialog (e.g. if an | 571 // unnecessary and may interfere with the inline install dialog (e.g. if an |
| 576 // extension listens to onStartup and opens a window). | 572 // extension listens to onStartup and opens a window). |
| 577 SetReadyAndNotifyListeners(); | 573 SetReadyAndNotifyListeners(); |
| 578 } else { | 574 } else { |
| 579 // TODO(mek): It might be cleaner to do the FinishDelayedInstallInfo stuff | 575 // TODO(mek): It might be cleaner to do the FinishDelayedInstallInfo stuff |
| 580 // here instead of in installedloader. | 576 // here instead of in installedloader. |
| (...skipping 2519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3100 } | 3096 } |
| 3101 | 3097 |
| 3102 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 3098 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
| 3103 update_observers_.AddObserver(observer); | 3099 update_observers_.AddObserver(observer); |
| 3104 } | 3100 } |
| 3105 | 3101 |
| 3106 void ExtensionService::RemoveUpdateObserver( | 3102 void ExtensionService::RemoveUpdateObserver( |
| 3107 extensions::UpdateObserver* observer) { | 3103 extensions::UpdateObserver* observer) { |
| 3108 update_observers_.RemoveObserver(observer); | 3104 update_observers_.RemoveObserver(observer); |
| 3109 } | 3105 } |
| OLD | NEW |