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

Side by Side Diff: chrome/browser/chromeos/login/new_user_view.cc

Issue 5839003: Fix to enable toggling accessibility using Ctrl+Alt+Z (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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) 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/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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 splitter_down1_(NULL), 91 splitter_down1_(NULL),
92 splitter_down2_(NULL), 92 splitter_down2_(NULL),
93 sign_in_button_(NULL), 93 sign_in_button_(NULL),
94 create_account_link_(NULL), 94 create_account_link_(NULL),
95 guest_link_(NULL), 95 guest_link_(NULL),
96 languages_menubutton_(NULL), 96 languages_menubutton_(NULL),
97 accel_focus_pass_(views::Accelerator(app::VKEY_P, false, false, true)), 97 accel_focus_pass_(views::Accelerator(app::VKEY_P, false, false, true)),
98 accel_focus_user_(views::Accelerator(app::VKEY_U, false, false, true)), 98 accel_focus_user_(views::Accelerator(app::VKEY_U, false, false, true)),
99 accel_login_off_the_record_( 99 accel_login_off_the_record_(
100 views::Accelerator(app::VKEY_B, false, false, true)), 100 views::Accelerator(app::VKEY_B, false, false, true)),
101 accel_enable_accessibility_(WizardAccessibilityHelper::GetAccelerator()), 101 accel_toggle_accessibility_(WizardAccessibilityHelper::GetAccelerator()),
102 delegate_(delegate), 102 delegate_(delegate),
103 ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)), 103 ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)),
104 focus_delayed_(false), 104 focus_delayed_(false),
105 login_in_process_(false), 105 login_in_process_(false),
106 need_border_(need_border), 106 need_border_(need_border),
107 need_guest_link_(false), 107 need_guest_link_(false),
108 need_create_account_(false), 108 need_create_account_(false),
109 languages_menubutton_order_(-1), 109 languages_menubutton_order_(-1),
110 sign_in_button_order_(-1) { 110 sign_in_button_order_(-1) {
111 if (need_guest_link && UserCrosSettingsProvider::cached_allow_guest()) 111 if (need_guest_link && UserCrosSettingsProvider::cached_allow_guest())
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 title_hint_label_->SetMultiLine(true); 143 title_hint_label_->SetMultiLine(true);
144 AddChildView(title_hint_label_); 144 AddChildView(title_hint_label_);
145 145
146 splitter_up1_ = CreateSplitter(kSplitterUp1Color); 146 splitter_up1_ = CreateSplitter(kSplitterUp1Color);
147 splitter_up2_ = CreateSplitter(kSplitterUp2Color); 147 splitter_up2_ = CreateSplitter(kSplitterUp2Color);
148 splitter_down1_ = CreateSplitter(kSplitterDown1Color); 148 splitter_down1_ = CreateSplitter(kSplitterDown1Color);
149 splitter_down2_ = CreateSplitter(kSplitterDown2Color); 149 splitter_down2_ = CreateSplitter(kSplitterDown2Color);
150 150
151 username_field_ = new UsernameField(); 151 username_field_ = new UsernameField();
152 username_field_->set_background(new CopyBackground(this)); 152 username_field_->set_background(new CopyBackground(this));
153 username_field_->SetAccessibleName(std::wstring(L"Username"));
Chaitanya 2010/12/15 23:19:56 I'd like to i18n the string literal "Username". Ho
xiyuan 2010/12/16 00:09:20 check out base/utf_string_conversions.h, assuming
oshima 2010/12/16 00:36:53 Just wondering, why this is not i18n? For pure asc
153 AddChildView(username_field_); 154 AddChildView(username_field_);
154 155
155 password_field_ = new TextfieldWithMargin(views::Textfield::STYLE_PASSWORD); 156 password_field_ = new TextfieldWithMargin(views::Textfield::STYLE_PASSWORD);
156 password_field_->set_background(new CopyBackground(this)); 157 password_field_->set_background(new CopyBackground(this));
157 AddChildView(password_field_); 158 AddChildView(password_field_);
158 159
159 language_switch_menu_.InitLanguageMenu(); 160 language_switch_menu_.InitLanguageMenu();
160 161
161 RecreatePeculiarControls(); 162 RecreatePeculiarControls();
162 163
163 AddChildView(sign_in_button_); 164 AddChildView(sign_in_button_);
164 if (need_create_account_) { 165 if (need_create_account_) {
165 InitLink(&create_account_link_); 166 InitLink(&create_account_link_);
166 } 167 }
167 if (need_guest_link_) { 168 if (need_guest_link_) {
168 InitLink(&guest_link_); 169 InitLink(&guest_link_);
169 } 170 }
170 AddChildView(languages_menubutton_); 171 AddChildView(languages_menubutton_);
171 172
172 // Set up accelerators. 173 // Set up accelerators.
173 AddAccelerator(accel_focus_user_); 174 AddAccelerator(accel_focus_user_);
174 AddAccelerator(accel_focus_pass_); 175 AddAccelerator(accel_focus_pass_);
175 AddAccelerator(accel_login_off_the_record_); 176 AddAccelerator(accel_login_off_the_record_);
176 AddAccelerator(accel_enable_accessibility_); 177 AddAccelerator(accel_toggle_accessibility_);
177 178
178 OnLocaleChanged(); 179 OnLocaleChanged();
179 180
180 // Controller to handle events from textfields 181 // Controller to handle events from textfields
181 username_field_->SetController(this); 182 username_field_->SetController(this);
182 password_field_->SetController(this); 183 password_field_->SetController(this);
183 if (!CrosLibrary::Get()->EnsureLoaded()) { 184 if (!CrosLibrary::Get()->EnsureLoaded()) {
184 EnableInputControls(false); 185 EnableInputControls(false);
185 } 186 }
186 187
187 // The 'Sign in' button should be disabled when there is no text in the 188 // The 'Sign in' button should be disabled when there is no text in the
188 // username and password fields. 189 // username and password fields.
189 sign_in_button_->SetEnabled(false); 190 sign_in_button_->SetEnabled(false);
190 } 191 }
191 192
192 bool NewUserView::AcceleratorPressed(const views::Accelerator& accelerator) { 193 bool NewUserView::AcceleratorPressed(const views::Accelerator& accelerator) {
193 if (accelerator == accel_focus_user_) { 194 if (accelerator == accel_focus_user_) {
194 username_field_->RequestFocus(); 195 username_field_->RequestFocus();
195 } else if (accelerator == accel_focus_pass_) { 196 } else if (accelerator == accel_focus_pass_) {
196 password_field_->RequestFocus(); 197 password_field_->RequestFocus();
197 } else if (accelerator == accel_login_off_the_record_) { 198 } else if (accelerator == accel_login_off_the_record_) {
198 delegate_->OnLoginOffTheRecord(); 199 delegate_->OnLoginOffTheRecord();
199 } else if (accelerator == accel_enable_accessibility_) { 200 } else if (accelerator == accel_toggle_accessibility_) {
200 WizardAccessibilityHelper::GetInstance()->EnableAccessibility(this); 201 WizardAccessibilityHelper::GetInstance()->ToggleAccessibility(this);
201 } else { 202 } else {
202 return false; 203 return false;
203 } 204 }
204 return true; 205 return true;
205 } 206 }
206 207
207 void NewUserView::RecreatePeculiarControls() { 208 void NewUserView::RecreatePeculiarControls() {
208 // PreferredSize reported by MenuButton (and TextField) is not able 209 // PreferredSize reported by MenuButton (and TextField) is not able
209 // to shrink, only grow; so recreate on text change. 210 // to shrink, only grow; so recreate on text change.
210 delete languages_menubutton_; 211 delete languages_menubutton_;
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 545
545 void NewUserView::InitLink(views::Link** link) { 546 void NewUserView::InitLink(views::Link** link) {
546 *link = new views::Link(std::wstring()); 547 *link = new views::Link(std::wstring());
547 (*link)->SetController(this); 548 (*link)->SetController(this);
548 (*link)->SetNormalColor(login::kLinkColor); 549 (*link)->SetNormalColor(login::kLinkColor);
549 (*link)->SetHighlightedColor(login::kLinkColor); 550 (*link)->SetHighlightedColor(login::kLinkColor);
550 AddChildView(*link); 551 AddChildView(*link);
551 } 552 }
552 553
553 } // namespace chromeos 554 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698