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

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

Issue 1243533005: Revert of Fix content verifier problem with content scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
136 shared_user_script_master_.reset(new SharedUserScriptMaster(profile_)); 133 shared_user_script_master_.reset(new SharedUserScriptMaster(profile_));
137 134
138 // ExtensionService depends on RuntimeData. 135 // ExtensionService depends on RuntimeData.
139 runtime_data_.reset(new RuntimeData(ExtensionRegistry::Get(profile_))); 136 runtime_data_.reset(new RuntimeData(ExtensionRegistry::Get(profile_)));
140 137
141 bool autoupdate_enabled = !profile_->IsGuestSession() && 138 bool autoupdate_enabled = !profile_->IsGuestSession() &&
142 !profile_->IsSystemProfile(); 139 !profile_->IsSystemProfile();
143 #if defined(OS_CHROMEOS) 140 #if defined(OS_CHROMEOS)
144 if (!extensions_enabled) 141 if (!extensions_enabled)
145 autoupdate_enabled = false; 142 autoupdate_enabled = false;
146 #endif // defined(OS_CHROMEOS) 143 #endif // defined(OS_CHROMEOS)
147 extension_service_.reset(new ExtensionService( 144 extension_service_.reset(new ExtensionService(
148 profile_, base::CommandLine::ForCurrentProcess(), 145 profile_, base::CommandLine::ForCurrentProcess(),
149 profile_->GetPath().AppendASCII(extensions::kInstallDirectoryName), 146 profile_->GetPath().AppendASCII(extensions::kInstallDirectoryName),
150 ExtensionPrefs::Get(profile_), Blacklist::Get(profile_), 147 ExtensionPrefs::Get(profile_), Blacklist::Get(profile_),
151 autoupdate_enabled, extensions_enabled, &ready_)); 148 autoupdate_enabled, extensions_enabled, &ready_));
152 149
153 // These services must be registered before the ExtensionService tries to 150 // These services must be registered before the ExtensionService tries to
154 // load any extensions. 151 // load any extensions.
155 { 152 {
156 InstallVerifier::Get(profile_)->Init(); 153 InstallVerifier::Get(profile_)->Init();
154 content_verifier_ = new ContentVerifier(
155 profile_, new ChromeContentVerifierDelegate(profile_));
157 ContentVerifierDelegate::Mode mode = 156 ContentVerifierDelegate::Mode mode =
158 ChromeContentVerifierDelegate::GetDefaultMode(); 157 ChromeContentVerifierDelegate::GetDefaultMode();
159 #if defined(OS_CHROMEOS) 158 #if defined(OS_CHROMEOS)
160 mode = std::max(mode, ContentVerifierDelegate::BOOTSTRAP); 159 mode = std::max(mode, ContentVerifierDelegate::BOOTSTRAP);
161 #endif // defined(OS_CHROMEOS) 160 #endif // defined(OS_CHROMEOS)
162 if (mode >= ContentVerifierDelegate::BOOTSTRAP) 161 if (mode >= ContentVerifierDelegate::BOOTSTRAP)
163 content_verifier_->Start(); 162 content_verifier_->Start();
164 info_map()->SetContentVerifier(content_verifier_.get()); 163 info_map()->SetContentVerifier(content_verifier_.get());
165 164
166 management_policy_.reset(new ManagementPolicy); 165 management_policy_.reset(new ManagementPolicy);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts( 373 void ExtensionSystemImpl::UnregisterExtensionWithRequestContexts(
375 const std::string& extension_id, 374 const std::string& extension_id,
376 const UnloadedExtensionInfo::Reason reason) { 375 const UnloadedExtensionInfo::Reason reason) {
377 BrowserThread::PostTask( 376 BrowserThread::PostTask(
378 BrowserThread::IO, 377 BrowserThread::IO,
379 FROM_HERE, 378 FROM_HERE,
380 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); 379 base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
381 } 380 }
382 381
383 } // namespace extensions 382 } // 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