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

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

Issue 263643005: Move ExtensionService::ReportExtensionLoadError to ExtensionErrorReporter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/unpacked_installer.h" 5 #include "chrome/browser/extensions/unpacked_installer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/threading/thread_restrictions.h" 13 #include "base/threading/thread_restrictions.h"
14 #include "chrome/browser/extensions/extension_error_reporter.h"
14 #include "chrome/browser/extensions/extension_install_prompt.h" 15 #include "chrome/browser/extensions/extension_install_prompt.h"
15 #include "chrome/browser/extensions/extension_install_ui.h" 16 #include "chrome/browser/extensions/extension_install_ui.h"
16 #include "chrome/browser/extensions/extension_service.h" 17 #include "chrome/browser/extensions/extension_service.h"
17 #include "chrome/browser/extensions/permissions_updater.h" 18 #include "chrome/browser/extensions/permissions_updater.h"
18 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/extensions/api/plugins/plugins_handler.h" 21 #include "chrome/common/extensions/api/plugins/plugins_handler.h"
21 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
22 #include "extensions/browser/extension_prefs.h" 23 #include "extensions/browser/extension_prefs.h"
23 #include "extensions/browser/extension_registry.h" 24 #include "extensions/browser/extension_registry.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 ExtensionService* extension_service) { 106 ExtensionService* extension_service) {
106 DCHECK(extension_service); 107 DCHECK(extension_service);
107 return scoped_refptr<UnpackedInstaller>( 108 return scoped_refptr<UnpackedInstaller>(
108 new UnpackedInstaller(extension_service)); 109 new UnpackedInstaller(extension_service));
109 } 110 }
110 111
111 UnpackedInstaller::UnpackedInstaller(ExtensionService* extension_service) 112 UnpackedInstaller::UnpackedInstaller(ExtensionService* extension_service)
112 : service_weak_(extension_service->AsWeakPtr()), 113 : service_weak_(extension_service->AsWeakPtr()),
113 prompt_for_plugins_(true), 114 prompt_for_plugins_(true),
114 require_modern_manifest_version_(true), 115 require_modern_manifest_version_(true),
116 be_noisy_on_failure_(true),
115 installer_(extension_service->profile()) { 117 installer_(extension_service->profile()) {
116 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 118 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
117 } 119 }
118 120
119 UnpackedInstaller::~UnpackedInstaller() { 121 UnpackedInstaller::~UnpackedInstaller() {
120 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || 122 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) ||
121 BrowserThread::CurrentlyOn(BrowserThread::FILE)); 123 BrowserThread::CurrentlyOn(BrowserThread::FILE));
122 } 124 }
123 125
124 void UnpackedInstaller::Load(const base::FilePath& path_in) { 126 void UnpackedInstaller::Load(const base::FilePath& path_in) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 BrowserThread::UI, 291 BrowserThread::UI,
290 FROM_HERE, 292 FROM_HERE,
291 base::Bind(&UnpackedInstaller::ShowInstallPrompt, this)); 293 base::Bind(&UnpackedInstaller::ShowInstallPrompt, this));
292 } 294 }
293 295
294 void UnpackedInstaller::ReportExtensionLoadError(const std::string &error) { 296 void UnpackedInstaller::ReportExtensionLoadError(const std::string &error) {
295 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 297 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
296 if (!on_failure_callback_.is_null()) 298 if (!on_failure_callback_.is_null())
297 on_failure_callback_.Run(extension_path_, error); 299 on_failure_callback_.Run(extension_path_, error);
298 300
299 if (service_weak_.get()) 301 if (service_weak_.get()) {
300 service_weak_->ReportExtensionLoadError(extension_path_, error); 302 ExtensionErrorReporter::GetInstance()->ReportLoadError(
303 extension_path_,
304 error,
305 service_weak_->profile(),
306 be_noisy_on_failure_);
307 }
301 } 308 }
302 309
303 void UnpackedInstaller::ConfirmInstall() { 310 void UnpackedInstaller::ConfirmInstall() {
304 DCHECK_CURRENTLY_ON(BrowserThread::UI); 311 DCHECK_CURRENTLY_ON(BrowserThread::UI);
305 base::string16 error = installer_.CheckManagementPolicy(); 312 base::string16 error = installer_.CheckManagementPolicy();
306 if (!error.empty()) { 313 if (!error.empty()) {
307 ReportExtensionLoadError(base::UTF16ToUTF8(error)); 314 ReportExtensionLoadError(base::UTF16ToUTF8(error));
308 return; 315 return;
309 } 316 }
310 317
311 PermissionsUpdater perms_updater(service_weak_->profile()); 318 PermissionsUpdater perms_updater(service_weak_->profile());
312 perms_updater.GrantActivePermissions(installer_.extension().get()); 319 perms_updater.GrantActivePermissions(installer_.extension().get());
313 320
314 service_weak_->OnExtensionInstalled( 321 service_weak_->OnExtensionInstalled(
315 installer_.extension().get(), 322 installer_.extension().get(),
316 syncer::StringOrdinal(), 323 syncer::StringOrdinal(),
317 false /* no requirement errors */, 324 false /* no requirement errors */,
318 NOT_BLACKLISTED, 325 NOT_BLACKLISTED,
319 false /* don't wait for idle */); 326 false /* don't wait for idle */);
320 } 327 }
321 328
322 } // namespace extensions 329 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/unpacked_installer.h ('k') | chrome/browser/ui/webui/extensions/extension_loader_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698