Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: chrome/browser/extensions/extension_system_impl.cc

Issue 407043002: Content Verification: Don't access UI-thread objects on the IO thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added DCHECK Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/user_script_master.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 replacements.SetQuery(query.c_str(), url::Component(0, query.length())); 215 replacements.SetQuery(query.c_str(), url::Component(0, query.length()));
216 return base_url.ReplaceComponents(replacements); 216 return base_url.ReplaceComponents(replacements);
217 } 217 }
218 218
219 virtual std::set<base::FilePath> GetBrowserImagePaths( 219 virtual std::set<base::FilePath> GetBrowserImagePaths(
220 const extensions::Extension* extension) OVERRIDE { 220 const extensions::Extension* extension) OVERRIDE {
221 return extension_file_util::GetBrowserImagePaths(extension); 221 return extension_file_util::GetBrowserImagePaths(extension);
222 } 222 }
223 223
224 virtual void VerifyFailed(const std::string& extension_id) OVERRIDE { 224 virtual void VerifyFailed(const std::string& extension_id) OVERRIDE {
225 if (service_) 225 if (!service_)
226 return;
227 ExtensionRegistry* registry = ExtensionRegistry::Get(service_->profile());
228 const Extension* extension =
229 registry->GetExtensionById(extension_id, ExtensionRegistry::EVERYTHING);
230 if (!extension)
231 return;
232 Mode mode = ShouldBeVerified(*extension);
233 if (mode >= ContentVerifierDelegate::ENFORCE)
226 service_->DisableExtension(extension_id, Extension::DISABLE_CORRUPTED); 234 service_->DisableExtension(extension_id, Extension::DISABLE_CORRUPTED);
227 } 235 }
228 236
229 static Mode GetDefaultMode() { 237 static Mode GetDefaultMode() {
230 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 238 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
231 239
232 Mode experiment_value = NONE; 240 Mode experiment_value = NONE;
233 const std::string group = base::FieldTrialList::FindFullName( 241 const std::string group = base::FieldTrialList::FindFullName(
234 kContentVerificationExperimentName); 242 kContentVerificationExperimentName);
235 if (group == "EnforceStrict") 243 if (group == "EnforceStrict")
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 install_verifier_.reset( 325 install_verifier_.reset(
318 new InstallVerifier(ExtensionPrefs::Get(profile_), profile_)); 326 new InstallVerifier(ExtensionPrefs::Get(profile_), profile_));
319 install_verifier_->Init(); 327 install_verifier_->Init();
320 content_verifier_ = new ContentVerifier( 328 content_verifier_ = new ContentVerifier(
321 profile_, new ContentVerifierDelegateImpl(extension_service_.get())); 329 profile_, new ContentVerifierDelegateImpl(extension_service_.get()));
322 ContentVerifierDelegate::Mode mode = 330 ContentVerifierDelegate::Mode mode =
323 ContentVerifierDelegateImpl::GetDefaultMode(); 331 ContentVerifierDelegateImpl::GetDefaultMode();
324 #if defined(OS_CHROMEOS) 332 #if defined(OS_CHROMEOS)
325 mode = std::max(mode, ContentVerifierDelegate::BOOTSTRAP); 333 mode = std::max(mode, ContentVerifierDelegate::BOOTSTRAP);
326 #endif 334 #endif
327 if (mode > ContentVerifierDelegate::BOOTSTRAP) 335 if (mode >= ContentVerifierDelegate::BOOTSTRAP)
328 content_verifier_->Start(); 336 content_verifier_->Start();
329 info_map()->SetContentVerifier(content_verifier_.get()); 337 info_map()->SetContentVerifier(content_verifier_.get());
330 338
331 management_policy_.reset(new ManagementPolicy); 339 management_policy_.reset(new ManagementPolicy);
332 RegisterManagementPolicyProviders(); 340 RegisterManagementPolicyProviders();
333 } 341 }
334 342
335 bool skip_session_extensions = false; 343 bool skip_session_extensions = false;
336 #if defined(OS_CHROMEOS) 344 #if defined(OS_CHROMEOS)
337 // Skip loading session extensions if we are not in a user session. 345 // Skip loading session extensions if we are not in a user session.
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( 620 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts(
613 const std::string& extension_id, 621 const std::string& extension_id,
614 const UnloadedExtensionInfo::Reason reason) { 622 const UnloadedExtensionInfo::Reason reason) {
615 BrowserThread::PostTask( 623 BrowserThread::PostTask(
616 BrowserThread::IO, 624 BrowserThread::IO,
617 FROM_HERE, 625 FROM_HERE,
618 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); 626 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
619 } 627 }
620 628
621 } // namespace extensions 629 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/user_script_master.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698