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" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/strings/string_tokenizer.h" | 14 #include "base/strings/string_tokenizer.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/content_settings/cookie_settings.h" | 17 #include "chrome/browser/content_settings/cookie_settings.h" |
18 #include "chrome/browser/extensions/blacklist.h" | |
19 #include "chrome/browser/extensions/component_loader.h" | 18 #include "chrome/browser/extensions/component_loader.h" |
20 #include "chrome/browser/extensions/declarative_user_script_master.h" | 19 #include "chrome/browser/extensions/declarative_user_script_master.h" |
21 #include "chrome/browser/extensions/error_console/error_console.h" | 20 #include "chrome/browser/extensions/error_console/error_console.h" |
22 #include "chrome/browser/extensions/extension_error_reporter.h" | 21 #include "chrome/browser/extensions/extension_error_reporter.h" |
23 #include "chrome/browser/extensions/extension_management.h" | 22 #include "chrome/browser/extensions/extension_management.h" |
24 #include "chrome/browser/extensions/extension_service.h" | 23 #include "chrome/browser/extensions/extension_service.h" |
25 #include "chrome/browser/extensions/extension_system_factory.h" | 24 #include "chrome/browser/extensions/extension_system_factory.h" |
26 #include "chrome/browser/extensions/extension_util.h" | 25 #include "chrome/browser/extensions/extension_util.h" |
27 #include "chrome/browser/extensions/install_verifier.h" | 26 #include "chrome/browser/extensions/install_verifier.h" |
28 #include "chrome/browser/extensions/navigation_observer.h" | 27 #include "chrome/browser/extensions/navigation_observer.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 profile_->GetPath().AppendASCII(extensions::kStateStoreName), | 110 profile_->GetPath().AppendASCII(extensions::kStateStoreName), |
112 true)); | 111 true)); |
113 state_store_notification_observer_.reset( | 112 state_store_notification_observer_.reset( |
114 new StateStoreNotificationObserver(state_store_.get())); | 113 new StateStoreNotificationObserver(state_store_.get())); |
115 | 114 |
116 rules_store_.reset(new StateStore( | 115 rules_store_.reset(new StateStore( |
117 profile_, | 116 profile_, |
118 profile_->GetPath().AppendASCII(extensions::kRulesStoreName), | 117 profile_->GetPath().AppendASCII(extensions::kRulesStoreName), |
119 false)); | 118 false)); |
120 | 119 |
121 blacklist_.reset(new Blacklist(ExtensionPrefs::Get(profile_))); | |
122 | |
123 #if defined(OS_CHROMEOS) | 120 #if defined(OS_CHROMEOS) |
124 const user_manager::User* user = | 121 const user_manager::User* user = |
125 user_manager::UserManager::Get()->GetActiveUser(); | 122 user_manager::UserManager::Get()->GetActiveUser(); |
126 policy::DeviceLocalAccount::Type device_local_account_type; | 123 policy::DeviceLocalAccount::Type device_local_account_type; |
127 if (user && policy::IsDeviceLocalAccountUser(user->email(), | 124 if (user && policy::IsDeviceLocalAccountUser(user->email(), |
128 &device_local_account_type)) { | 125 &device_local_account_type)) { |
129 device_local_account_management_policy_provider_.reset( | 126 device_local_account_management_policy_provider_.reset( |
130 new chromeos::DeviceLocalAccountManagementPolicyProvider( | 127 new chromeos::DeviceLocalAccountManagementPolicyProvider( |
131 device_local_account_type)); | 128 device_local_account_type)); |
132 } | 129 } |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 bool autoupdate_enabled = !profile_->IsGuestSession(); | 309 bool autoupdate_enabled = !profile_->IsGuestSession(); |
313 #if defined(OS_CHROMEOS) | 310 #if defined(OS_CHROMEOS) |
314 if (!extensions_enabled) | 311 if (!extensions_enabled) |
315 autoupdate_enabled = false; | 312 autoupdate_enabled = false; |
316 #endif | 313 #endif |
317 extension_service_.reset(new ExtensionService( | 314 extension_service_.reset(new ExtensionService( |
318 profile_, | 315 profile_, |
319 CommandLine::ForCurrentProcess(), | 316 CommandLine::ForCurrentProcess(), |
320 profile_->GetPath().AppendASCII(extensions::kInstallDirectoryName), | 317 profile_->GetPath().AppendASCII(extensions::kInstallDirectoryName), |
321 ExtensionPrefs::Get(profile_), | 318 ExtensionPrefs::Get(profile_), |
322 blacklist_.get(), | 319 Blacklist::Get(profile_), |
323 autoupdate_enabled, | 320 autoupdate_enabled, |
324 extensions_enabled, | 321 extensions_enabled, |
325 &ready_)); | 322 &ready_)); |
326 | 323 |
327 // These services must be registered before the ExtensionService tries to | 324 // These services must be registered before the ExtensionService tries to |
328 // load any extensions. | 325 // load any extensions. |
329 { | 326 { |
330 install_verifier_.reset( | 327 install_verifier_.reset( |
331 new InstallVerifier(ExtensionPrefs::Get(profile_), profile_)); | 328 new InstallVerifier(ExtensionPrefs::Get(profile_), profile_)); |
332 install_verifier_->Init(); | 329 install_verifier_->Init(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 | 439 |
443 LazyBackgroundTaskQueue* | 440 LazyBackgroundTaskQueue* |
444 ExtensionSystemImpl::Shared::lazy_background_task_queue() { | 441 ExtensionSystemImpl::Shared::lazy_background_task_queue() { |
445 return lazy_background_task_queue_.get(); | 442 return lazy_background_task_queue_.get(); |
446 } | 443 } |
447 | 444 |
448 EventRouter* ExtensionSystemImpl::Shared::event_router() { | 445 EventRouter* ExtensionSystemImpl::Shared::event_router() { |
449 return event_router_.get(); | 446 return event_router_.get(); |
450 } | 447 } |
451 | 448 |
452 Blacklist* ExtensionSystemImpl::Shared::blacklist() { | |
453 return blacklist_.get(); | |
454 } | |
455 | |
456 ErrorConsole* ExtensionSystemImpl::Shared::error_console() { | 449 ErrorConsole* ExtensionSystemImpl::Shared::error_console() { |
457 return error_console_.get(); | 450 return error_console_.get(); |
458 } | 451 } |
459 | 452 |
460 InstallVerifier* ExtensionSystemImpl::Shared::install_verifier() { | 453 InstallVerifier* ExtensionSystemImpl::Shared::install_verifier() { |
461 return install_verifier_.get(); | 454 return install_verifier_.get(); |
462 } | 455 } |
463 | 456 |
464 QuotaService* ExtensionSystemImpl::Shared::quota_service() { | 457 QuotaService* ExtensionSystemImpl::Shared::quota_service() { |
465 return quota_service_.get(); | 458 return quota_service_.get(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 InfoMap* ExtensionSystemImpl::info_map() { return shared_->info_map(); } | 539 InfoMap* ExtensionSystemImpl::info_map() { return shared_->info_map(); } |
547 | 540 |
548 LazyBackgroundTaskQueue* ExtensionSystemImpl::lazy_background_task_queue() { | 541 LazyBackgroundTaskQueue* ExtensionSystemImpl::lazy_background_task_queue() { |
549 return shared_->lazy_background_task_queue(); | 542 return shared_->lazy_background_task_queue(); |
550 } | 543 } |
551 | 544 |
552 EventRouter* ExtensionSystemImpl::event_router() { | 545 EventRouter* ExtensionSystemImpl::event_router() { |
553 return shared_->event_router(); | 546 return shared_->event_router(); |
554 } | 547 } |
555 | 548 |
556 Blacklist* ExtensionSystemImpl::blacklist() { | |
557 return shared_->blacklist(); | |
558 } | |
559 | |
560 const OneShotEvent& ExtensionSystemImpl::ready() const { | 549 const OneShotEvent& ExtensionSystemImpl::ready() const { |
561 return shared_->ready(); | 550 return shared_->ready(); |
562 } | 551 } |
563 | 552 |
564 ErrorConsole* ExtensionSystemImpl::error_console() { | 553 ErrorConsole* ExtensionSystemImpl::error_console() { |
565 return shared_->error_console(); | 554 return shared_->error_console(); |
566 } | 555 } |
567 | 556 |
568 InstallVerifier* ExtensionSystemImpl::install_verifier() { | 557 InstallVerifier* ExtensionSystemImpl::install_verifier() { |
569 return shared_->install_verifier(); | 558 return shared_->install_verifier(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 609 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
621 const std::string& extension_id, | 610 const std::string& extension_id, |
622 const UnloadedExtensionInfo::Reason reason) { | 611 const UnloadedExtensionInfo::Reason reason) { |
623 BrowserThread::PostTask( | 612 BrowserThread::PostTask( |
624 BrowserThread::IO, | 613 BrowserThread::IO, |
625 FROM_HERE, | 614 FROM_HERE, |
626 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); | 615 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); |
627 } | 616 } |
628 | 617 |
629 } // namespace extensions | 618 } // namespace extensions |
OLD | NEW |