| 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" |
| 11 #include "chrome/browser/chromeos/login/user_manager.h" | 11 #include "chrome/browser/chromeos/login/user_manager.h" |
| 12 #include "chrome/browser/chromeos/login/user_view.h" | 12 #include "chrome/browser/chromeos/login/user_view.h" |
| 13 #include "chrome/browser/chromeos/login/username_view.h" | 13 #include "chrome/browser/chromeos/login/username_view.h" |
| 14 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" | 14 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" |
| 15 #include "chrome/browser/chromeos/views/copy_background.h" | 15 #include "chrome/browser/chromeos/views/copy_background.h" |
| 16 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
| 17 #include "chrome/common/chrome_notification_types.h" |
| 17 #include "content/common/notification_service.h" | 18 #include "content/common/notification_service.h" |
| 18 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 19 #include "grit/theme_resources.h" | 20 #include "grit/theme_resources.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
| 22 #include "views/background.h" | 23 #include "views/background.h" |
| 23 #include "views/border.h" | 24 #include "views/border.h" |
| 24 #include "views/controls/image_view.h" | 25 #include "views/controls/image_view.h" |
| 25 #include "views/controls/label.h" | 26 #include "views/controls/label.h" |
| 26 #include "views/controls/textfield/native_textfield_wrapper.h" | 27 #include "views/controls/textfield/native_textfield_wrapper.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 main_->SetBounds(0, 0, width(), height()); | 110 main_->SetBounds(0, 0, width(), height()); |
| 110 username_->SetBounds( | 111 username_->SetBounds( |
| 111 kBorderSize, | 112 kBorderSize, |
| 112 login::kUserImageSize - username_height + kBorderSize, | 113 login::kUserImageSize - username_height + kBorderSize, |
| 113 login::kUserImageSize, | 114 login::kUserImageSize, |
| 114 username_height); | 115 username_height); |
| 115 } | 116 } |
| 116 | 117 |
| 117 void ScreenLockView::Init() { | 118 void ScreenLockView::Init() { |
| 118 registrar_.Add(this, | 119 registrar_.Add(this, |
| 119 NotificationType::LOGIN_USER_IMAGE_CHANGED, | 120 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, |
| 120 NotificationService::AllSources()); | 121 NotificationService::AllSources()); |
| 121 | 122 |
| 122 user_view_ = new UserView(this, | 123 user_view_ = new UserView(this, |
| 123 false, // is_login | 124 false, // is_login |
| 124 true); // need_background | 125 true); // need_background |
| 125 main_ = new views::View(); | 126 main_ = new views::View(); |
| 126 // Use rounded rect background. | 127 // Use rounded rect background. |
| 127 views::Painter* painter = | 128 views::Painter* painter = |
| 128 CreateWizardPainter(&BorderDefinition::kUserBorder); | 129 CreateWizardPainter(&BorderDefinition::kUserBorder); |
| 129 | 130 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 const views::KeyEvent& key_event) { | 244 const views::KeyEvent& key_event) { |
| 244 screen_locker_->ClearErrors(); | 245 screen_locker_->ClearErrors(); |
| 245 if (key_event.key_code() == ui::VKEY_RETURN) { | 246 if (key_event.key_code() == ui::VKEY_RETURN) { |
| 246 screen_locker_->Authenticate(password_field_->text()); | 247 screen_locker_->Authenticate(password_field_->text()); |
| 247 return true; | 248 return true; |
| 248 } | 249 } |
| 249 return false; | 250 return false; |
| 250 } | 251 } |
| 251 | 252 |
| 252 void ScreenLockView::Observe( | 253 void ScreenLockView::Observe( |
| 253 NotificationType type, | 254 int type, |
| 254 const NotificationSource& source, | 255 const NotificationSource& source, |
| 255 const NotificationDetails& details) { | 256 const NotificationDetails& details) { |
| 256 if (type != NotificationType::LOGIN_USER_IMAGE_CHANGED || !user_view_) | 257 if (type != chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED || !user_view_) |
| 257 return; | 258 return; |
| 258 | 259 |
| 259 UserManager::User* user = Details<UserManager::User>(details).ptr(); | 260 UserManager::User* user = Details<UserManager::User>(details).ptr(); |
| 260 if (screen_locker_->user().email() != user->email()) | 261 if (screen_locker_->user().email() != user->email()) |
| 261 return; | 262 return; |
| 262 user_view_->SetImage(user->image(), user->image()); | 263 user_view_->SetImage(user->image(), user->image()); |
| 263 } | 264 } |
| 264 | 265 |
| 265 } // namespace chromeos | 266 } // namespace chromeos |
| OLD | NEW |