| 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCK_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCK_VIEW_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCK_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCK_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/chromeos/login/helper.h" | 9 #include "chrome/browser/chromeos/login/helper.h" |
| 10 #include "chrome/browser/chromeos/login/user_view.h" | 10 #include "chrome/browser/chromeos/login/user_view.h" |
| 11 #include "chrome/common/notification_observer.h" | 11 #include "chrome/common/notification_observer.h" |
| 12 #include "chrome/common/notification_registrar.h" | 12 #include "chrome/common/notification_registrar.h" |
| 13 #include "views/controls/textfield/textfield.h" | 13 #include "views/controls/textfield/textfield_controller.h" |
| 14 #include "views/view.h" | 14 #include "views/view.h" |
| 15 | 15 |
| 16 namespace views { | 16 namespace views { |
| 17 class ImageView; | 17 class ImageView; |
| 18 } // namespace views | 18 } // namespace views |
| 19 | 19 |
| 20 namespace chromeos { | 20 namespace chromeos { |
| 21 | 21 |
| 22 class ScreenLocker; | 22 class ScreenLocker; |
| 23 class UserView; | 23 class UserView; |
| 24 | 24 |
| 25 namespace test { | 25 namespace test { |
| 26 class ScreenLockerTester; | 26 class ScreenLockerTester; |
| 27 } // namespace test | 27 } // namespace test |
| 28 | 28 |
| 29 // ScreenLockView creates view components necessary to authenticate | 29 // ScreenLockView creates view components necessary to authenticate |
| 30 // a user to unlock the screen. | 30 // a user to unlock the screen. |
| 31 class ScreenLockView : public ThrobberHostView, | 31 class ScreenLockView : public ThrobberHostView, |
| 32 public views::Textfield::Controller, | 32 public views::TextfieldController, |
| 33 public NotificationObserver, | 33 public NotificationObserver, |
| 34 public UserView::Delegate { | 34 public UserView::Delegate { |
| 35 public: | 35 public: |
| 36 explicit ScreenLockView(ScreenLocker* screen_locker); | 36 explicit ScreenLockView(ScreenLocker* screen_locker); |
| 37 virtual ~ScreenLockView(); | 37 virtual ~ScreenLockView(); |
| 38 | 38 |
| 39 void Init(); | 39 void Init(); |
| 40 | 40 |
| 41 // Clears and sets the focus to the password field. | 41 // Clears and sets the focus to the password field. |
| 42 void ClearAndSetFocusToPassword(); | 42 void ClearAndSetFocusToPassword(); |
| 43 | 43 |
| 44 // Enable/Disable signout button. | 44 // Enable/Disable signout button. |
| 45 void SetSignoutEnabled(bool enabled); | 45 void SetSignoutEnabled(bool enabled); |
| 46 | 46 |
| 47 // Returns the bounds of the password field in ScreenLocker's coordinate. | 47 // Returns the bounds of the password field in ScreenLocker's coordinate. |
| 48 gfx::Rect GetPasswordBoundsRelativeTo(const views::View* view); | 48 gfx::Rect GetPasswordBoundsRelativeTo(const views::View* view); |
| 49 | 49 |
| 50 // views::View implementation: | 50 // views::View: |
| 51 virtual void SetEnabled(bool enabled); | 51 virtual void SetEnabled(bool enabled); |
| 52 virtual void Layout(); | 52 virtual void Layout(); |
| 53 virtual gfx::Size GetPreferredSize(); | 53 virtual gfx::Size GetPreferredSize(); |
| 54 | 54 |
| 55 // NotificationObserver implementation: | 55 // NotificationObserver: |
| 56 virtual void Observe(NotificationType type, | 56 virtual void Observe(NotificationType type, |
| 57 const NotificationSource& source, | 57 const NotificationSource& source, |
| 58 const NotificationDetails& details); | 58 const NotificationDetails& details); |
| 59 | 59 |
| 60 // views::Textfield::Controller implementation: | 60 // views::TextfieldController: |
| 61 virtual void ContentsChanged(views::Textfield* sender, | 61 virtual void ContentsChanged(views::Textfield* sender, |
| 62 const string16& new_contents); | 62 const string16& new_contents); |
| 63 virtual bool HandleKeyEvent(views::Textfield* sender, | 63 virtual bool HandleKeyEvent(views::Textfield* sender, |
| 64 const views::KeyEvent& keystroke); | 64 const views::KeyEvent& keystroke); |
| 65 | 65 |
| 66 // UserView::Delegate implementation: | 66 // UserView::Delegate: |
| 67 virtual void OnSignout(); | 67 virtual void OnSignout(); |
| 68 virtual bool IsUserSelected() const { return true; } | 68 virtual bool IsUserSelected() const { return true; } |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 friend class test::ScreenLockerTester; | 71 friend class test::ScreenLockerTester; |
| 72 | 72 |
| 73 UserView* user_view_; | 73 UserView* user_view_; |
| 74 | 74 |
| 75 // For editing the password. | 75 // For editing the password. |
| 76 views::Textfield* password_field_; | 76 views::Textfield* password_field_; |
| 77 | 77 |
| 78 // ScreenLocker is owned by itself. | 78 // ScreenLocker is owned by itself. |
| 79 ScreenLocker* screen_locker_; | 79 ScreenLocker* screen_locker_; |
| 80 | 80 |
| 81 NotificationRegistrar registrar_; | 81 NotificationRegistrar registrar_; |
| 82 | 82 |
| 83 // User's picture, signout button and password field. | 83 // User's picture, signout button and password field. |
| 84 views::View* main_; | 84 views::View* main_; |
| 85 | 85 |
| 86 // Username that overlays on top of user's picture. | 86 // Username that overlays on top of user's picture. |
| 87 views::View* username_; | 87 views::View* username_; |
| 88 | 88 |
| 89 DISALLOW_COPY_AND_ASSIGN(ScreenLockView); | 89 DISALLOW_COPY_AND_ASSIGN(ScreenLockView); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 } // namespace chromeos | 92 } // namespace chromeos |
| 93 | 93 |
| 94 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCK_VIEW_H_ | 94 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCK_VIEW_H_ |
| OLD | NEW |