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/chromeos/login/guest_user_view.h" | 5 #include "chrome/browser/chromeos/login/guest_user_view.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "chrome/browser/chromeos/login/helper.h" |
8 #include "chrome/browser/chromeos/login/user_controller.h" | 9 #include "chrome/browser/chromeos/login/user_controller.h" |
9 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" | 10 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" |
10 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
11 | 12 |
12 namespace chromeos { | 13 namespace chromeos { |
13 | 14 |
14 // Button with custom processing for Tab/Shift+Tab to select entries. | 15 // Button with custom processing for Tab/Shift+Tab to select entries. |
15 class UserEntryButton : public views::NativeButton { | 16 class UserEntryButton : public views::NativeButton { |
16 public: | 17 public: |
17 UserEntryButton(UserController* controller, | 18 UserEntryButton(UserController* controller, |
(...skipping 39 matching lines...) Loading... |
57 AddAccelerator(accel_login_off_the_record_); | 58 AddAccelerator(accel_login_off_the_record_); |
58 AddAccelerator(accel_previous_pod_by_arrow_); | 59 AddAccelerator(accel_previous_pod_by_arrow_); |
59 AddAccelerator(accel_next_pod_by_arrow_); | 60 AddAccelerator(accel_next_pod_by_arrow_); |
60 } | 61 } |
61 | 62 |
62 void GuestUserView::RecreateFields() { | 63 void GuestUserView::RecreateFields() { |
63 delete submit_button_; | 64 delete submit_button_; |
64 submit_button_ = new UserEntryButton( | 65 submit_button_ = new UserEntryButton( |
65 user_controller_, | 66 user_controller_, |
66 l10n_util::GetString(IDS_LOGIN_BUTTON)); | 67 l10n_util::GetString(IDS_LOGIN_BUTTON)); |
| 68 login::CorrectNativeButtonFontSize(submit_button_); |
67 AddChildView(submit_button_); | 69 AddChildView(submit_button_); |
68 Layout(); | 70 Layout(); |
69 SchedulePaint(); | 71 SchedulePaint(); |
70 } | 72 } |
71 | 73 |
72 void GuestUserView::FocusSignInButton() { | 74 void GuestUserView::FocusSignInButton() { |
73 if (GetFocusManager()) | 75 if (GetFocusManager()) |
74 submit_button_->RequestFocus(); | 76 submit_button_->RequestFocus(); |
75 } | 77 } |
76 | 78 |
(...skipping 18 matching lines...) Loading... |
95 if (is_add && this == child) | 97 if (is_add && this == child) |
96 WizardAccessibilityHelper::GetInstance()->MaybeEnableAccessibility(this); | 98 WizardAccessibilityHelper::GetInstance()->MaybeEnableAccessibility(this); |
97 } | 99 } |
98 | 100 |
99 void GuestUserView::OnLocaleChanged() { | 101 void GuestUserView::OnLocaleChanged() { |
100 RecreateFields(); | 102 RecreateFields(); |
101 } | 103 } |
102 | 104 |
103 void GuestUserView::Layout() { | 105 void GuestUserView::Layout() { |
104 gfx::Size submit_button_size = submit_button_->GetPreferredSize(); | 106 gfx::Size submit_button_size = submit_button_->GetPreferredSize(); |
105 int submit_button_x = (width() - submit_button_size.width()) / 2; | 107 int submit_button_width = std::max(login::kButtonMinWidth, |
| 108 submit_button_size.width()); |
| 109 int submit_button_x = (width() - submit_button_width) / 2; |
106 int submit_button_y = (height() - submit_button_size.height()) / 2; | 110 int submit_button_y = (height() - submit_button_size.height()) / 2; |
107 submit_button_->SetBounds(submit_button_x, | 111 submit_button_->SetBounds(submit_button_x, |
108 submit_button_y, | 112 submit_button_y, |
109 submit_button_size.width(), | 113 submit_button_width, |
110 submit_button_size.height()); | 114 submit_button_size.height()); |
111 } | 115 } |
112 | 116 |
113 } // namespace chromeos | 117 } // namespace chromeos |
OLD | NEW |