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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 NotifyCrxInstallComplete(NULL); | 466 NotifyCrxInstallComplete(NULL); |
467 | 467 |
468 // We're done. Since we don't post any more tasks to ourself, our ref count | 468 // We're done. Since we don't post any more tasks to ourself, our ref count |
469 // should go to zero and we die. The destructor will clean up the temp dir. | 469 // should go to zero and we die. The destructor will clean up the temp dir. |
470 } | 470 } |
471 | 471 |
472 void CrxInstaller::CompleteInstall() { | 472 void CrxInstaller::CompleteInstall() { |
473 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 473 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
474 | 474 |
475 if (!current_version_.empty()) { | 475 if (!current_version_.empty()) { |
476 scoped_ptr<Version> current_version( | 476 Version current_version(current_version_); |
477 Version::GetVersionFromString(current_version_)); | 477 if (current_version.CompareTo(*(extension_->version())) > 0) { |
478 if (current_version->CompareTo(*(extension_->version())) > 0) { | |
479 ReportFailureFromFileThread( | 478 ReportFailureFromFileThread( |
480 CrxInstallerError( | 479 CrxInstallerError( |
481 l10n_util::GetStringUTF16(IDS_EXTENSION_CANT_DOWNGRADE_VERSION))); | 480 l10n_util::GetStringUTF16(IDS_EXTENSION_CANT_DOWNGRADE_VERSION))); |
482 return; | 481 return; |
483 } | 482 } |
484 } | 483 } |
485 | 484 |
486 // See how long extension install paths are. This is important on | 485 // See how long extension install paths are. This is important on |
487 // windows, because file operations may fail if the path to a file | 486 // windows, because file operations may fail if the path to a file |
488 // exceeds a small constant. See crbug.com/69693 . | 487 // exceeds a small constant. See crbug.com/69693 . |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 // Some users (such as the download shelf) need to know when a | 611 // Some users (such as the download shelf) need to know when a |
613 // CRXInstaller is done. Listening for the EXTENSION_* events | 612 // CRXInstaller is done. Listening for the EXTENSION_* events |
614 // is problematic because they don't know anything about the | 613 // is problematic because they don't know anything about the |
615 // extension before it is unpacked, so they cannot filter based | 614 // extension before it is unpacked, so they cannot filter based |
616 // on the extension. | 615 // on the extension. |
617 content::NotificationService::current()->Notify( | 616 content::NotificationService::current()->Notify( |
618 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 617 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
619 content::Source<CrxInstaller>(this), | 618 content::Source<CrxInstaller>(this), |
620 content::Details<const Extension>(extension)); | 619 content::Details<const Extension>(extension)); |
621 } | 620 } |
OLD | NEW |