| 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/screen_lock_view.h" | 5 #include "chrome/browser/chromeos/login/screen_lock_view.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" | 8 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" |
| 9 #include "chrome/browser/chromeos/login/screen_locker.h" | 9 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 10 #include "chrome/browser/chromeos/login/textfield_with_margin.h" | 10 #include "chrome/browser/chromeos/login/textfield_with_margin.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 main_->SetBounds(0, 0, width(), height()); | 109 main_->SetBounds(0, 0, width(), height()); |
| 110 username_->SetBounds( | 110 username_->SetBounds( |
| 111 kBorderSize, | 111 kBorderSize, |
| 112 login::kUserImageSize - username_height + kBorderSize, | 112 login::kUserImageSize - username_height + kBorderSize, |
| 113 login::kUserImageSize, | 113 login::kUserImageSize, |
| 114 username_height); | 114 username_height); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void ScreenLockView::Init() { | 117 void ScreenLockView::Init() { |
| 118 registrar_.Add(this, | 118 registrar_.Add(this, |
| 119 NotificationType::LOGIN_USER_IMAGE_CHANGED, | 119 chrome::LOGIN_USER_IMAGE_CHANGED, |
| 120 NotificationService::AllSources()); | 120 NotificationService::AllSources()); |
| 121 | 121 |
| 122 user_view_ = new UserView(this, | 122 user_view_ = new UserView(this, |
| 123 false, // is_login | 123 false, // is_login |
| 124 true); // need_background | 124 true); // need_background |
| 125 main_ = new views::View(); | 125 main_ = new views::View(); |
| 126 // Use rounded rect background. | 126 // Use rounded rect background. |
| 127 views::Painter* painter = | 127 views::Painter* painter = |
| 128 CreateWizardPainter(&BorderDefinition::kUserBorder); | 128 CreateWizardPainter(&BorderDefinition::kUserBorder); |
| 129 | 129 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 const views::KeyEvent& key_event) { | 243 const views::KeyEvent& key_event) { |
| 244 screen_locker_->ClearErrors(); | 244 screen_locker_->ClearErrors(); |
| 245 if (key_event.key_code() == ui::VKEY_RETURN) { | 245 if (key_event.key_code() == ui::VKEY_RETURN) { |
| 246 screen_locker_->Authenticate(password_field_->text()); | 246 screen_locker_->Authenticate(password_field_->text()); |
| 247 return true; | 247 return true; |
| 248 } | 248 } |
| 249 return false; | 249 return false; |
| 250 } | 250 } |
| 251 | 251 |
| 252 void ScreenLockView::Observe( | 252 void ScreenLockView::Observe( |
| 253 NotificationType type, | 253 int type, |
| 254 const NotificationSource& source, | 254 const NotificationSource& source, |
| 255 const NotificationDetails& details) { | 255 const NotificationDetails& details) { |
| 256 if (type != NotificationType::LOGIN_USER_IMAGE_CHANGED || !user_view_) | 256 if (type != chrome::LOGIN_USER_IMAGE_CHANGED || !user_view_) |
| 257 return; | 257 return; |
| 258 | 258 |
| 259 UserManager::User* user = Details<UserManager::User>(details).ptr(); | 259 UserManager::User* user = Details<UserManager::User>(details).ptr(); |
| 260 if (screen_locker_->user().email() != user->email()) | 260 if (screen_locker_->user().email() != user->email()) |
| 261 return; | 261 return; |
| 262 user_view_->SetImage(user->image(), user->image()); | 262 user_view_->SetImage(user->image(), user->image()); |
| 263 } | 263 } |
| 264 | 264 |
| 265 } // namespace chromeos | 265 } // namespace chromeos |
| OLD | NEW |