OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/views/about_chrome_view.h" | 5 #include "chrome/browser/ui/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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } // namespace browser | 100 } // namespace browser |
101 | 101 |
102 //////////////////////////////////////////////////////////////////////////////// | 102 //////////////////////////////////////////////////////////////////////////////// |
103 // AboutChromeView, public: | 103 // AboutChromeView, public: |
104 | 104 |
105 AboutChromeView::AboutChromeView(Profile* profile) | 105 AboutChromeView::AboutChromeView(Profile* profile) |
106 : profile_(profile), | 106 : profile_(profile), |
107 about_dlg_background_logo_(NULL), | 107 about_dlg_background_logo_(NULL), |
108 about_title_label_(NULL), | 108 about_title_label_(NULL), |
109 version_label_(NULL), | 109 version_label_(NULL), |
110 #if defined(OS_CHROMEOS) | |
111 os_version_label_(NULL), | 110 os_version_label_(NULL), |
112 #endif | |
113 copyright_label_(NULL), | 111 copyright_label_(NULL), |
114 main_text_label_(NULL), | 112 main_text_label_(NULL), |
115 main_text_label_height_(0), | 113 main_text_label_height_(0), |
116 chromium_url_(NULL), | 114 chromium_url_(NULL), |
117 open_source_url_(NULL), | 115 open_source_url_(NULL), |
118 terms_of_service_url_(NULL), | 116 terms_of_service_url_(NULL), |
119 restart_button_visible_(false), | 117 restart_button_visible_(false), |
120 chromium_url_appears_first_(true), | 118 chromium_url_appears_first_(true), |
121 text_direction_is_rtl_(false) { | 119 text_direction_is_rtl_(false) { |
122 DCHECK(profile); | 120 DCHECK(profile); |
123 #if defined(OS_CHROMEOS) | 121 |
124 loader_.GetVersion(&consumer_, | |
125 NewCallback(this, &AboutChromeView::OnOSVersion), | |
126 chromeos::VersionLoader::VERSION_FULL); | |
127 #endif | |
128 Init(); | 122 Init(); |
129 | 123 |
130 #if defined(OS_WIN) || defined(OS_CHROMEOS) | 124 #if defined(OS_WIN) || defined(OS_CHROMEOS) |
131 google_updater_ = new GoogleUpdate(); | 125 google_updater_ = new GoogleUpdate(); |
132 google_updater_->set_status_listener(this); | 126 google_updater_->set_status_listener(this); |
133 #endif | 127 #endif |
134 | 128 |
135 if (kBackgroundBmp == NULL) { | 129 if (kBackgroundBmp == NULL) { |
136 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 130 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
137 kBackgroundBmp = rb.GetBitmapNamed(IDR_ABOUT_BACKGROUND_COLOR); | 131 kBackgroundBmp = rb.GetBitmapNamed(IDR_ABOUT_BACKGROUND_COLOR); |
(...skipping 23 matching lines...) Expand all Loading... |
161 | 155 |
162 // This code only runs as a result of the user opening the About box so | 156 // This code only runs as a result of the user opening the About box so |
163 // doing registry access to get the version string modifier should be fine. | 157 // doing registry access to get the version string modifier should be fine. |
164 base::ThreadRestrictions::ScopedAllowIO allow_io; | 158 base::ThreadRestrictions::ScopedAllowIO allow_io; |
165 std::string version_modifier = platform_util::GetVersionStringModifier(); | 159 std::string version_modifier = platform_util::GetVersionStringModifier(); |
166 if (!version_modifier.empty()) | 160 if (!version_modifier.empty()) |
167 version_details_ += " " + version_modifier; | 161 version_details_ += " " + version_modifier; |
168 | 162 |
169 #if !defined(GOOGLE_CHROME_BUILD) | 163 #if !defined(GOOGLE_CHROME_BUILD) |
170 version_details_ += " ("; | 164 version_details_ += " ("; |
| 165 version_details_ += l10n_util::GetStringUTF8( |
| 166 version_info.IsOfficialBuild() ? |
| 167 IDS_ABOUT_VERSION_OFFICIAL : IDS_ABOUT_VERSION_UNOFFICIAL); |
| 168 version_details_ += " "; |
171 version_details_ += version_info.LastChange(); | 169 version_details_ += version_info.LastChange(); |
172 version_details_ += ")"; | 170 version_details_ += ")"; |
173 #endif | 171 #endif |
174 | 172 |
175 // Views we will add to the *parent* of this dialog, since it will display | 173 // Views we will add to the *parent* of this dialog, since it will display |
176 // next to the buttons which we don't draw ourselves. | 174 // next to the buttons which we don't draw ourselves. |
177 throbber_.reset(new views::Throbber(50, true)); | 175 throbber_.reset(new views::Throbber(50, true)); |
178 throbber_->set_parent_owned(false); | 176 throbber_->set_parent_owned(false); |
179 throbber_->SetVisible(false); | 177 throbber_->SetVisible(false); |
180 | 178 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 version_label_ = new views::Textfield(); | 214 version_label_ = new views::Textfield(); |
217 version_label_->SetText(ASCIIToUTF16(current_version_ + version_details_)); | 215 version_label_->SetText(ASCIIToUTF16(current_version_ + version_details_)); |
218 version_label_->SetReadOnly(true); | 216 version_label_->SetReadOnly(true); |
219 version_label_->RemoveBorder(); | 217 version_label_->RemoveBorder(); |
220 version_label_->SetTextColor(SK_ColorBLACK); | 218 version_label_->SetTextColor(SK_ColorBLACK); |
221 version_label_->SetBackgroundColor(SK_ColorWHITE); | 219 version_label_->SetBackgroundColor(SK_ColorWHITE); |
222 version_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( | 220 version_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( |
223 ResourceBundle::BaseFont)); | 221 ResourceBundle::BaseFont)); |
224 AddChildView(version_label_); | 222 AddChildView(version_label_); |
225 | 223 |
| 224 os_version_label_ = new views::Textfield(views::Textfield::STYLE_MULTILINE); |
226 #if defined(OS_CHROMEOS) | 225 #if defined(OS_CHROMEOS) |
227 os_version_label_ = new views::Textfield(views::Textfield::STYLE_MULTILINE); | 226 loader_.GetVersion(&consumer_, |
| 227 NewCallback(this, &AboutChromeView::OnOSVersion), |
| 228 chromeos::VersionLoader::VERSION_FULL); |
| 229 #else |
| 230 os_version_label_->SetText(UTF8ToUTF16(version_info.OSType())); |
| 231 #endif |
228 os_version_label_->SetReadOnly(true); | 232 os_version_label_->SetReadOnly(true); |
229 os_version_label_->RemoveBorder(); | 233 os_version_label_->RemoveBorder(); |
230 os_version_label_->SetTextColor(SK_ColorBLACK); | 234 os_version_label_->SetTextColor(SK_ColorBLACK); |
231 os_version_label_->SetBackgroundColor(SK_ColorWHITE); | 235 os_version_label_->SetBackgroundColor(SK_ColorWHITE); |
232 os_version_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( | 236 os_version_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( |
233 ResourceBundle::BaseFont)); | 237 ResourceBundle::BaseFont)); |
234 AddChildView(os_version_label_); | 238 AddChildView(os_version_label_); |
235 #endif | |
236 | 239 |
237 // The copyright URL portion of the main label. | 240 // The copyright URL portion of the main label. |
238 copyright_label_ = new views::Label( | 241 copyright_label_ = new views::Label( |
239 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT))); | 242 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT))); |
240 copyright_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 243 copyright_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
241 AddChildView(copyright_label_); | 244 AddChildView(copyright_label_); |
242 | 245 |
243 main_text_label_ = new views::Label(L""); | 246 main_text_label_ = new views::Label(L""); |
244 | 247 |
245 // Figure out what to write in the main label of the About box. | 248 // Figure out what to write in the main label of the About box. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 357 |
355 // Then we have the version number right below it. | 358 // Then we have the version number right below it. |
356 sz = version_label_->GetPreferredSize(); | 359 sz = version_label_->GetPreferredSize(); |
357 version_label_->SetBounds(views::kPanelHorizMargin, | 360 version_label_->SetBounds(views::kPanelHorizMargin, |
358 about_title_label_->y() + | 361 about_title_label_->y() + |
359 about_title_label_->height() + | 362 about_title_label_->height() + |
360 views::kRelatedControlVerticalSpacing, | 363 views::kRelatedControlVerticalSpacing, |
361 kVersionFieldWidth, | 364 kVersionFieldWidth, |
362 sz.height()); | 365 sz.height()); |
363 | 366 |
364 #if defined(OS_CHROMEOS) | |
365 // Then we have the version number right below it. | 367 // Then we have the version number right below it. |
366 sz = os_version_label_->GetPreferredSize(); | 368 sz = os_version_label_->GetPreferredSize(); |
367 os_version_label_->SetBounds( | 369 os_version_label_->SetBounds( |
368 views::kPanelHorizMargin, | 370 views::kPanelHorizMargin, |
369 version_label_->y() + | 371 version_label_->y() + |
370 version_label_->height() + | 372 version_label_->height() + |
371 views::kRelatedControlVerticalSpacing, | 373 views::kRelatedControlVerticalSpacing, |
372 kVersionFieldWidth, | 374 kVersionFieldWidth, |
373 sz.height()); | 375 sz.height()); |
374 #endif | |
375 | 376 |
376 // For the width of the main text label we want to use up the whole panel | 377 // For the width of the main text label we want to use up the whole panel |
377 // width and remaining height, minus a little margin on each side. | 378 // width and remaining height, minus a little margin on each side. |
378 int y_pos = background_image_height + views::kRelatedControlVerticalSpacing; | 379 int y_pos = background_image_height + views::kRelatedControlVerticalSpacing; |
379 sz.set_width(panel_size.width() - 2 * views::kPanelHorizMargin); | 380 sz.set_width(panel_size.width() - 2 * views::kPanelHorizMargin); |
380 | 381 |
381 // Draw the text right below the background image. | 382 // Draw the text right below the background image. |
382 copyright_label_->SetBounds(views::kPanelHorizMargin, | 383 copyright_label_->SetBounds(views::kPanelHorizMargin, |
383 y_pos, | 384 y_pos, |
384 sz.width(), | 385 sz.width(), |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 // We have updated controls on the parent, so we need to update its layout. | 826 // We have updated controls on the parent, so we need to update its layout. |
826 parent()->Layout(); | 827 parent()->Layout(); |
827 | 828 |
828 // Check button may have appeared/disappeared. We cannot call this during | 829 // Check button may have appeared/disappeared. We cannot call this during |
829 // ViewHierarchyChanged because the |window()| pointer hasn't been set yet. | 830 // ViewHierarchyChanged because the |window()| pointer hasn't been set yet. |
830 if (window()) | 831 if (window()) |
831 GetDialogClientView()->UpdateDialogButtons(); | 832 GetDialogClientView()->UpdateDialogButtons(); |
832 } | 833 } |
833 | 834 |
834 #endif | 835 #endif |
OLD | NEW |