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/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 void UnpackedInstaller::ReportExtensionLoadError(const std::string &error) { | 343 void UnpackedInstaller::ReportExtensionLoadError(const std::string &error) { |
344 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 344 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
345 | 345 |
346 if (service_weak_.get()) { | 346 if (service_weak_.get()) { |
347 ExtensionErrorReporter::GetInstance()->ReportLoadError( | 347 ExtensionErrorReporter::GetInstance()->ReportLoadError( |
348 extension_path_, | 348 extension_path_, |
349 error, | 349 error, |
350 service_weak_->profile(), | 350 service_weak_->profile(), |
351 be_noisy_on_failure_); | 351 be_noisy_on_failure_); |
352 } | 352 } |
| 353 |
| 354 if (!callback_.is_null()) { |
| 355 callback_.Run(nullptr, extension_path_, error); |
| 356 callback_.Reset(); |
| 357 } |
353 } | 358 } |
354 | 359 |
355 void UnpackedInstaller::InstallExtension() { | 360 void UnpackedInstaller::InstallExtension() { |
356 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 361 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
357 | 362 |
358 PermissionsUpdater perms_updater(service_weak_->profile()); | 363 PermissionsUpdater perms_updater(service_weak_->profile()); |
359 perms_updater.InitializePermissions(extension()); | 364 perms_updater.InitializePermissions(extension()); |
360 perms_updater.GrantActivePermissions(extension()); | 365 perms_updater.GrantActivePermissions(extension()); |
361 | 366 |
362 service_weak_->OnExtensionInstalled( | 367 service_weak_->OnExtensionInstalled( |
363 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); | 368 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); |
| 369 |
| 370 if (!callback_.is_null()) { |
| 371 callback_.Run(extension(), extension_path_, std::string()); |
| 372 callback_.Reset(); |
| 373 } |
364 } | 374 } |
365 | 375 |
366 } // namespace extensions | 376 } // namespace extensions |
OLD | NEW |