| 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 21 matching lines...) Expand all Loading... |
| 32 #include "chrome/browser/profiles/profile_manager.h" | 32 #include "chrome/browser/profiles/profile_manager.h" |
| 33 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 33 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 34 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
| 35 #include "chrome/common/chrome_version_info.h" | 35 #include "chrome/common/chrome_version_info.h" |
| 36 #include "chrome/common/extensions/extension_constants.h" | 36 #include "chrome/common/extensions/extension_constants.h" |
| 37 #include "chrome/common/extensions/features/feature_channel.h" | 37 #include "chrome/common/extensions/features/feature_channel.h" |
| 38 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
| 39 #include "content/public/browser/url_data_source.h" | 39 #include "content/public/browser/url_data_source.h" |
| 40 #include "extensions/browser/content_verifier.h" | 40 #include "extensions/browser/content_verifier.h" |
| 41 #include "extensions/browser/content_verifier_delegate.h" | 41 #include "extensions/browser/content_verifier_delegate.h" |
| 42 #include "extensions/browser/declarative_user_script_manager.h" | |
| 43 #include "extensions/browser/event_router.h" | 42 #include "extensions/browser/event_router.h" |
| 44 #include "extensions/browser/extension_pref_store.h" | 43 #include "extensions/browser/extension_pref_store.h" |
| 45 #include "extensions/browser/extension_pref_value_map.h" | 44 #include "extensions/browser/extension_pref_value_map.h" |
| 46 #include "extensions/browser/extension_pref_value_map_factory.h" | 45 #include "extensions/browser/extension_pref_value_map_factory.h" |
| 47 #include "extensions/browser/extension_prefs.h" | 46 #include "extensions/browser/extension_prefs.h" |
| 48 #include "extensions/browser/extension_registry.h" | 47 #include "extensions/browser/extension_registry.h" |
| 49 #include "extensions/browser/info_map.h" | 48 #include "extensions/browser/info_map.h" |
| 50 #include "extensions/browser/lazy_background_task_queue.h" | 49 #include "extensions/browser/lazy_background_task_queue.h" |
| 51 #include "extensions/browser/management_policy.h" | 50 #include "extensions/browser/management_policy.h" |
| 52 #include "extensions/browser/quota_service.h" | 51 #include "extensions/browser/quota_service.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 TRACE_EVENT0("browser,startup", "ExtensionSystemImpl::Shared::Init"); | 296 TRACE_EVENT0("browser,startup", "ExtensionSystemImpl::Shared::Init"); |
| 298 const base::CommandLine* command_line = | 297 const base::CommandLine* command_line = |
| 299 base::CommandLine::ForCurrentProcess(); | 298 base::CommandLine::ForCurrentProcess(); |
| 300 | 299 |
| 301 navigation_observer_.reset(new NavigationObserver(profile_)); | 300 navigation_observer_.reset(new NavigationObserver(profile_)); |
| 302 | 301 |
| 303 bool allow_noisy_errors = !command_line->HasSwitch(switches::kNoErrorDialogs); | 302 bool allow_noisy_errors = !command_line->HasSwitch(switches::kNoErrorDialogs); |
| 304 ExtensionErrorReporter::Init(allow_noisy_errors); | 303 ExtensionErrorReporter::Init(allow_noisy_errors); |
| 305 | 304 |
| 306 shared_user_script_master_.reset(new SharedUserScriptMaster(profile_)); | 305 shared_user_script_master_.reset(new SharedUserScriptMaster(profile_)); |
| 307 declarative_user_script_manager_.reset( | |
| 308 new DeclarativeUserScriptManager(profile_)); | |
| 309 | 306 |
| 310 // ExtensionService depends on RuntimeData. | 307 // ExtensionService depends on RuntimeData. |
| 311 runtime_data_.reset(new RuntimeData(ExtensionRegistry::Get(profile_))); | 308 runtime_data_.reset(new RuntimeData(ExtensionRegistry::Get(profile_))); |
| 312 | 309 |
| 313 bool autoupdate_enabled = !profile_->IsGuestSession(); | 310 bool autoupdate_enabled = !profile_->IsGuestSession(); |
| 314 #if defined(OS_CHROMEOS) | 311 #if defined(OS_CHROMEOS) |
| 315 if (!extensions_enabled) | 312 if (!extensions_enabled) |
| 316 autoupdate_enabled = false; | 313 autoupdate_enabled = false; |
| 317 #endif // defined(OS_CHROMEOS) | 314 #endif // defined(OS_CHROMEOS) |
| 318 extension_service_.reset(new ExtensionService( | 315 extension_service_.reset(new ExtensionService( |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 | 420 |
| 424 ManagementPolicy* ExtensionSystemImpl::Shared::management_policy() { | 421 ManagementPolicy* ExtensionSystemImpl::Shared::management_policy() { |
| 425 return management_policy_.get(); | 422 return management_policy_.get(); |
| 426 } | 423 } |
| 427 | 424 |
| 428 SharedUserScriptMaster* | 425 SharedUserScriptMaster* |
| 429 ExtensionSystemImpl::Shared::shared_user_script_master() { | 426 ExtensionSystemImpl::Shared::shared_user_script_master() { |
| 430 return shared_user_script_master_.get(); | 427 return shared_user_script_master_.get(); |
| 431 } | 428 } |
| 432 | 429 |
| 433 DeclarativeUserScriptManager* | |
| 434 ExtensionSystemImpl::Shared::declarative_user_script_manager() { | |
| 435 return declarative_user_script_manager_.get(); | |
| 436 } | |
| 437 | |
| 438 InfoMap* ExtensionSystemImpl::Shared::info_map() { | 430 InfoMap* ExtensionSystemImpl::Shared::info_map() { |
| 439 if (!extension_info_map_.get()) | 431 if (!extension_info_map_.get()) |
| 440 extension_info_map_ = new InfoMap(); | 432 extension_info_map_ = new InfoMap(); |
| 441 return extension_info_map_.get(); | 433 return extension_info_map_.get(); |
| 442 } | 434 } |
| 443 | 435 |
| 444 LazyBackgroundTaskQueue* | 436 LazyBackgroundTaskQueue* |
| 445 ExtensionSystemImpl::Shared::lazy_background_task_queue() { | 437 ExtensionSystemImpl::Shared::lazy_background_task_queue() { |
| 446 return lazy_background_task_queue_.get(); | 438 return lazy_background_task_queue_.get(); |
| 447 } | 439 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 } | 493 } |
| 502 | 494 |
| 503 ManagementPolicy* ExtensionSystemImpl::management_policy() { | 495 ManagementPolicy* ExtensionSystemImpl::management_policy() { |
| 504 return shared_->management_policy(); | 496 return shared_->management_policy(); |
| 505 } | 497 } |
| 506 | 498 |
| 507 SharedUserScriptMaster* ExtensionSystemImpl::shared_user_script_master() { | 499 SharedUserScriptMaster* ExtensionSystemImpl::shared_user_script_master() { |
| 508 return shared_->shared_user_script_master(); | 500 return shared_->shared_user_script_master(); |
| 509 } | 501 } |
| 510 | 502 |
| 511 DeclarativeUserScriptManager* | |
| 512 ExtensionSystemImpl::declarative_user_script_manager() { | |
| 513 return shared_->declarative_user_script_manager(); | |
| 514 } | |
| 515 | |
| 516 StateStore* ExtensionSystemImpl::state_store() { | 503 StateStore* ExtensionSystemImpl::state_store() { |
| 517 return shared_->state_store(); | 504 return shared_->state_store(); |
| 518 } | 505 } |
| 519 | 506 |
| 520 StateStore* ExtensionSystemImpl::rules_store() { | 507 StateStore* ExtensionSystemImpl::rules_store() { |
| 521 return shared_->rules_store(); | 508 return shared_->rules_store(); |
| 522 } | 509 } |
| 523 | 510 |
| 524 InfoMap* ExtensionSystemImpl::info_map() { return shared_->info_map(); } | 511 InfoMap* ExtensionSystemImpl::info_map() { return shared_->info_map(); } |
| 525 | 512 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 571 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
| 585 const std::string& extension_id, | 572 const std::string& extension_id, |
| 586 const UnloadedExtensionInfo::Reason reason) { | 573 const UnloadedExtensionInfo::Reason reason) { |
| 587 BrowserThread::PostTask( | 574 BrowserThread::PostTask( |
| 588 BrowserThread::IO, | 575 BrowserThread::IO, |
| 589 FROM_HERE, | 576 FROM_HERE, |
| 590 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); | 577 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); |
| 591 } | 578 } |
| 592 | 579 |
| 593 } // namespace extensions | 580 } // namespace extensions |
| OLD | NEW |