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 278 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()) | |
300 on_failure_callback_.Run(extension_path_, error); | |
301 | 299 |
302 if (service_weak_.get()) { | 300 if (service_weak_.get()) { |
303 ExtensionErrorReporter::GetInstance()->ReportLoadError( | 301 ExtensionErrorReporter::GetInstance()->ReportLoadError( |
304 extension_path_, | 302 extension_path_, |
305 error, | 303 error, |
306 service_weak_->profile(), | 304 service_weak_->profile(), |
307 be_noisy_on_failure_); | 305 be_noisy_on_failure_); |
308 } | 306 } |
309 } | 307 } |
310 | 308 |
309 | |
Devlin
2014/06/27 22:31:08
nit: remove extraneous newline.
gpdavis
2014/06/28 02:31:17
Done.
| |
311 void UnpackedInstaller::ConfirmInstall() { | 310 void UnpackedInstaller::ConfirmInstall() { |
312 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 311 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
313 base::string16 error = installer_.CheckManagementPolicy(); | 312 base::string16 error = installer_.CheckManagementPolicy(); |
314 if (!error.empty()) { | 313 if (!error.empty()) { |
315 ReportExtensionLoadError(base::UTF16ToUTF8(error)); | 314 ReportExtensionLoadError(base::UTF16ToUTF8(error)); |
316 return; | 315 return; |
317 } | 316 } |
318 | 317 |
319 PermissionsUpdater perms_updater(service_weak_->profile()); | 318 PermissionsUpdater perms_updater(service_weak_->profile()); |
320 perms_updater.GrantActivePermissions(installer_.extension().get()); | 319 perms_updater.GrantActivePermissions(installer_.extension().get()); |
321 | 320 |
322 service_weak_->OnExtensionInstalled(installer_.extension().get(), | 321 service_weak_->OnExtensionInstalled(installer_.extension().get(), |
323 syncer::StringOrdinal(), | 322 syncer::StringOrdinal(), |
324 kInstallFlagInstallImmediately); | 323 kInstallFlagInstallImmediately); |
325 } | 324 } |
326 | 325 |
327 } // namespace extensions | 326 } // namespace extensions |
OLD | NEW |