Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: chrome/browser/chromeos/login/webui_screen_locker.h

Issue 8573004: Grab inputs on WebUI screen locker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move grab failure functions to anonymous namespace. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/webui_screen_locker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
70 // Event handler for client-event. 91 // Event handler for client-event.
71 CHROMEGTK_CALLBACK_1(WebUIScreenLocker, void, OnClientEvent, GdkEventClient*) 92 CHROMEGTK_CALLBACK_1(WebUIScreenLocker, void, OnClientEvent, GdkEventClient*)
72 93
94 // The screen locker window.
73 views::Widget* lock_window_; 95 views::Widget* lock_window_;
74 96
75 // Login UI implementation instance. 97 // Login UI implementation instance.
76 scoped_ptr<WebUILoginDisplay> login_display_; 98 scoped_ptr<WebUILoginDisplay> login_display_;
77 99
78 // Used for user image changed notifications. 100 // Used for user image changed notifications.
79 content::NotificationRegistrar registrar_; 101 content::NotificationRegistrar registrar_;
80 102
103 // True if the screen locker's window has been drawn.
104 bool drawn_;
105
106 // True if both mouse input and keyboard input are grabbed.
107 bool input_grabbed_;
108
109 base::WeakPtrFactory<WebUIScreenLocker> weak_factory_;
110
111 // The number times the widget tried to grab all focus.
112 int grab_failure_count_;
113
114 // Status of keyboard and mouse grab.
115 GdkGrabStatus kbd_grab_status_;
116 GdkGrabStatus mouse_grab_status_;
117
81 DISALLOW_COPY_AND_ASSIGN(WebUIScreenLocker); 118 DISALLOW_COPY_AND_ASSIGN(WebUIScreenLocker);
82 }; 119 };
83 120
84 } // namespace chromeos 121 } // namespace chromeos
85 122
86 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_SCREEN_LOCKER_H_ 123 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WEBUI_SCREEN_LOCKER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/webui_screen_locker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698