| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_system_impl.h" | 5 #include "chrome/browser/extensions/extension_system_impl.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // | 93 // |
| 94 | 94 |
| 95 ExtensionSystemImpl::Shared::Shared(Profile* profile) | 95 ExtensionSystemImpl::Shared::Shared(Profile* profile) |
| 96 : profile_(profile) { | 96 : profile_(profile) { |
| 97 } | 97 } |
| 98 | 98 |
| 99 ExtensionSystemImpl::Shared::~Shared() { | 99 ExtensionSystemImpl::Shared::~Shared() { |
| 100 } | 100 } |
| 101 | 101 |
| 102 void ExtensionSystemImpl::Shared::InitPrefs() { | 102 void ExtensionSystemImpl::Shared::InitPrefs() { |
| 103 lazy_background_task_queue_.reset(new LazyBackgroundTaskQueue(profile_)); | |
| 104 event_router_.reset(new EventRouter(profile_, ExtensionPrefs::Get(profile_))); | 103 event_router_.reset(new EventRouter(profile_, ExtensionPrefs::Get(profile_))); |
| 105 // Two state stores. The latter, which contains declarative rules, must be | 104 // Two state stores. The latter, which contains declarative rules, must be |
| 106 // loaded immediately so that the rules are ready before we issue network | 105 // loaded immediately so that the rules are ready before we issue network |
| 107 // requests. | 106 // requests. |
| 108 state_store_.reset(new StateStore( | 107 state_store_.reset(new StateStore( |
| 109 profile_, | 108 profile_, |
| 110 profile_->GetPath().AppendASCII(extensions::kStateStoreName), | 109 profile_->GetPath().AppendASCII(extensions::kStateStoreName), |
| 111 true)); | 110 true)); |
| 112 state_store_notification_observer_.reset( | 111 state_store_notification_observer_.reset( |
| 113 new StateStoreNotificationObserver(state_store_.get())); | 112 new StateStoreNotificationObserver(state_store_.get())); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 ExtensionSystemImpl::Shared::declarative_user_script_manager() { | 433 ExtensionSystemImpl::Shared::declarative_user_script_manager() { |
| 435 return declarative_user_script_manager_.get(); | 434 return declarative_user_script_manager_.get(); |
| 436 } | 435 } |
| 437 | 436 |
| 438 InfoMap* ExtensionSystemImpl::Shared::info_map() { | 437 InfoMap* ExtensionSystemImpl::Shared::info_map() { |
| 439 if (!extension_info_map_.get()) | 438 if (!extension_info_map_.get()) |
| 440 extension_info_map_ = new InfoMap(); | 439 extension_info_map_ = new InfoMap(); |
| 441 return extension_info_map_.get(); | 440 return extension_info_map_.get(); |
| 442 } | 441 } |
| 443 | 442 |
| 444 LazyBackgroundTaskQueue* | |
| 445 ExtensionSystemImpl::Shared::lazy_background_task_queue() { | |
| 446 return lazy_background_task_queue_.get(); | |
| 447 } | |
| 448 | |
| 449 EventRouter* ExtensionSystemImpl::Shared::event_router() { | 443 EventRouter* ExtensionSystemImpl::Shared::event_router() { |
| 450 return event_router_.get(); | 444 return event_router_.get(); |
| 451 } | 445 } |
| 452 | 446 |
| 453 InstallVerifier* ExtensionSystemImpl::Shared::install_verifier() { | 447 InstallVerifier* ExtensionSystemImpl::Shared::install_verifier() { |
| 454 return install_verifier_.get(); | 448 return install_verifier_.get(); |
| 455 } | 449 } |
| 456 | 450 |
| 457 QuotaService* ExtensionSystemImpl::Shared::quota_service() { | 451 QuotaService* ExtensionSystemImpl::Shared::quota_service() { |
| 458 return quota_service_.get(); | 452 return quota_service_.get(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 StateStore* ExtensionSystemImpl::state_store() { | 510 StateStore* ExtensionSystemImpl::state_store() { |
| 517 return shared_->state_store(); | 511 return shared_->state_store(); |
| 518 } | 512 } |
| 519 | 513 |
| 520 StateStore* ExtensionSystemImpl::rules_store() { | 514 StateStore* ExtensionSystemImpl::rules_store() { |
| 521 return shared_->rules_store(); | 515 return shared_->rules_store(); |
| 522 } | 516 } |
| 523 | 517 |
| 524 InfoMap* ExtensionSystemImpl::info_map() { return shared_->info_map(); } | 518 InfoMap* ExtensionSystemImpl::info_map() { return shared_->info_map(); } |
| 525 | 519 |
| 526 LazyBackgroundTaskQueue* ExtensionSystemImpl::lazy_background_task_queue() { | |
| 527 return shared_->lazy_background_task_queue(); | |
| 528 } | |
| 529 | |
| 530 EventRouter* ExtensionSystemImpl::event_router() { | 520 EventRouter* ExtensionSystemImpl::event_router() { |
| 531 return shared_->event_router(); | 521 return shared_->event_router(); |
| 532 } | 522 } |
| 533 | 523 |
| 534 const OneShotEvent& ExtensionSystemImpl::ready() const { | 524 const OneShotEvent& ExtensionSystemImpl::ready() const { |
| 535 return shared_->ready(); | 525 return shared_->ready(); |
| 536 } | 526 } |
| 537 | 527 |
| 538 InstallVerifier* ExtensionSystemImpl::install_verifier() { | 528 InstallVerifier* ExtensionSystemImpl::install_verifier() { |
| 539 return shared_->install_verifier(); | 529 return shared_->install_verifier(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 574 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
| 585 const std::string& extension_id, | 575 const std::string& extension_id, |
| 586 const UnloadedExtensionInfo::Reason reason) { | 576 const UnloadedExtensionInfo::Reason reason) { |
| 587 BrowserThread::PostTask( | 577 BrowserThread::PostTask( |
| 588 BrowserThread::IO, | 578 BrowserThread::IO, |
| 589 FROM_HERE, | 579 FROM_HERE, |
| 590 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); | 580 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); |
| 591 } | 581 } |
| 592 | 582 |
| 593 } // namespace extensions | 583 } // namespace extensions |
| OLD | NEW |