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 "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/chromeos/login/user_controller.h" | 8 #include "chrome/browser/chromeos/login/user_controller.h" |
9 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" | 9 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" |
10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 AddChildView(submit_button_); | 69 AddChildView(submit_button_); |
70 Layout(); | 70 Layout(); |
71 SchedulePaint(); | 71 SchedulePaint(); |
72 } | 72 } |
73 | 73 |
74 bool GuestUserView::AcceleratorPressed( | 74 bool GuestUserView::AcceleratorPressed( |
75 const views::Accelerator& accelerator) { | 75 const views::Accelerator& accelerator) { |
76 if (accelerator == accel_login_off_the_record_) | 76 if (accelerator == accel_login_off_the_record_) |
77 user_controller_->OnLoginAsGuest(); | 77 user_controller_->OnLoginAsGuest(); |
78 else if (accelerator == accel_toggle_accessibility_) | 78 else if (accelerator == accel_toggle_accessibility_) |
79 WizardAccessibilityHelper::GetInstance()->ToggleAccessibility(this); | 79 WizardAccessibilityHelper::GetInstance()->ToggleAccessibility(); |
80 else if (accelerator == accel_previous_pod_by_arrow_) | 80 else if (accelerator == accel_previous_pod_by_arrow_) |
81 user_controller_->SelectUserRelative(-1); | 81 user_controller_->SelectUserRelative(-1); |
82 else if (accelerator == accel_next_pod_by_arrow_) | 82 else if (accelerator == accel_next_pod_by_arrow_) |
83 user_controller_->SelectUserRelative(1); | 83 user_controller_->SelectUserRelative(1); |
84 else | 84 else |
85 return false; | 85 return false; |
86 return true; | 86 return true; |
87 } | 87 } |
88 | 88 |
89 void GuestUserView::RequestFocus() { | 89 void GuestUserView::RequestFocus() { |
90 submit_button_->RequestFocus(); | 90 submit_button_->RequestFocus(); |
91 } | 91 } |
92 | 92 |
93 void GuestUserView::ButtonPressed( | 93 void GuestUserView::ButtonPressed( |
94 views::Button* sender, const views::Event& event) { | 94 views::Button* sender, const views::Event& event) { |
95 DCHECK(sender == submit_button_); | 95 DCHECK(sender == submit_button_); |
96 user_controller_->OnLoginAsGuest(); | 96 user_controller_->OnLoginAsGuest(); |
97 } | 97 } |
98 | 98 |
99 void GuestUserView::EnableInputControls(bool enabled) { | 99 void GuestUserView::EnableInputControls(bool enabled) { |
100 submit_button_->SetEnabled(enabled); | 100 submit_button_->SetEnabled(enabled); |
101 } | 101 } |
102 | 102 |
103 void GuestUserView::ViewHierarchyChanged(bool is_add, | |
104 views::View* parent, | |
105 views::View* child) { | |
106 if (is_add && this == child) | |
107 WizardAccessibilityHelper::GetInstance()->MaybeEnableAccessibility(this); | |
108 } | |
109 | |
110 void GuestUserView::OnLocaleChanged() { | 103 void GuestUserView::OnLocaleChanged() { |
111 RecreateFields(); | 104 RecreateFields(); |
112 } | 105 } |
113 | 106 |
114 void GuestUserView::Layout() { | 107 void GuestUserView::Layout() { |
115 gfx::Size submit_button_size = submit_button_->GetPreferredSize(); | 108 gfx::Size submit_button_size = submit_button_->GetPreferredSize(); |
116 int submit_button_x = (width() - submit_button_size.width()) / 2; | 109 int submit_button_x = (width() - submit_button_size.width()) / 2; |
117 int submit_button_y = (height() - submit_button_size.height()) / 2; | 110 int submit_button_y = (height() - submit_button_size.height()) / 2; |
118 submit_button_->SetBounds(submit_button_x, | 111 submit_button_->SetBounds(submit_button_x, |
119 submit_button_y, | 112 submit_button_y, |
120 submit_button_size.width(), | 113 submit_button_size.width(), |
121 submit_button_size.height()); | 114 submit_button_size.height()); |
122 } | 115 } |
123 | 116 |
124 void GuestUserView::ClearAndFocusControls() { | 117 void GuestUserView::ClearAndFocusControls() { |
125 } | 118 } |
126 | 119 |
127 void GuestUserView::ClearAndFocusPassword() { | 120 void GuestUserView::ClearAndFocusPassword() { |
128 } | 121 } |
129 | 122 |
130 gfx::Rect GuestUserView::GetMainInputScreenBounds() const { | 123 gfx::Rect GuestUserView::GetMainInputScreenBounds() const { |
131 NOTREACHED(); | 124 NOTREACHED(); |
132 return gfx::Rect(); | 125 return gfx::Rect(); |
133 } | 126 } |
134 | 127 |
135 } // namespace chromeos | 128 } // namespace chromeos |
OLD | NEW |