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_WEBUI_SCREEN_LOCKER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_SCREEN_LOCKER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_SCREEN_LOCKER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_SCREEN_LOCKER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... | |
28 | 28 |
29 // This version of ScreenLockerDelegate displays a WebUI lock screen based on | 29 // This version of ScreenLockerDelegate displays a WebUI lock screen based on |
30 // the Oobe account picker screen. | 30 // the Oobe account picker screen. |
31 class WebUIScreenLocker : public WebUILoginView, | 31 class WebUIScreenLocker : public WebUILoginView, |
32 public LoginDisplay::Delegate, | 32 public LoginDisplay::Delegate, |
33 public content::NotificationObserver, | 33 public content::NotificationObserver, |
34 public ScreenLockerDelegate { | 34 public ScreenLockerDelegate { |
35 public: | 35 public: |
36 explicit WebUIScreenLocker(ScreenLocker* screen_locker); | 36 explicit WebUIScreenLocker(ScreenLocker* screen_locker); |
37 | 37 |
38 // Called when the GTK grab breaks. | |
39 void HandleGtkGrabBroke(); | |
40 | |
38 // ScreenLockerDelegate implementation: | 41 // ScreenLockerDelegate implementation: |
39 virtual void LockScreen(bool unlock_on_input) OVERRIDE; | 42 virtual void LockScreen(bool unlock_on_input) OVERRIDE; |
40 virtual void ScreenLockReady() OVERRIDE; | 43 virtual void ScreenLockReady() OVERRIDE; |
41 virtual void OnAuthenticate() OVERRIDE; | 44 virtual void OnAuthenticate() OVERRIDE; |
42 virtual void SetInputEnabled(bool enabled) OVERRIDE; | 45 virtual void SetInputEnabled(bool enabled) OVERRIDE; |
43 virtual void SetSignoutEnabled(bool enabled) OVERRIDE; | 46 virtual void SetSignoutEnabled(bool enabled) OVERRIDE; |
44 virtual void ShowErrorMessage(const string16& message, | 47 virtual void ShowErrorMessage(const string16& message, |
45 bool sign_out_only) OVERRIDE; | 48 bool sign_out_only) OVERRIDE; |
46 virtual void ShowCaptchaAndErrorMessage(const GURL& captcha_url, | 49 virtual void ShowCaptchaAndErrorMessage(const GURL& captcha_url, |
47 const string16& message) OVERRIDE; | 50 const string16& message) OVERRIDE; |
(...skipping 12 matching lines...) Expand all Loading... | |
60 virtual void OnStartEnterpriseEnrollment() OVERRIDE; | 63 virtual void OnStartEnterpriseEnrollment() OVERRIDE; |
61 | 64 |
62 // content::NotificationObserver implementation. | 65 // content::NotificationObserver implementation. |
63 virtual void Observe(int type, | 66 virtual void Observe(int type, |
64 const content::NotificationSource& source, | 67 const content::NotificationSource& source, |
65 const content::NotificationDetails& details); | 68 const content::NotificationDetails& details); |
66 | 69 |
67 private: | 70 private: |
68 virtual ~WebUIScreenLocker(); | 71 virtual ~WebUIScreenLocker(); |
69 | 72 |
73 // Called when the window manager is ready to handle locked state. | |
74 void OnWindowManagerReady(); | |
75 | |
76 // Called when the all inputs are grabbed. | |
77 void OnGrabInputs(); | |
78 | |
79 // Clear current GTK grab. | |
80 void ClearGtkGrab(); | |
81 | |
82 // Try to grab all inputs. It initiates another try if it fails to | |
83 // grab and the retry count is within a limit, or fails with CHECK. | |
84 void TryGrabAllInputs(); | |
85 | |
86 // This method tries to steal pointer/keyboard grab from other | |
87 // client by sending events that will hopefully close menus or windows | |
88 // that have the grab. | |
89 void TryUngrabOtherClients(); | |
90 | |
91 // Define separate methods for each error code so that stack trace | |
92 // will tell which error the grab failed with. | |
93 void FailedWithGrabAlreadyGrabbed(); | |
94 void FailedWithGrabInvalidTime(); | |
95 void FailedWithGrabNotViewable(); | |
96 void FailedWithGrabFrozen(); | |
97 void FailedWithUnknownError(); | |
oshima
2011/11/18 22:44:55
These can be in anonymous namepsace in .cc.
(These
flackr
2011/11/18 22:57:32
Done.
| |
98 | |
70 // Event handler for client-event. | 99 // Event handler for client-event. |
71 CHROMEGTK_CALLBACK_1(WebUIScreenLocker, void, OnClientEvent, GdkEventClient*) | 100 CHROMEGTK_CALLBACK_1(WebUIScreenLocker, void, OnClientEvent, GdkEventClient*) |
72 | 101 |
102 // The screen locker window. | |
73 views::Widget* lock_window_; | 103 views::Widget* lock_window_; |
74 | 104 |
75 // Login UI implementation instance. | 105 // Login UI implementation instance. |
76 scoped_ptr<WebUILoginDisplay> login_display_; | 106 scoped_ptr<WebUILoginDisplay> login_display_; |
77 | 107 |
78 // Used for user image changed notifications. | 108 // Used for user image changed notifications. |
79 content::NotificationRegistrar registrar_; | 109 content::NotificationRegistrar registrar_; |
80 | 110 |
111 // True if the screen locker's window has been drawn. | |
112 bool drawn_; | |
113 | |
114 // True if both mouse input and keyboard input are grabbed. | |
115 bool input_grabbed_; | |
116 | |
117 base::WeakPtrFactory<WebUIScreenLocker> weak_factory_; | |
118 | |
119 // The number times the widget tried to grab all focus. | |
120 int grab_failure_count_; | |
121 | |
122 // Status of keyboard and mouse grab. | |
123 GdkGrabStatus kbd_grab_status_; | |
124 GdkGrabStatus mouse_grab_status_; | |
125 | |
81 DISALLOW_COPY_AND_ASSIGN(WebUIScreenLocker); | 126 DISALLOW_COPY_AND_ASSIGN(WebUIScreenLocker); |
82 }; | 127 }; |
83 | 128 |
84 } // namespace chromeos | 129 } // namespace chromeos |
85 | 130 |
86 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_SCREEN_LOCKER_H_ | 131 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_SCREEN_LOCKER_H_ |
OLD | NEW |