| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { | 128 void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { |
| 129 TRACE_EVENT0("browser,startup", "ExtensionSystemImpl::Shared::Init"); | 129 TRACE_EVENT0("browser,startup", "ExtensionSystemImpl::Shared::Init"); |
| 130 const base::CommandLine* command_line = | 130 const base::CommandLine* command_line = |
| 131 base::CommandLine::ForCurrentProcess(); | 131 base::CommandLine::ForCurrentProcess(); |
| 132 | 132 |
| 133 navigation_observer_.reset(new NavigationObserver(profile_)); | 133 navigation_observer_.reset(new NavigationObserver(profile_)); |
| 134 | 134 |
| 135 bool allow_noisy_errors = !command_line->HasSwitch(switches::kNoErrorDialogs); | 135 bool allow_noisy_errors = !command_line->HasSwitch(switches::kNoErrorDialogs); |
| 136 ExtensionErrorReporter::Init(allow_noisy_errors); | 136 ExtensionErrorReporter::Init(allow_noisy_errors); |
| 137 | 137 |
| 138 content_verifier_ = new ContentVerifier( |
| 139 profile_, new ChromeContentVerifierDelegate(profile_)); |
| 140 |
| 138 shared_user_script_master_.reset(new SharedUserScriptMaster(profile_)); | 141 shared_user_script_master_.reset(new SharedUserScriptMaster(profile_)); |
| 139 | 142 |
| 140 // ExtensionService depends on RuntimeData. | 143 // ExtensionService depends on RuntimeData. |
| 141 runtime_data_.reset(new RuntimeData(ExtensionRegistry::Get(profile_))); | 144 runtime_data_.reset(new RuntimeData(ExtensionRegistry::Get(profile_))); |
| 142 | 145 |
| 143 bool autoupdate_enabled = !profile_->IsGuestSession() && | 146 bool autoupdate_enabled = !profile_->IsGuestSession() && |
| 144 !profile_->IsSystemProfile(); | 147 !profile_->IsSystemProfile(); |
| 145 #if defined(OS_CHROMEOS) | 148 #if defined(OS_CHROMEOS) |
| 146 if (!extensions_enabled) | 149 if (!extensions_enabled) |
| 147 autoupdate_enabled = false; | 150 autoupdate_enabled = false; |
| 148 #endif // defined(OS_CHROMEOS) | 151 #endif // defined(OS_CHROMEOS) |
| 149 extension_service_.reset(new ExtensionService( | 152 extension_service_.reset(new ExtensionService( |
| 150 profile_, base::CommandLine::ForCurrentProcess(), | 153 profile_, base::CommandLine::ForCurrentProcess(), |
| 151 profile_->GetPath().AppendASCII(extensions::kInstallDirectoryName), | 154 profile_->GetPath().AppendASCII(extensions::kInstallDirectoryName), |
| 152 ExtensionPrefs::Get(profile_), Blacklist::Get(profile_), | 155 ExtensionPrefs::Get(profile_), Blacklist::Get(profile_), |
| 153 autoupdate_enabled, extensions_enabled, &ready_)); | 156 autoupdate_enabled, extensions_enabled, &ready_)); |
| 154 | 157 |
| 155 // These services must be registered before the ExtensionService tries to | 158 // These services must be registered before the ExtensionService tries to |
| 156 // load any extensions. | 159 // load any extensions. |
| 157 { | 160 { |
| 158 InstallVerifier::Get(profile_)->Init(); | 161 InstallVerifier::Get(profile_)->Init(); |
| 159 content_verifier_ = new ContentVerifier( | |
| 160 profile_, new ChromeContentVerifierDelegate(profile_)); | |
| 161 ContentVerifierDelegate::Mode mode = | 162 ContentVerifierDelegate::Mode mode = |
| 162 ChromeContentVerifierDelegate::GetDefaultMode(); | 163 ChromeContentVerifierDelegate::GetDefaultMode(); |
| 163 #if defined(OS_CHROMEOS) | 164 #if defined(OS_CHROMEOS) |
| 164 mode = std::max(mode, ContentVerifierDelegate::BOOTSTRAP); | 165 mode = std::max(mode, ContentVerifierDelegate::BOOTSTRAP); |
| 165 #endif // defined(OS_CHROMEOS) | 166 #endif // defined(OS_CHROMEOS) |
| 166 if (mode >= ContentVerifierDelegate::BOOTSTRAP) | 167 if (mode >= ContentVerifierDelegate::BOOTSTRAP) |
| 167 content_verifier_->Start(); | 168 content_verifier_->Start(); |
| 168 info_map()->SetContentVerifier(content_verifier_.get()); | 169 info_map()->SetContentVerifier(content_verifier_.get()); |
| 169 | 170 |
| 170 management_policy_.reset(new ManagementPolicy); | 171 management_policy_.reset(new ManagementPolicy); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( | 379 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( |
| 379 const std::string& extension_id, | 380 const std::string& extension_id, |
| 380 const UnloadedExtensionInfo::Reason reason) { | 381 const UnloadedExtensionInfo::Reason reason) { |
| 381 BrowserThread::PostTask( | 382 BrowserThread::PostTask( |
| 382 BrowserThread::IO, | 383 BrowserThread::IO, |
| 383 FROM_HERE, | 384 FROM_HERE, |
| 384 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); | 385 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); |
| 385 } | 386 } |
| 386 | 387 |
| 387 } // namespace extensions | 388 } // namespace extensions |
| OLD | NEW |