Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: chrome/browser/ui/views/about_chrome_view.cc

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

Powered by Google App Engine
This is Rietveld 408576698