OLD | NEW |
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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/task.h" | 10 #include "base/task.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 // Close message bubble to clear error messages. | 59 // Close message bubble to clear error messages. |
60 void ClearErrors(); | 60 void ClearErrors(); |
61 | 61 |
62 // (Re)enable input field. | 62 // (Re)enable input field. |
63 void EnableInput(); | 63 void EnableInput(); |
64 | 64 |
65 // Exit the chrome, which will sign out the current session. | 65 // Exit the chrome, which will sign out the current session. |
66 void Signout(); | 66 void Signout(); |
67 | 67 |
68 // Called when the screen locker is ready. | 68 // Called when the all inputs are grabbed. |
69 void ScreenLockReady(); | 69 void OnGrabInputs(); |
70 | 70 |
71 // Returns the user to authenticate. | 71 // Returns the user to authenticate. |
72 const UserManager::User& user() const { | 72 const UserManager::User& user() const { |
73 return user_; | 73 return user_; |
74 } | 74 } |
75 | 75 |
76 // Initialize ScreenLocker class. It will listen to | 76 // Initialize ScreenLocker class. It will listen to |
77 // LOGIN_USER_CHANGED notification so that the screen locker accepts | 77 // LOGIN_USER_CHANGED notification so that the screen locker accepts |
78 // lock event only after a user is logged in. | 78 // lock event only after a user is logged in. |
79 static void InitClass(); | 79 static void InitClass(); |
(...skipping 12 matching lines...) Expand all Loading... |
92 | 92 |
93 private: | 93 private: |
94 friend class DeleteTask<ScreenLocker>; | 94 friend class DeleteTask<ScreenLocker>; |
95 friend class test::ScreenLockerTester; | 95 friend class test::ScreenLockerTester; |
96 | 96 |
97 virtual ~ScreenLocker(); | 97 virtual ~ScreenLocker(); |
98 | 98 |
99 // Sets the authenticator. | 99 // Sets the authenticator. |
100 void SetAuthenticator(Authenticator* authenticator); | 100 void SetAuthenticator(Authenticator* authenticator); |
101 | 101 |
| 102 // Called when the screen lock is ready. |
| 103 void ScreenLockReady(); |
| 104 |
| 105 // Event handler for map-event. |
| 106 CHROMEGTK_CALLBACK_1(ScreenLocker, void, OnMap, GdkEvent*); |
| 107 |
102 // The screen locker window. | 108 // The screen locker window. |
103 views::WidgetGtk* lock_window_; | 109 views::WidgetGtk* lock_window_; |
104 | 110 |
105 // TYPE_CHILD widget to grab the keyboard/mouse input. | 111 // TYPE_CHILD widget to grab the keyboard/mouse input. |
106 views::WidgetGtk* lock_widget_; | 112 views::WidgetGtk* lock_widget_; |
107 | 113 |
108 // A view that accepts password. | 114 // A view that accepts password. |
109 ScreenLockView* screen_lock_view_; | 115 ScreenLockView* screen_lock_view_; |
110 | 116 |
111 // Logged in user. | 117 // Logged in user. |
112 UserManager::User user_; | 118 UserManager::User user_; |
113 | 119 |
114 // Used to authenticate the user to unlock. | 120 // Used to authenticate the user to unlock. |
115 scoped_refptr<Authenticator> authenticator_; | 121 scoped_refptr<Authenticator> authenticator_; |
116 | 122 |
117 // ScreenLocker grabs all keyboard and mouse events on its | 123 // ScreenLocker grabs all keyboard and mouse events on its |
118 // gdk window and never let other gdk_window to handle inputs. | 124 // gdk window and never let other gdk_window to handle inputs. |
119 // This MouseEventRelay object is used to forward events to | 125 // This MouseEventRelay object is used to forward events to |
120 // the message bubble's gdk_window so that close button works. | 126 // the message bubble's gdk_window so that close button works. |
121 scoped_ptr<MouseEventRelay> mouse_event_relay_; | 127 scoped_ptr<MouseEventRelay> mouse_event_relay_; |
122 | 128 |
123 // An info bubble to display login failure message. | 129 // An info bubble to display login failure message. |
124 MessageBubble* error_info_; | 130 MessageBubble* error_info_; |
125 | 131 |
| 132 // True if the screen locker's window is mapped. |
| 133 bool mapped_; |
| 134 |
| 135 // True if both mouse input and keyboard input are grabbed. |
| 136 bool input_grabbed_; |
| 137 |
126 // Reference to the single instance of the screen locker object. | 138 // Reference to the single instance of the screen locker object. |
127 // This is used to make sure there is only one screen locker instance. | 139 // This is used to make sure there is only one screen locker instance. |
128 static ScreenLocker* screen_locker_; | 140 static ScreenLocker* screen_locker_; |
129 | 141 |
130 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); | 142 DISALLOW_COPY_AND_ASSIGN(ScreenLocker); |
131 }; | 143 }; |
132 | 144 |
133 } // namespace chromeos | 145 } // namespace chromeos |
134 | 146 |
135 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_H_ | 147 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREEN_LOCKER_H_ |
OLD | NEW |