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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 blacklist, | 403 blacklist, |
404 update_frequency)); | 404 update_frequency)); |
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 if (extensions_enabled_) { | 412 if (extensions_enabled_) { |
| 413 CHECK(!ProfileManager::IsImportProcess(*command_line)); |
413 extensions::ExternalProviderImpl::CreateExternalProviders( | 414 extensions::ExternalProviderImpl::CreateExternalProviders( |
414 this, profile_, &external_extension_providers_); | 415 this, profile_, &external_extension_providers_); |
415 } | 416 } |
416 | 417 |
417 // Set this as the ExtensionService for extension sorting to ensure it | 418 // Set this as the ExtensionService for extension sorting to ensure it |
418 // cause syncs if required. | 419 // cause syncs if required. |
419 extension_prefs_->extension_sorting()->SetExtensionService(this); | 420 extension_prefs_->extension_sorting()->SetExtensionService(this); |
420 | 421 |
421 is_first_run_ = !extension_prefs_->SetAlertSystemFirstRun(); | 422 is_first_run_ = !extension_prefs_->SetAlertSystemFirstRun(); |
422 | 423 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 return NULL; | 559 return NULL; |
559 } | 560 } |
560 | 561 |
561 void ExtensionService::Init() { | 562 void ExtensionService::Init() { |
562 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 563 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
563 | 564 |
564 DCHECK(!is_ready()); // Can't redo init. | 565 DCHECK(!is_ready()); // Can't redo init. |
565 DCHECK_EQ(extensions_.size(), 0u); | 566 DCHECK_EQ(extensions_.size(), 0u); |
566 | 567 |
567 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 568 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 569 |
| 570 CHECK(!ProfileManager::IsImportProcess(*cmd_line)); |
| 571 |
568 if (cmd_line->HasSwitch(switches::kInstallFromWebstore) || | 572 if (cmd_line->HasSwitch(switches::kInstallFromWebstore) || |
569 cmd_line->HasSwitch(switches::kLimitedInstallFromWebstore)) { | 573 cmd_line->HasSwitch(switches::kLimitedInstallFromWebstore)) { |
570 // The sole purpose of this launch is to install a new extension from CWS | 574 // The sole purpose of this launch is to install a new extension from CWS |
571 // and immediately terminate: loading already installed extensions is | 575 // and immediately terminate: loading already installed extensions is |
572 // unnecessary and may interfere with the inline install dialog (e.g. if an | 576 // unnecessary and may interfere with the inline install dialog (e.g. if an |
573 // extension listens to onStartup and opens a window). | 577 // extension listens to onStartup and opens a window). |
574 SetReadyAndNotifyListeners(); | 578 SetReadyAndNotifyListeners(); |
575 } else { | 579 } else { |
576 // TODO(mek): It might be cleaner to do the FinishDelayedInstallInfo stuff | 580 // TODO(mek): It might be cleaner to do the FinishDelayedInstallInfo stuff |
577 // here instead of in installedloader. | 581 // here instead of in installedloader. |
(...skipping 2534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3112 } | 3116 } |
3113 | 3117 |
3114 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { | 3118 void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) { |
3115 update_observers_.AddObserver(observer); | 3119 update_observers_.AddObserver(observer); |
3116 } | 3120 } |
3117 | 3121 |
3118 void ExtensionService::RemoveUpdateObserver( | 3122 void ExtensionService::RemoveUpdateObserver( |
3119 extensions::UpdateObserver* observer) { | 3123 extensions::UpdateObserver* observer) { |
3120 update_observers_.RemoveObserver(observer); | 3124 update_observers_.RemoveObserver(observer); |
3121 } | 3125 } |
OLD | NEW |