OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/crx_installer.h" | 5 #include "chrome/browser/extensions/crx_installer.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 // TODO(rdevlin.cronin): Continue removing std::string errors and replacing | 503 // TODO(rdevlin.cronin): Continue removing std::string errors and replacing |
504 // with string16 | 504 // with string16 |
505 std::string extension_id = extension_->id(); | 505 std::string extension_id = extension_->id(); |
506 std::string error; | 506 std::string error; |
507 extension_ = extension_file_util::LoadExtension( | 507 extension_ = extension_file_util::LoadExtension( |
508 version_dir, | 508 version_dir, |
509 install_source_, | 509 install_source_, |
510 extension_->creation_flags() | Extension::REQUIRE_KEY, | 510 extension_->creation_flags() | Extension::REQUIRE_KEY, |
511 &error); | 511 &error); |
512 | 512 |
513 LOG_ASSERT(error.empty()) << error << " " << extension_id << " " | 513 if (extension_) { |
514 << download_url_.spec(); | 514 ReportSuccessFromFileThread(); |
| 515 } else { |
| 516 LOG(ERROR) << error << " " << extension_id << " " << download_url_.spec(); |
| 517 ReportFailureFromFileThread(CrxInstallerError(UTF8ToUTF16(error))); |
| 518 } |
515 | 519 |
516 ReportSuccessFromFileThread(); | |
517 } | 520 } |
518 | 521 |
519 void CrxInstaller::ReportFailureFromFileThread(const CrxInstallerError& error) { | 522 void CrxInstaller::ReportFailureFromFileThread(const CrxInstallerError& error) { |
520 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 523 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
521 if (!BrowserThread::PostTask( | 524 if (!BrowserThread::PostTask( |
522 BrowserThread::UI, FROM_HERE, | 525 BrowserThread::UI, FROM_HERE, |
523 base::Bind(&CrxInstaller::ReportFailureFromUIThread, this, error))) { | 526 base::Bind(&CrxInstaller::ReportFailureFromUIThread, this, error))) { |
524 NOTREACHED(); | 527 NOTREACHED(); |
525 } | 528 } |
526 } | 529 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 // is problematic because they don't know anything about the | 615 // is problematic because they don't know anything about the |
613 // extension before it is unpacked, so they cannot filter based | 616 // extension before it is unpacked, so they cannot filter based |
614 // on the extension. | 617 // on the extension. |
615 content::NotificationService::current()->Notify( | 618 content::NotificationService::current()->Notify( |
616 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 619 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
617 content::Source<CrxInstaller>(this), | 620 content::Source<CrxInstaller>(this), |
618 content::Details<const Extension>(extension)); | 621 content::Details<const Extension>(extension)); |
619 } | 622 } |
620 | 623 |
621 } // namespace extensions | 624 } // namespace extensions |
OLD | NEW |