OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/about_chrome_view.h" | 5 #include "chrome/browser/views/about_chrome_view.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <commdlg.h> | 8 #include <commdlg.h> |
9 #endif // defined(OS_WIN) | 9 #endif // defined(OS_WIN) |
10 | 10 |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 bool show_success_indicator = false; | 712 bool show_success_indicator = false; |
713 bool show_update_available_indicator = false; | 713 bool show_update_available_indicator = false; |
714 bool show_timeout_indicator = false; | 714 bool show_timeout_indicator = false; |
715 bool show_throbber = false; | 715 bool show_throbber = false; |
716 bool show_update_label = true; // Always visible, except at start. | 716 bool show_update_label = true; // Always visible, except at start. |
717 | 717 |
718 switch (result) { | 718 switch (result) { |
719 case UPGRADE_STARTED: | 719 case UPGRADE_STARTED: |
720 UserMetrics::RecordAction(UserMetricsAction("Upgrade_Started"), profile_); | 720 UserMetrics::RecordAction(UserMetricsAction("Upgrade_Started"), profile_); |
721 show_throbber = true; | 721 show_throbber = true; |
722 update_label_.SetText(l10n_util::GetString(IDS_UPGRADE_STARTED)); | 722 update_label_.SetText( |
| 723 UTF16ToWide(l10n_util::GetStringUTF16(IDS_UPGRADE_STARTED))); |
723 break; | 724 break; |
724 case UPGRADE_CHECK_STARTED: | 725 case UPGRADE_CHECK_STARTED: |
725 UserMetrics::RecordAction(UserMetricsAction("UpgradeCheck_Started"), | 726 UserMetrics::RecordAction(UserMetricsAction("UpgradeCheck_Started"), |
726 profile_); | 727 profile_); |
727 show_throbber = true; | 728 show_throbber = true; |
728 update_label_.SetText(l10n_util::GetString(IDS_UPGRADE_CHECK_STARTED)); | 729 update_label_.SetText( |
| 730 UTF16ToWide(l10n_util::GetStringUTF16(IDS_UPGRADE_CHECK_STARTED))); |
729 break; | 731 break; |
730 case UPGRADE_IS_AVAILABLE: | 732 case UPGRADE_IS_AVAILABLE: |
731 UserMetrics::RecordAction( | 733 UserMetrics::RecordAction( |
732 UserMetricsAction("UpgradeCheck_UpgradeIsAvailable"), profile_); | 734 UserMetricsAction("UpgradeCheck_UpgradeIsAvailable"), profile_); |
733 DCHECK(!google_updater_); // Should have been nulled out already. | 735 DCHECK(!google_updater_); // Should have been nulled out already. |
734 google_updater_ = new GoogleUpdate(); | 736 google_updater_ = new GoogleUpdate(); |
735 google_updater_->set_status_listener(this); | 737 google_updater_->set_status_listener(this); |
736 UpdateStatus(UPGRADE_STARTED, GOOGLE_UPDATE_NO_ERROR); | 738 UpdateStatus(UPGRADE_STARTED, GOOGLE_UPDATE_NO_ERROR); |
737 // CheckForUpdate(true,...) means perform upgrade if new version found. | 739 // CheckForUpdate(true,...) means perform upgrade if new version found. |
738 google_updater_->CheckForUpdate(true, window()); | 740 google_updater_->CheckForUpdate(true, window()); |
(...skipping 14 matching lines...) Expand all Loading... |
753 scoped_ptr<Version> installed_version( | 755 scoped_ptr<Version> installed_version( |
754 InstallUtil::GetChromeVersion(dist, false)); | 756 InstallUtil::GetChromeVersion(dist, false)); |
755 scoped_ptr<Version> running_version( | 757 scoped_ptr<Version> running_version( |
756 Version::GetVersionFromString(current_version_)); | 758 Version::GetVersionFromString(current_version_)); |
757 if (!installed_version.get() || | 759 if (!installed_version.get() || |
758 (installed_version->CompareTo(*running_version) < 0)) { | 760 (installed_version->CompareTo(*running_version) < 0)) { |
759 #endif | 761 #endif |
760 UserMetrics::RecordAction( | 762 UserMetrics::RecordAction( |
761 UserMetricsAction("UpgradeCheck_AlreadyUpToDate"), profile_); | 763 UserMetricsAction("UpgradeCheck_AlreadyUpToDate"), profile_); |
762 #if defined(OS_CHROMEOS) | 764 #if defined(OS_CHROMEOS) |
763 std::wstring update_label_text = | 765 std::wstring update_label_text = UTF16ToWide(l10n_util::GetStringFUTF16( |
764 l10n_util::GetStringF(IDS_UPGRADE_ALREADY_UP_TO_DATE, | 766 IDS_UPGRADE_ALREADY_UP_TO_DATE, |
765 l10n_util::GetString(IDS_PRODUCT_NAME)); | 767 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); |
766 #else | 768 #else |
767 std::wstring update_label_text = | 769 std::wstring update_label_text = l10n_util::GetStringFUTF16( |
768 l10n_util::GetStringF(IDS_UPGRADE_ALREADY_UP_TO_DATE, | 770 IDS_UPGRADE_ALREADY_UP_TO_DATE, |
769 l10n_util::GetString(IDS_PRODUCT_NAME), | 771 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), |
770 ASCIIToUTF16(current_version_)); | 772 ASCIIToUTF16(current_version_)); |
771 #endif | 773 #endif |
772 if (base::i18n::IsRTL()) { | 774 if (base::i18n::IsRTL()) { |
773 update_label_text.push_back( | 775 update_label_text.push_back( |
774 static_cast<wchar_t>(base::i18n::kLeftToRightMark)); | 776 static_cast<wchar_t>(base::i18n::kLeftToRightMark)); |
775 } | 777 } |
776 update_label_.SetText(update_label_text); | 778 update_label_.SetText(update_label_text); |
777 show_success_indicator = true; | 779 show_success_indicator = true; |
778 break; | 780 break; |
779 #if defined(OS_WIN) | 781 #if defined(OS_WIN) |
780 } | 782 } |
781 #endif | 783 #endif |
782 // No break here as we want to notify user about upgrade if there is one. | 784 // No break here as we want to notify user about upgrade if there is one. |
783 } | 785 } |
784 case UPGRADE_SUCCESSFUL: { | 786 case UPGRADE_SUCCESSFUL: { |
785 if (result == UPGRADE_ALREADY_UP_TO_DATE) | 787 if (result == UPGRADE_ALREADY_UP_TO_DATE) |
786 UserMetrics::RecordAction( | 788 UserMetrics::RecordAction( |
787 UserMetricsAction("UpgradeCheck_AlreadyUpgraded"), profile_); | 789 UserMetricsAction("UpgradeCheck_AlreadyUpgraded"), profile_); |
788 else | 790 else |
789 UserMetrics::RecordAction(UserMetricsAction("UpgradeCheck_Upgraded"), | 791 UserMetrics::RecordAction(UserMetricsAction("UpgradeCheck_Upgraded"), |
790 profile_); | 792 profile_); |
791 restart_button_visible_ = true; | 793 restart_button_visible_ = true; |
792 const std::wstring& update_string = | 794 const std::wstring& update_string = |
793 l10n_util::GetStringF(IDS_UPGRADE_SUCCESSFUL_RESTART, | 795 UTF16ToWide(l10n_util::GetStringFUTF16( |
794 l10n_util::GetString(IDS_PRODUCT_NAME)); | 796 IDS_UPGRADE_SUCCESSFUL_RESTART, |
| 797 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); |
795 update_label_.SetText(update_string); | 798 update_label_.SetText(update_string); |
796 show_success_indicator = true; | 799 show_success_indicator = true; |
797 break; | 800 break; |
798 } | 801 } |
799 case UPGRADE_ERROR: | 802 case UPGRADE_ERROR: |
800 UserMetrics::RecordAction(UserMetricsAction("UpgradeCheck_Error"), | 803 UserMetrics::RecordAction(UserMetricsAction("UpgradeCheck_Error"), |
801 profile_); | 804 profile_); |
802 restart_button_visible_ = false; | 805 restart_button_visible_ = false; |
803 update_label_.SetText(l10n_util::GetStringF(IDS_UPGRADE_ERROR, | 806 update_label_.SetText(UTF16ToWide( |
804 UTF8ToWide(base::IntToString(error_code)))); | 807 l10n_util::GetStringFUTF16Int(IDS_UPGRADE_ERROR, error_code))); |
805 show_timeout_indicator = true; | 808 show_timeout_indicator = true; |
806 break; | 809 break; |
807 default: | 810 default: |
808 NOTREACHED(); | 811 NOTREACHED(); |
809 } | 812 } |
810 | 813 |
811 success_indicator_.SetVisible(show_success_indicator); | 814 success_indicator_.SetVisible(show_success_indicator); |
812 update_available_indicator_.SetVisible(show_update_available_indicator); | 815 update_available_indicator_.SetVisible(show_update_available_indicator); |
813 timeout_indicator_.SetVisible(show_timeout_indicator); | 816 timeout_indicator_.SetVisible(show_timeout_indicator); |
814 update_label_.SetVisible(show_update_label); | 817 update_label_.SetVisible(show_update_label); |
815 throbber_->SetVisible(show_throbber); | 818 throbber_->SetVisible(show_throbber); |
816 if (show_throbber) | 819 if (show_throbber) |
817 throbber_->Start(); | 820 throbber_->Start(); |
818 else | 821 else |
819 throbber_->Stop(); | 822 throbber_->Stop(); |
820 | 823 |
821 // We have updated controls on the parent, so we need to update its layout. | 824 // We have updated controls on the parent, so we need to update its layout. |
822 View* parent = GetParent(); | 825 View* parent = GetParent(); |
823 parent->Layout(); | 826 parent->Layout(); |
824 | 827 |
825 // Check button may have appeared/disappeared. We cannot call this during | 828 // Check button may have appeared/disappeared. We cannot call this during |
826 // ViewHierarchyChanged because the |window()| pointer hasn't been set yet. | 829 // ViewHierarchyChanged because the |window()| pointer hasn't been set yet. |
827 if (window()) | 830 if (window()) |
828 GetDialogClientView()->UpdateDialogButtons(); | 831 GetDialogClientView()->UpdateDialogButtons(); |
829 } | 832 } |
830 | 833 |
831 #endif | 834 #endif |
OLD | NEW |