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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 void AboutChromeView::Init() { | 149 void AboutChromeView::Init() { |
150 text_direction_is_rtl_ = base::i18n::IsRTL(); | 150 text_direction_is_rtl_ = base::i18n::IsRTL(); |
151 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 151 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
152 | 152 |
153 chrome::VersionInfo version_info; | 153 chrome::VersionInfo version_info; |
154 if (!version_info.is_valid()) { | 154 if (!version_info.is_valid()) { |
155 NOTREACHED() << L"Failed to initialize about window"; | 155 NOTREACHED() << L"Failed to initialize about window"; |
156 return; | 156 return; |
157 } | 157 } |
158 | 158 |
159 current_version_ = ASCIIToWide(version_info.Version()); | 159 current_version_ = version_info.Version(); |
160 | 160 |
161 std::string version_modifier = platform_util::GetVersionStringModifier(); | 161 std::string version_modifier = platform_util::GetVersionStringModifier(); |
162 if (!version_modifier.empty()) | 162 if (!version_modifier.empty()) |
163 version_details_ += L" " + ASCIIToWide(version_modifier); | 163 version_details_ += " " + version_modifier; |
164 | 164 |
165 #if !defined(GOOGLE_CHROME_BUILD) | 165 #if !defined(GOOGLE_CHROME_BUILD) |
166 version_details_ += L" ("; | 166 version_details_ += " ("; |
167 version_details_ += ASCIIToWide(version_info.LastChange()); | 167 version_details_ += version_info.LastChange(); |
168 version_details_ += L")"; | 168 version_details_ += ")"; |
169 #endif | 169 #endif |
170 | 170 |
171 // Views we will add to the *parent* of this dialog, since it will display | 171 // Views we will add to the *parent* of this dialog, since it will display |
172 // next to the buttons which we don't draw ourselves. | 172 // next to the buttons which we don't draw ourselves. |
173 throbber_.reset(new views::Throbber(50, true)); | 173 throbber_.reset(new views::Throbber(50, true)); |
174 throbber_->set_parent_owned(false); | 174 throbber_->set_parent_owned(false); |
175 throbber_->SetVisible(false); | 175 throbber_->SetVisible(false); |
176 | 176 |
177 SkBitmap* success_image = rb.GetBitmapNamed(IDR_UPDATE_UPTODATE); | 177 SkBitmap* success_image = rb.GetBitmapNamed(IDR_UPDATE_UPTODATE); |
178 success_indicator_.SetImage(*success_image); | 178 success_indicator_.SetImage(*success_image); |
(...skipping 24 matching lines...) Expand all Loading... |
203 // Add the dialog labels. | 203 // Add the dialog labels. |
204 about_title_label_ = new views::Label( | 204 about_title_label_ = new views::Label( |
205 l10n_util::GetString(IDS_PRODUCT_NAME)); | 205 l10n_util::GetString(IDS_PRODUCT_NAME)); |
206 about_title_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( | 206 about_title_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( |
207 ResourceBundle::BaseFont).DeriveFont(18)); | 207 ResourceBundle::BaseFont).DeriveFont(18)); |
208 about_title_label_->SetColor(SK_ColorBLACK); | 208 about_title_label_->SetColor(SK_ColorBLACK); |
209 AddChildView(about_title_label_); | 209 AddChildView(about_title_label_); |
210 | 210 |
211 // This is a text field so people can copy the version number from the dialog. | 211 // This is a text field so people can copy the version number from the dialog. |
212 version_label_ = new views::Textfield(); | 212 version_label_ = new views::Textfield(); |
213 version_label_->SetText(WideToUTF16Hack(current_version_ + version_details_)); | 213 version_label_->SetText(ASCIIToUTF16(current_version_ + version_details_)); |
214 version_label_->SetReadOnly(true); | 214 version_label_->SetReadOnly(true); |
215 version_label_->RemoveBorder(); | 215 version_label_->RemoveBorder(); |
216 version_label_->SetTextColor(SK_ColorBLACK); | 216 version_label_->SetTextColor(SK_ColorBLACK); |
217 version_label_->SetBackgroundColor(SK_ColorWHITE); | 217 version_label_->SetBackgroundColor(SK_ColorWHITE); |
218 version_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( | 218 version_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( |
219 ResourceBundle::BaseFont)); | 219 ResourceBundle::BaseFont)); |
220 AddChildView(version_label_); | 220 AddChildView(version_label_); |
221 | 221 |
222 #if defined(OS_CHROMEOS) | 222 #if defined(OS_CHROMEOS) |
223 os_version_label_ = new views::Textfield(views::Textfield::STYLE_MULTILINE); | 223 os_version_label_ = new views::Textfield(views::Textfield::STYLE_MULTILINE); |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 // staged then UPGRADE_SUCESSFUL will be returned. | 743 // staged then UPGRADE_SUCESSFUL will be returned. |
744 #if defined(OS_WIN) | 744 #if defined(OS_WIN) |
745 // Google Update reported that Chrome is up-to-date. Now make sure that we | 745 // Google Update reported that Chrome is up-to-date. Now make sure that we |
746 // are running the latest version and if not, notify the user by falling | 746 // are running the latest version and if not, notify the user by falling |
747 // into the next case of UPGRADE_SUCCESSFUL. | 747 // into the next case of UPGRADE_SUCCESSFUL. |
748 // TODO(tommi): Check if using the default distribution is always the | 748 // TODO(tommi): Check if using the default distribution is always the |
749 // right thing to do. | 749 // right thing to do. |
750 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 750 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
751 scoped_ptr<installer::Version> installed_version( | 751 scoped_ptr<installer::Version> installed_version( |
752 InstallUtil::GetChromeVersion(dist, false)); | 752 InstallUtil::GetChromeVersion(dist, false)); |
| 753 std::wstring version_wide = ASCIIToUTF16(current_version_); |
753 scoped_ptr<installer::Version> running_version( | 754 scoped_ptr<installer::Version> running_version( |
754 installer::Version::GetVersionFromString(current_version_)); | 755 installer::Version::GetVersionFromString(version_wide)); |
755 if (!installed_version.get() || | 756 if (!installed_version.get() || |
756 !installed_version->IsHigherThan(running_version.get())) { | 757 !installed_version->IsHigherThan(running_version.get())) { |
757 #endif | 758 #endif |
758 UserMetrics::RecordAction( | 759 UserMetrics::RecordAction( |
759 UserMetricsAction("UpgradeCheck_AlreadyUpToDate"), profile_); | 760 UserMetricsAction("UpgradeCheck_AlreadyUpToDate"), profile_); |
760 #if defined(OS_CHROMEOS) | 761 #if defined(OS_CHROMEOS) |
761 std::wstring update_label_text = | 762 std::wstring update_label_text = |
762 l10n_util::GetStringF(IDS_UPGRADE_ALREADY_UP_TO_DATE, | 763 l10n_util::GetStringF(IDS_UPGRADE_ALREADY_UP_TO_DATE, |
763 l10n_util::GetString(IDS_PRODUCT_NAME)); | 764 l10n_util::GetString(IDS_PRODUCT_NAME)); |
764 #else | 765 #else |
765 std::wstring update_label_text = | 766 std::wstring update_label_text = |
766 l10n_util::GetStringF(IDS_UPGRADE_ALREADY_UP_TO_DATE, | 767 l10n_util::GetStringF(IDS_UPGRADE_ALREADY_UP_TO_DATE, |
767 l10n_util::GetString(IDS_PRODUCT_NAME), | 768 l10n_util::GetString(IDS_PRODUCT_NAME), |
768 current_version_); | 769 version_wide); |
769 #endif | 770 #endif |
770 if (base::i18n::IsRTL()) { | 771 if (base::i18n::IsRTL()) { |
771 update_label_text.push_back( | 772 update_label_text.push_back( |
772 static_cast<wchar_t>(base::i18n::kLeftToRightMark)); | 773 static_cast<wchar_t>(base::i18n::kLeftToRightMark)); |
773 } | 774 } |
774 update_label_.SetText(update_label_text); | 775 update_label_.SetText(update_label_text); |
775 show_success_indicator = true; | 776 show_success_indicator = true; |
776 break; | 777 break; |
777 #if defined(OS_WIN) | 778 #if defined(OS_WIN) |
778 } | 779 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 View* parent = GetParent(); | 821 View* parent = GetParent(); |
821 parent->Layout(); | 822 parent->Layout(); |
822 | 823 |
823 // Check button may have appeared/disappeared. We cannot call this during | 824 // Check button may have appeared/disappeared. We cannot call this during |
824 // ViewHierarchyChanged because the |window()| pointer hasn't been set yet. | 825 // ViewHierarchyChanged because the |window()| pointer hasn't been set yet. |
825 if (window()) | 826 if (window()) |
826 GetDialogClientView()->UpdateDialogButtons(); | 827 GetDialogClientView()->UpdateDialogButtons(); |
827 } | 828 } |
828 | 829 |
829 #endif | 830 #endif |
OLD | NEW |