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