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

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

Issue 5709001: Place the spinner in the right corner of the controls window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/chromeos/login
Patch Set: nits 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/screen_lock_view.h" 5 #include "chrome/browser/chromeos/login/screen_lock_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/chromeos/login/helper.h"
11 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" 10 #include "chrome/browser/chromeos/login/rounded_rect_painter.h"
12 #include "chrome/browser/chromeos/login/screen_locker.h" 11 #include "chrome/browser/chromeos/login/screen_locker.h"
13 #include "chrome/browser/chromeos/login/user_manager.h" 12 #include "chrome/browser/chromeos/login/user_manager.h"
14 #include "chrome/browser/chromeos/login/user_view.h" 13 #include "chrome/browser/chromeos/login/user_view.h"
15 #include "chrome/browser/chromeos/login/username_view.h" 14 #include "chrome/browser/chromeos/login/username_view.h"
16 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" 15 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h"
17 #include "chrome/browser/chromeos/login/textfield_with_margin.h" 16 #include "chrome/browser/chromeos/login/textfield_with_margin.h"
18 #include "chrome/browser/chromeos/views/copy_background.h" 17 #include "chrome/browser/chromeos/views/copy_background.h"
19 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/common/notification_service.h" 19 #include "chrome/common/notification_service.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 59
61 ScreenLockView::ScreenLockView(ScreenLocker* screen_locker) 60 ScreenLockView::ScreenLockView(ScreenLocker* screen_locker)
62 : user_view_(NULL), 61 : user_view_(NULL),
63 password_field_(NULL), 62 password_field_(NULL),
64 screen_locker_(screen_locker), 63 screen_locker_(screen_locker),
65 main_(NULL), 64 main_(NULL),
66 username_(NULL) { 65 username_(NULL) {
67 DCHECK(screen_locker_); 66 DCHECK(screen_locker_);
68 } 67 }
69 68
69 ScreenLockView::~ScreenLockView() {
70 }
71
70 gfx::Size ScreenLockView::GetPreferredSize() { 72 gfx::Size ScreenLockView::GetPreferredSize() {
71 return main_->GetPreferredSize(); 73 return main_->GetPreferredSize();
72 } 74 }
73 75
74 void ScreenLockView::Layout() { 76 void ScreenLockView::Layout() {
75 int username_height = login::kSelectedLabelHeight; 77 int username_height = login::kSelectedLabelHeight;
76 main_->SetBounds(0, 0, width(), height()); 78 main_->SetBounds(0, 0, width(), height());
77 username_->SetBounds( 79 username_->SetBounds(
78 kBorderSize, 80 kBorderSize,
79 login::kUserImageSize - username_height + kBorderSize, 81 login::kUserImageSize - username_height + kBorderSize,
(...skipping 13 matching lines...) Expand all
93 // Use rounded rect background. 95 // Use rounded rect background.
94 views::Painter* painter = 96 views::Painter* painter =
95 CreateWizardPainter(&BorderDefinition::kUserBorder); 97 CreateWizardPainter(&BorderDefinition::kUserBorder);
96 98
97 main_->set_background( 99 main_->set_background(
98 views::Background::CreateBackgroundPainter(true, painter)); 100 views::Background::CreateBackgroundPainter(true, painter));
99 main_->set_border(CreateWizardBorder(&BorderDefinition::kUserBorder)); 101 main_->set_border(CreateWizardBorder(&BorderDefinition::kUserBorder));
100 102
101 // Password field. 103 // Password field.
102 password_field_ = new PasswordField(); 104 password_field_ = new PasswordField();
105
103 password_field_->SetController(this); 106 password_field_->SetController(this);
104 password_field_->set_background(new CopyBackground(main_)); 107 password_field_->set_background(new CopyBackground(main_));
105 108
109 // Setup ThrobberView's host view.
110 set_host_view(password_field_);
111
106 // User icon. 112 // User icon.
107 UserManager::User user = screen_locker_->user(); 113 UserManager::User user = screen_locker_->user();
108 user_view_->SetImage(user.image(), user.image()); 114 user_view_->SetImage(user.image(), user.image());
109 115
110 // User name. 116 // User name.
111 std::wstring text = UTF8ToWide(user.GetDisplayName()); 117 std::wstring text = UTF8ToWide(user.GetDisplayName());
112 118
113 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 119 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
114 const gfx::Font& font = rb.GetFont(ResourceBundle::MediumBoldFont); 120 const gfx::Font& font = rb.GetFont(ResourceBundle::MediumBoldFont);
115 121
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 void ScreenLockView::SetSignoutEnabled(bool enabled) { 159 void ScreenLockView::SetSignoutEnabled(bool enabled) {
154 user_view_->SetSignoutEnabled(enabled); 160 user_view_->SetSignoutEnabled(enabled);
155 } 161 }
156 162
157 gfx::Rect ScreenLockView::GetPasswordBoundsRelativeTo(const views::View* view) { 163 gfx::Rect ScreenLockView::GetPasswordBoundsRelativeTo(const views::View* view) {
158 gfx::Point p; 164 gfx::Point p;
159 views::View::ConvertPointToView(password_field_, view, &p); 165 views::View::ConvertPointToView(password_field_, view, &p);
160 return gfx::Rect(p, size()); 166 return gfx::Rect(p, size());
161 } 167 }
162 168
169
163 void ScreenLockView::SetEnabled(bool enabled) { 170 void ScreenLockView::SetEnabled(bool enabled) {
164 views::View::SetEnabled(enabled); 171 views::View::SetEnabled(enabled);
165 172
166 if (!enabled) { 173 if (!enabled) {
167 user_view_->StartThrobber();
168 // TODO(oshima): Re-enabling does not move the focus to the view 174 // TODO(oshima): Re-enabling does not move the focus to the view
169 // that had a focus (issue http://crbug.com/43131). 175 // that had a focus (issue http://crbug.com/43131).
170 // Clear focus on the textfield so that re-enabling can set focus 176 // Clear focus on the textfield so that re-enabling can set focus
171 // back to the text field. 177 // back to the text field.
172 // FocusManager may be null if the view does not have 178 // FocusManager may be null if the view does not have
173 // associated Widget yet. 179 // associated Widget yet.
174 if (password_field_->GetFocusManager()) 180 if (password_field_->GetFocusManager())
175 password_field_->GetFocusManager()->ClearFocus(); 181 password_field_->GetFocusManager()->ClearFocus();
176 } else {
177 user_view_->StopThrobber();
178 } 182 }
179 password_field_->SetEnabled(enabled); 183 password_field_->SetEnabled(enabled);
180 } 184 }
181 185
182 void ScreenLockView::OnSignout() { 186 void ScreenLockView::OnSignout() {
183 screen_locker_->Signout(); 187 screen_locker_->Signout();
184 } 188 }
185 189
186 bool ScreenLockView::HandleKeystroke( 190 bool ScreenLockView::HandleKeystroke(
187 views::Textfield* sender, 191 views::Textfield* sender,
(...skipping 18 matching lines...) Expand all
206 return; 210 return;
207 user_view_->SetImage(user->image(), user->image()); 211 user_view_->SetImage(user->image(), user->image());
208 } 212 }
209 213
210 void ScreenLockView::ViewHierarchyChanged(bool is_add, 214 void ScreenLockView::ViewHierarchyChanged(bool is_add,
211 views::View* parent, 215 views::View* parent,
212 views::View* child) { 216 views::View* child) {
213 if (is_add && this == child) 217 if (is_add && this == child)
214 WizardAccessibilityHelper::GetInstance()->MaybeEnableAccessibility(this); 218 WizardAccessibilityHelper::GetInstance()->MaybeEnableAccessibility(this);
215 } 219 }
220
216 } // namespace chromeos 221 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/screen_lock_view.h ('k') | chrome/browser/chromeos/login/screen_locker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698