| 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/chromeos/login/new_user_view.h" | 5 #include "chrome/browser/chromeos/login/new_user_view.h" |
| 6 | 6 |
| 7 #include <signal.h> | 7 #include <signal.h> |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 } | 282 } |
| 283 | 283 |
| 284 void NewUserView::UpdateLocalizedStringsAndFonts() { | 284 void NewUserView::UpdateLocalizedStringsAndFonts() { |
| 285 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 285 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 286 gfx::Font title_font = rb.GetFont(ResourceBundle::MediumBoldFont).DeriveFont( | 286 gfx::Font title_font = rb.GetFont(ResourceBundle::MediumBoldFont).DeriveFont( |
| 287 kLoginTitleFontDelta); | 287 kLoginTitleFontDelta); |
| 288 const gfx::Font& title_hint_font = rb.GetFont(ResourceBundle::BoldFont); | 288 const gfx::Font& title_hint_font = rb.GetFont(ResourceBundle::BoldFont); |
| 289 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); | 289 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); |
| 290 | 290 |
| 291 title_label_->SetFont(title_font); | 291 title_label_->SetFont(title_font); |
| 292 title_label_->SetText(UTF16ToWide( | 292 title_label_->SetText( |
| 293 l10n_util::GetStringUTF16(IDS_LOGIN_TITLE))); | 293 l10n_util::GetStringUTF16(IDS_LOGIN_TITLE)); |
| 294 title_hint_label_->SetFont(title_hint_font); | 294 title_hint_label_->SetFont(title_hint_font); |
| 295 title_hint_label_->SetText(UTF16ToWide( | 295 title_hint_label_->SetText(l10n_util::GetStringUTF16(IDS_LOGIN_TITLE_HINT)); |
| 296 l10n_util::GetStringUTF16(IDS_LOGIN_TITLE_HINT))); | |
| 297 SetAndCorrectTextfieldFont(username_field_, base_font); | 296 SetAndCorrectTextfieldFont(username_field_, base_font); |
| 298 username_field_->set_text_to_display_when_empty( | 297 username_field_->set_text_to_display_when_empty( |
| 299 l10n_util::GetStringUTF16(IDS_LOGIN_USERNAME)); | 298 l10n_util::GetStringUTF16(IDS_LOGIN_USERNAME)); |
| 300 SetAndCorrectTextfieldFont(password_field_, base_font); | 299 SetAndCorrectTextfieldFont(password_field_, base_font); |
| 301 password_field_->set_text_to_display_when_empty( | 300 password_field_->set_text_to_display_when_empty( |
| 302 l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD)); | 301 l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD)); |
| 303 sign_in_button_->SetText(UTF16ToWide( | 302 sign_in_button_->SetText(UTF16ToWide( |
| 304 l10n_util::GetStringUTF16(IDS_LOGIN_BUTTON))); | 303 l10n_util::GetStringUTF16(IDS_LOGIN_BUTTON))); |
| 305 if (need_guest_link_) { | 304 if (need_guest_link_) { |
| 306 guest_link_->SetFont(base_font); | 305 guest_link_->SetFont(base_font); |
| 307 guest_link_->SetText(UTF16ToWide( | 306 guest_link_->SetText( |
| 308 l10n_util::GetStringUTF16(IDS_BROWSE_WITHOUT_SIGNING_IN_BUTTON))); | 307 l10n_util::GetStringUTF16(IDS_BROWSE_WITHOUT_SIGNING_IN_BUTTON)); |
| 309 } | 308 } |
| 310 if (need_create_account_) { | 309 if (need_create_account_) { |
| 311 create_account_link_->SetFont(base_font); | 310 create_account_link_->SetFont(base_font); |
| 312 create_account_link_->SetText( | 311 create_account_link_->SetText( |
| 313 UTF16ToWide(l10n_util::GetStringUTF16(IDS_CREATE_ACCOUNT_BUTTON))); | 312 l10n_util::GetStringUTF16(IDS_CREATE_ACCOUNT_BUTTON)); |
| 314 } | 313 } |
| 315 delegate_->ClearErrors(); | 314 delegate_->ClearErrors(); |
| 316 languages_menubutton_->SetText( | 315 languages_menubutton_->SetText( |
| 317 UTF16ToWide(language_switch_menu_.GetCurrentLocaleName())); | 316 UTF16ToWide(language_switch_menu_.GetCurrentLocaleName())); |
| 318 } | 317 } |
| 319 | 318 |
| 320 void NewUserView::OnLocaleChanged() { | 319 void NewUserView::OnLocaleChanged() { |
| 321 RecreatePeculiarControls(); | 320 RecreatePeculiarControls(); |
| 322 UpdateLocalizedStringsAndFonts(); | 321 UpdateLocalizedStringsAndFonts(); |
| 323 AddChildView(sign_in_button_); | 322 AddChildView(sign_in_button_); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 height = username_field_->GetPreferredSize().height() + | 419 height = username_field_->GetPreferredSize().height() + |
| 421 password_field_->GetPreferredSize().height() + | 420 password_field_->GetPreferredSize().height() + |
| 422 sign_in_button_->GetPreferredSize().height() + | 421 sign_in_button_->GetPreferredSize().height() + |
| 423 2 * kRowPad; | 422 2 * kRowPad; |
| 424 y = title_end + (bottom_start - title_end - height) / 2; | 423 y = title_end + (bottom_start - title_end - height) / 2; |
| 425 | 424 |
| 426 y += setViewBounds(username_field_, x, y, width, true) + kRowPad; | 425 y += setViewBounds(username_field_, x, y, width, true) + kRowPad; |
| 427 y += setViewBounds(password_field_, x, y, width, true) + kRowPad; | 426 y += setViewBounds(password_field_, x, y, width, true) + kRowPad; |
| 428 | 427 |
| 429 int sign_in_button_width = sign_in_button_->GetPreferredSize().width(); | 428 int sign_in_button_width = sign_in_button_->GetPreferredSize().width(); |
| 430 setViewBounds(sign_in_button_, x, y, sign_in_button_width,true); | 429 setViewBounds(sign_in_button_, x, y, sign_in_button_width, true); |
| 431 | 430 |
| 432 SchedulePaint(); | 431 SchedulePaint(); |
| 433 } | 432 } |
| 434 | 433 |
| 435 gfx::Size NewUserView::GetPreferredSize() { | 434 gfx::Size NewUserView::GetPreferredSize() { |
| 436 return need_guest_link_ ? | 435 return need_guest_link_ ? |
| 437 gfx::Size(kNewUserPodFullWidth, kNewUserPodFullHeight) : | 436 gfx::Size(kNewUserPodFullWidth, kNewUserPodFullHeight) : |
| 438 gfx::Size(kNewUserPodSmallWidth, kNewUserPodSmallHeight); | 437 gfx::Size(kNewUserPodSmallWidth, kNewUserPodSmallHeight); |
| 439 } | 438 } |
| 440 | 439 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 if (username_field_->text().empty() && | 563 if (username_field_->text().empty() && |
| 565 password_field_->text().empty()) { | 564 password_field_->text().empty()) { |
| 566 delegate_->NavigateAway(); | 565 delegate_->NavigateAway(); |
| 567 return true; | 566 return true; |
| 568 } else { | 567 } else { |
| 569 return false; | 568 return false; |
| 570 } | 569 } |
| 571 } | 570 } |
| 572 | 571 |
| 573 void NewUserView::InitLink(views::Link** link) { | 572 void NewUserView::InitLink(views::Link** link) { |
| 574 *link = new views::Link(std::wstring()); | 573 *link = new views::Link(string16()); |
| 575 (*link)->set_listener(this); | 574 (*link)->set_listener(this); |
| 576 (*link)->SetNormalColor(login::kLinkColor); | 575 (*link)->SetNormalColor(login::kLinkColor); |
| 577 (*link)->SetHighlightedColor(login::kLinkColor); | 576 (*link)->SetHighlightedColor(login::kLinkColor); |
| 578 AddChildView(*link); | 577 AddChildView(*link); |
| 579 } | 578 } |
| 580 | 579 |
| 581 } // namespace chromeos | 580 } // namespace chromeos |
| OLD | NEW |