Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 ExtensionService* extension_service) { | 107 ExtensionService* extension_service) { |
| 108 DCHECK(extension_service); | 108 DCHECK(extension_service); |
| 109 return scoped_refptr<UnpackedInstaller>( | 109 return scoped_refptr<UnpackedInstaller>( |
| 110 new UnpackedInstaller(extension_service)); | 110 new UnpackedInstaller(extension_service)); |
| 111 } | 111 } |
| 112 | 112 |
| 113 UnpackedInstaller::UnpackedInstaller(ExtensionService* extension_service) | 113 UnpackedInstaller::UnpackedInstaller(ExtensionService* extension_service) |
| 114 : service_weak_(extension_service->AsWeakPtr()), | 114 : service_weak_(extension_service->AsWeakPtr()), |
| 115 prompt_for_plugins_(true), | 115 prompt_for_plugins_(true), |
| 116 require_modern_manifest_version_(true), | 116 require_modern_manifest_version_(true), |
| 117 be_noisy_on_failure_(true), | 117 be_noisy_on_failure_(false), |
|
Devlin
2014/06/24 22:21:12
Won't this potentially make other things which sho
gpdavis
2014/06/25 00:21:01
Yes, that is true. But do we ever want it to be n
Devlin
2014/06/25 19:49:36
We want this to be noisy whenever:
a) It is curren
| |
| 118 installer_(extension_service->profile()) { | 118 installer_(extension_service->profile()) { |
| 119 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 119 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 120 } | 120 } |
| 121 | 121 |
| 122 UnpackedInstaller::~UnpackedInstaller() { | 122 UnpackedInstaller::~UnpackedInstaller() { |
| 123 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || | 123 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || |
| 124 BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 124 BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void UnpackedInstaller::Load(const base::FilePath& path_in) { | 127 void UnpackedInstaller::Load(const base::FilePath& path_in) { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 } | 289 } |
| 290 | 290 |
| 291 BrowserThread::PostTask( | 291 BrowserThread::PostTask( |
| 292 BrowserThread::UI, | 292 BrowserThread::UI, |
| 293 FROM_HERE, | 293 FROM_HERE, |
| 294 base::Bind(&UnpackedInstaller::ShowInstallPrompt, this)); | 294 base::Bind(&UnpackedInstaller::ShowInstallPrompt, this)); |
| 295 } | 295 } |
| 296 | 296 |
| 297 void UnpackedInstaller::ReportExtensionLoadError(const std::string &error) { | 297 void UnpackedInstaller::ReportExtensionLoadError(const std::string &error) { |
| 298 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 298 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 299 if (!on_failure_callback_.is_null()) | 299 if (!on_failure_callback_.is_null()) |
|
Devlin
2014/06/24 22:21:12
I could be wrong, but I think the only class that
| |
| 300 on_failure_callback_.Run(extension_path_, error); | 300 on_failure_callback_.Run(extension_path_, error); |
| 301 | 301 |
| 302 if (service_weak_.get()) { | 302 if (service_weak_.get()) { |
| 303 ExtensionErrorReporter::GetInstance()->ReportLoadError( | 303 ExtensionErrorReporter::GetInstance()->ReportLoadError( |
| 304 extension_path_, | 304 extension_path_, |
| 305 error, | 305 error, |
| 306 service_weak_->profile(), | 306 service_weak_->profile(), |
| 307 be_noisy_on_failure_); | 307 be_noisy_on_failure_); |
| 308 } | 308 } |
| 309 } | 309 } |
| 310 | 310 |
| 311 void UnpackedInstaller::ConfirmInstall() { | 311 void UnpackedInstaller::ConfirmInstall() { |
| 312 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 312 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 313 base::string16 error = installer_.CheckManagementPolicy(); | 313 base::string16 error = installer_.CheckManagementPolicy(); |
| 314 if (!error.empty()) { | 314 if (!error.empty()) { |
| 315 ReportExtensionLoadError(base::UTF16ToUTF8(error)); | 315 ReportExtensionLoadError(base::UTF16ToUTF8(error)); |
| 316 return; | 316 return; |
| 317 } | 317 } |
| 318 | 318 |
| 319 PermissionsUpdater perms_updater(service_weak_->profile()); | 319 PermissionsUpdater perms_updater(service_weak_->profile()); |
| 320 perms_updater.GrantActivePermissions(installer_.extension().get()); | 320 perms_updater.GrantActivePermissions(installer_.extension().get()); |
| 321 | 321 |
| 322 service_weak_->OnExtensionInstalled(installer_.extension().get(), | 322 service_weak_->OnExtensionInstalled(installer_.extension().get(), |
| 323 syncer::StringOrdinal(), | 323 syncer::StringOrdinal(), |
| 324 kInstallFlagInstallImmediately); | 324 kInstallFlagInstallImmediately); |
| 325 } | 325 } |
| 326 | 326 |
| 327 } // namespace extensions | 327 } // namespace extensions |
| OLD | NEW |