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 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_version_info.h" | 10 #include "base/file_version_info.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 version_label_->SetText(WideToUTF16Hack(current_version_ + version_details_)); | 201 version_label_->SetText(WideToUTF16Hack(current_version_ + version_details_)); |
202 version_label_->SetReadOnly(true); | 202 version_label_->SetReadOnly(true); |
203 version_label_->RemoveBorder(); | 203 version_label_->RemoveBorder(); |
204 version_label_->SetTextColor(SK_ColorBLACK); | 204 version_label_->SetTextColor(SK_ColorBLACK); |
205 version_label_->SetBackgroundColor(SK_ColorWHITE); | 205 version_label_->SetBackgroundColor(SK_ColorWHITE); |
206 version_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( | 206 version_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( |
207 ResourceBundle::BaseFont)); | 207 ResourceBundle::BaseFont)); |
208 AddChildView(version_label_); | 208 AddChildView(version_label_); |
209 | 209 |
210 #if defined(OS_CHROMEOS) | 210 #if defined(OS_CHROMEOS) |
211 os_version_label_ = new views::Textfield(); | 211 os_version_label_ = new views::Textfield(views::Textfield::STYLE_MULTILINE); |
212 os_version_label_->SetReadOnly(true); | 212 os_version_label_->SetReadOnly(true); |
213 os_version_label_->RemoveBorder(); | 213 os_version_label_->RemoveBorder(); |
214 os_version_label_->SetTextColor(SK_ColorBLACK); | 214 os_version_label_->SetTextColor(SK_ColorBLACK); |
215 os_version_label_->SetBackgroundColor(SK_ColorWHITE); | 215 os_version_label_->SetBackgroundColor(SK_ColorWHITE); |
216 os_version_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( | 216 os_version_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( |
217 ResourceBundle::BaseFont)); | 217 ResourceBundle::BaseFont)); |
218 AddChildView(os_version_label_); | 218 AddChildView(os_version_label_); |
219 #endif | 219 #endif |
220 | 220 |
221 // The copyright URL portion of the main label. | 221 // The copyright URL portion of the main label. |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 bool AboutChromeView::IsDialogButtonVisible( | 580 bool AboutChromeView::IsDialogButtonVisible( |
581 MessageBoxFlags::DialogButton button) const { | 581 MessageBoxFlags::DialogButton button) const { |
582 if (button == MessageBoxFlags::DIALOGBUTTON_OK && | 582 if (button == MessageBoxFlags::DIALOGBUTTON_OK && |
583 check_button_status_ == CHECKBUTTON_HIDDEN) { | 583 check_button_status_ == CHECKBUTTON_HIDDEN) { |
584 return false; | 584 return false; |
585 } | 585 } |
586 | 586 |
587 return true; | 587 return true; |
588 } | 588 } |
589 | 589 |
| 590 // (on ChromeOS) the default focus is ending up in the version field when |
| 591 // the update button is hidden. This forces the focus to always be on the |
| 592 // OK button (which is the dialog cancel button, see GetDialogButtonLabel |
| 593 // above). |
| 594 int AboutChromeView::GetDefaultDialogButton() const { |
| 595 return MessageBoxFlags::DIALOGBUTTON_CANCEL; |
| 596 } |
| 597 |
590 bool AboutChromeView::CanResize() const { | 598 bool AboutChromeView::CanResize() const { |
591 return false; | 599 return false; |
592 } | 600 } |
593 | 601 |
594 bool AboutChromeView::CanMaximize() const { | 602 bool AboutChromeView::CanMaximize() const { |
595 return false; | 603 return false; |
596 } | 604 } |
597 | 605 |
598 bool AboutChromeView::IsAlwaysOnTop() const { | 606 bool AboutChromeView::IsAlwaysOnTop() const { |
599 return false; | 607 return false; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 browser->OpenURL(url, GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); | 656 browser->OpenURL(url, GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); |
649 #else | 657 #else |
650 browser->OpenURL(url, GURL(), NEW_WINDOW, PageTransition::LINK); | 658 browser->OpenURL(url, GURL(), NEW_WINDOW, PageTransition::LINK); |
651 #endif | 659 #endif |
652 } | 660 } |
653 | 661 |
654 #if defined(OS_CHROMEOS) | 662 #if defined(OS_CHROMEOS) |
655 void AboutChromeView::OnOSVersion( | 663 void AboutChromeView::OnOSVersion( |
656 chromeos::VersionLoader::Handle handle, | 664 chromeos::VersionLoader::Handle handle, |
657 std::string version) { | 665 std::string version) { |
| 666 |
| 667 // This is a hack to "wrap" the very long Test Build version after |
| 668 // the version number, the remaining text won't be visible but can |
| 669 // be selected, copied, pasted. |
| 670 std::string::size_type pos = version.find(" (Test Build"); |
| 671 if (pos != std::string::npos) |
| 672 version.replace(pos, 1, "\n"); |
| 673 |
658 os_version_label_->SetText(UTF8ToUTF16(version)); | 674 os_version_label_->SetText(UTF8ToUTF16(version)); |
659 } | 675 } |
660 #endif | 676 #endif |
661 | 677 |
662 #if defined(OS_WIN) || defined(OS_CHROMEOS) | 678 #if defined(OS_WIN) || defined(OS_CHROMEOS) |
663 //////////////////////////////////////////////////////////////////////////////// | 679 //////////////////////////////////////////////////////////////////////////////// |
664 // AboutChromeView, GoogleUpdateStatusListener implementation: | 680 // AboutChromeView, GoogleUpdateStatusListener implementation: |
665 | 681 |
666 void AboutChromeView::OnReportResults(GoogleUpdateUpgradeResult result, | 682 void AboutChromeView::OnReportResults(GoogleUpdateUpgradeResult result, |
667 GoogleUpdateErrorCode error_code, | 683 GoogleUpdateErrorCode error_code, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 scoped_ptr<installer::Version> installed_version( | 743 scoped_ptr<installer::Version> installed_version( |
728 InstallUtil::GetChromeVersion(false)); | 744 InstallUtil::GetChromeVersion(false)); |
729 scoped_ptr<installer::Version> running_version( | 745 scoped_ptr<installer::Version> running_version( |
730 installer::Version::GetVersionFromString(current_version_)); | 746 installer::Version::GetVersionFromString(current_version_)); |
731 if (!installed_version.get() || | 747 if (!installed_version.get() || |
732 !installed_version->IsHigherThan(running_version.get())) { | 748 !installed_version->IsHigherThan(running_version.get())) { |
733 #endif | 749 #endif |
734 UserMetrics::RecordAction( | 750 UserMetrics::RecordAction( |
735 UserMetricsAction("UpgradeCheck_AlreadyUpToDate"), profile_); | 751 UserMetricsAction("UpgradeCheck_AlreadyUpToDate"), profile_); |
736 check_button_status_ = CHECKBUTTON_HIDDEN; | 752 check_button_status_ = CHECKBUTTON_HIDDEN; |
| 753 #if defined(OS_CHROMEOS) |
| 754 std::wstring update_label_text = |
| 755 l10n_util::GetStringF(IDS_UPGRADE_ALREADY_UP_TO_DATE, |
| 756 l10n_util::GetString(IDS_PRODUCT_NAME)); |
| 757 #else |
737 std::wstring update_label_text = | 758 std::wstring update_label_text = |
738 l10n_util::GetStringF(IDS_UPGRADE_ALREADY_UP_TO_DATE, | 759 l10n_util::GetStringF(IDS_UPGRADE_ALREADY_UP_TO_DATE, |
739 l10n_util::GetString(IDS_PRODUCT_NAME), | 760 l10n_util::GetString(IDS_PRODUCT_NAME), |
740 current_version_); | 761 current_version_); |
| 762 #endif |
741 if (base::i18n::IsRTL()) { | 763 if (base::i18n::IsRTL()) { |
742 update_label_text.push_back( | 764 update_label_text.push_back( |
743 static_cast<wchar_t>(base::i18n::kLeftToRightMark)); | 765 static_cast<wchar_t>(base::i18n::kLeftToRightMark)); |
744 } | 766 } |
745 update_label_.SetText(update_label_text); | 767 update_label_.SetText(update_label_text); |
746 show_success_indicator = true; | 768 show_success_indicator = true; |
747 break; | 769 break; |
748 #if defined(OS_WIN) | 770 #if defined(OS_WIN) |
749 } | 771 } |
750 #endif | 772 #endif |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 View* parent = GetParent(); | 821 View* parent = GetParent(); |
800 parent->Layout(); | 822 parent->Layout(); |
801 | 823 |
802 // Check button may have appeared/disappeared. We cannot call this during | 824 // Check button may have appeared/disappeared. We cannot call this during |
803 // ViewHierarchyChanged because the |window()| pointer hasn't been set yet. | 825 // ViewHierarchyChanged because the |window()| pointer hasn't been set yet. |
804 if (window()) | 826 if (window()) |
805 GetDialogClientView()->UpdateDialogButtons(); | 827 GetDialogClientView()->UpdateDialogButtons(); |
806 } | 828 } |
807 | 829 |
808 #endif | 830 #endif |
OLD | NEW |