| 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 "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/content_settings/cookie_settings.h" | 18 #include "chrome/browser/content_settings/cookie_settings.h" |
| 19 #include "chrome/browser/extensions/component_loader.h" | 19 #include "chrome/browser/extensions/component_loader.h" |
| 20 #include "chrome/browser/extensions/extension_error_reporter.h" | 20 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 21 #include "chrome/browser/extensions/extension_management.h" | 21 #include "chrome/browser/extensions/extension_management.h" |
| 22 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
| 23 #include "chrome/browser/extensions/extension_system_factory.h" | 23 #include "chrome/browser/extensions/extension_system_factory.h" |
| 24 #include "chrome/browser/extensions/extension_util.h" | 24 #include "chrome/browser/extensions/extension_util.h" |
| 25 #include "chrome/browser/extensions/install_verifier.h" | 25 #include "chrome/browser/extensions/install_verifier.h" |
| 26 #include "chrome/browser/extensions/navigation_observer.h" | 26 #include "chrome/browser/extensions/navigation_observer.h" |
| 27 #include "chrome/browser/extensions/shared_module_service.h" | 27 #include "chrome/browser/extensions/shared_module_service.h" |
| 28 #include "chrome/browser/extensions/shared_user_script_master.h" | 28 #include "chrome/browser/extensions/shared_user_script_master.h" |
| 29 #include "chrome/browser/extensions/sidebar_manager.h" |
| 29 #include "chrome/browser/extensions/state_store_notification_observer.h" | 30 #include "chrome/browser/extensions/state_store_notification_observer.h" |
| 30 #include "chrome/browser/extensions/unpacked_installer.h" | 31 #include "chrome/browser/extensions/unpacked_installer.h" |
| 31 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
| 32 #include "chrome/browser/profiles/profile_manager.h" | 33 #include "chrome/browser/profiles/profile_manager.h" |
| 33 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 34 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 34 #include "chrome/common/chrome_switches.h" | 35 #include "chrome/common/chrome_switches.h" |
| 35 #include "chrome/common/chrome_version_info.h" | 36 #include "chrome/common/chrome_version_info.h" |
| 36 #include "chrome/common/extensions/extension_constants.h" | 37 #include "chrome/common/extensions/extension_constants.h" |
| 37 #include "chrome/common/extensions/features/feature_channel.h" | 38 #include "chrome/common/extensions/features/feature_channel.h" |
| 38 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 base::StringTokenizerT<base::CommandLine::StringType, | 400 base::StringTokenizerT<base::CommandLine::StringType, |
| 400 base::CommandLine::StringType::const_iterator> | 401 base::CommandLine::StringType::const_iterator> |
| 401 t(path_list, FILE_PATH_LITERAL(",")); | 402 t(path_list, FILE_PATH_LITERAL(",")); |
| 402 while (t.GetNext()) { | 403 while (t.GetNext()) { |
| 403 std::string extension_id; | 404 std::string extension_id; |
| 404 UnpackedInstaller::Create(extension_service_.get())-> | 405 UnpackedInstaller::Create(extension_service_.get())-> |
| 405 LoadFromCommandLine(base::FilePath(t.token()), &extension_id); | 406 LoadFromCommandLine(base::FilePath(t.token()), &extension_id); |
| 406 } | 407 } |
| 407 } | 408 } |
| 408 } | 409 } |
| 410 |
| 411 sidebar_manager_.reset(new SidebarManager()); |
| 409 } | 412 } |
| 410 | 413 |
| 411 void ExtensionSystemImpl::Shared::Shutdown() { | 414 void ExtensionSystemImpl::Shared::Shutdown() { |
| 412 if (content_verifier_.get()) | 415 if (content_verifier_.get()) |
| 413 content_verifier_->Shutdown(); | 416 content_verifier_->Shutdown(); |
| 414 if (extension_service_) | 417 if (extension_service_) |
| 415 extension_service_->Shutdown(); | 418 extension_service_->Shutdown(); |
| 416 } | 419 } |
| 417 | 420 |
| 418 StateStore* ExtensionSystemImpl::Shared::state_store() { | 421 StateStore* ExtensionSystemImpl::Shared::state_store() { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 447 } | 450 } |
| 448 | 451 |
| 449 QuotaService* ExtensionSystemImpl::Shared::quota_service() { | 452 QuotaService* ExtensionSystemImpl::Shared::quota_service() { |
| 450 return quota_service_.get(); | 453 return quota_service_.get(); |
| 451 } | 454 } |
| 452 | 455 |
| 453 ContentVerifier* ExtensionSystemImpl::Shared::content_verifier() { | 456 ContentVerifier* ExtensionSystemImpl::Shared::content_verifier() { |
| 454 return content_verifier_.get(); | 457 return content_verifier_.get(); |
| 455 } | 458 } |
| 456 | 459 |
| 460 SidebarManager* ExtensionSystemImpl::Shared::sidebar_manager() { |
| 461 return sidebar_manager_.get(); |
| 462 } |
| 463 |
| 457 // | 464 // |
| 458 // ExtensionSystemImpl | 465 // ExtensionSystemImpl |
| 459 // | 466 // |
| 460 | 467 |
| 461 ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile) | 468 ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile) |
| 462 : profile_(profile) { | 469 : profile_(profile) { |
| 463 shared_ = ExtensionSystemSharedFactory::GetForBrowserContext(profile); | 470 shared_ = ExtensionSystemSharedFactory::GetForBrowserContext(profile); |
| 464 | 471 |
| 465 if (!profile->IsOffTheRecord()) { | 472 if (!profile->IsOffTheRecord()) { |
| 466 shared_->InitPrefs(); | 473 shared_->InitPrefs(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 | 565 |
| 559 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 566 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
| 560 const std::string& extension_id, | 567 const std::string& extension_id, |
| 561 const UnloadedExtensionInfo::Reason reason) { | 568 const UnloadedExtensionInfo::Reason reason) { |
| 562 BrowserThread::PostTask( | 569 BrowserThread::PostTask( |
| 563 BrowserThread::IO, | 570 BrowserThread::IO, |
| 564 FROM_HERE, | 571 FROM_HERE, |
| 565 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); | 572 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); |
| 566 } | 573 } |
| 567 | 574 |
| 575 SidebarManager* ExtensionSystemImpl::sidebar_manager() { |
| 576 return shared_->sidebar_manager(); |
| 577 } |
| 578 |
| 568 } // namespace extensions | 579 } // namespace extensions |
| OLD | NEW |