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

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

Issue 1226163010: Fix content verifier problem with content scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merged latest head Created 5 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
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) { 123 void ExtensionSystemImpl::Shared::Init(bool extensions_enabled) {
124 TRACE_EVENT0("browser,startup", "ExtensionSystemImpl::Shared::Init"); 124 TRACE_EVENT0("browser,startup", "ExtensionSystemImpl::Shared::Init");
125 const base::CommandLine* command_line = 125 const base::CommandLine* command_line =
126 base::CommandLine::ForCurrentProcess(); 126 base::CommandLine::ForCurrentProcess();
127 127
128 navigation_observer_.reset(new NavigationObserver(profile_)); 128 navigation_observer_.reset(new NavigationObserver(profile_));
129 129
130 bool allow_noisy_errors = !command_line->HasSwitch(switches::kNoErrorDialogs); 130 bool allow_noisy_errors = !command_line->HasSwitch(switches::kNoErrorDialogs);
131 ExtensionErrorReporter::Init(allow_noisy_errors); 131 ExtensionErrorReporter::Init(allow_noisy_errors);
132 132
133 content_verifier_ = new ContentVerifier(
134 profile_, new ChromeContentVerifierDelegate(profile_));
135
133 shared_user_script_master_.reset(new SharedUserScriptMaster(profile_)); 136 shared_user_script_master_.reset(new SharedUserScriptMaster(profile_));
134 137
135 // ExtensionService depends on RuntimeData. 138 // ExtensionService depends on RuntimeData.
136 runtime_data_.reset(new RuntimeData(ExtensionRegistry::Get(profile_))); 139 runtime_data_.reset(new RuntimeData(ExtensionRegistry::Get(profile_)));
137 140
138 bool autoupdate_enabled = !profile_->IsGuestSession() && 141 bool autoupdate_enabled = !profile_->IsGuestSession() &&
139 !profile_->IsSystemProfile(); 142 !profile_->IsSystemProfile();
140 #if defined(OS_CHROMEOS) 143 #if defined(OS_CHROMEOS)
141 if (!extensions_enabled) 144 if (!extensions_enabled)
142 autoupdate_enabled = false; 145 autoupdate_enabled = false;
143 #endif // defined(OS_CHROMEOS) 146 #endif // defined(OS_CHROMEOS)
144 extension_service_.reset(new ExtensionService( 147 extension_service_.reset(new ExtensionService(
145 profile_, base::CommandLine::ForCurrentProcess(), 148 profile_, base::CommandLine::ForCurrentProcess(),
146 profile_->GetPath().AppendASCII(extensions::kInstallDirectoryName), 149 profile_->GetPath().AppendASCII(extensions::kInstallDirectoryName),
147 ExtensionPrefs::Get(profile_), Blacklist::Get(profile_), 150 ExtensionPrefs::Get(profile_), Blacklist::Get(profile_),
148 autoupdate_enabled, extensions_enabled, &ready_)); 151 autoupdate_enabled, extensions_enabled, &ready_));
149 152
150 // These services must be registered before the ExtensionService tries to 153 // These services must be registered before the ExtensionService tries to
151 // load any extensions. 154 // load any extensions.
152 { 155 {
153 InstallVerifier::Get(profile_)->Init(); 156 InstallVerifier::Get(profile_)->Init();
154 content_verifier_ = new ContentVerifier(
155 profile_, new ChromeContentVerifierDelegate(profile_));
156 ContentVerifierDelegate::Mode mode = 157 ContentVerifierDelegate::Mode mode =
157 ChromeContentVerifierDelegate::GetDefaultMode(); 158 ChromeContentVerifierDelegate::GetDefaultMode();
158 #if defined(OS_CHROMEOS) 159 #if defined(OS_CHROMEOS)
159 mode = std::max(mode, ContentVerifierDelegate::BOOTSTRAP); 160 mode = std::max(mode, ContentVerifierDelegate::BOOTSTRAP);
160 #endif // defined(OS_CHROMEOS) 161 #endif // defined(OS_CHROMEOS)
161 if (mode >= ContentVerifierDelegate::BOOTSTRAP) 162 if (mode >= ContentVerifierDelegate::BOOTSTRAP)
162 content_verifier_->Start(); 163 content_verifier_->Start();
163 info_map()->SetContentVerifier(content_verifier_.get()); 164 info_map()->SetContentVerifier(content_verifier_.get());
164 165
165 management_policy_.reset(new ManagementPolicy); 166 management_policy_.reset(new ManagementPolicy);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( 374 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts(
374 const std::string& extension_id, 375 const std::string& extension_id,
375 const UnloadedExtensionInfo::Reason reason) { 376 const UnloadedExtensionInfo::Reason reason) {
376 BrowserThread::PostTask( 377 BrowserThread::PostTask(
377 BrowserThread::IO, 378 BrowserThread::IO,
378 FROM_HERE, 379 FROM_HERE,
379 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); 380 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
380 } 381 }
381 382
382 } // namespace extensions 383 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browsertest.cc ('k') | chrome/test/data/extensions/content_verifier/content_script.crx » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698