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

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

Issue 8711003: Enable WebUI ScreenLocker for aura by abstracting lock window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewer comments. Created 9 years 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_WINDOW_GTK_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_WINDOW_GTK_H_
7 #pragma once
8
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/chromeos/login/lock_window.h"
12 #include "chrome/browser/chromeos/login/screen_locker_delegate.h"
13 #include "ui/views/widget/native_widget_gtk.h"
14
15 namespace chromeos {
16
17 // A ScreenLock window that covers entire screen to keep the keyboard
18 // focus/events inside the grab widget.
19 class LockWindowGtk : public views::NativeWidgetGtk,
20 public LockWindow {
21 public:
22 // LockWindow implementation:
23 virtual void Grab(DOMView* dom_view) OVERRIDE;
24 virtual views::Widget* GetWidget() OVERRIDE;
25
26 protected:
27 // NativeWidgetGtk overrides:
28 virtual gboolean OnButtonPress(GtkWidget* widget,
29 GdkEventButton* event) OVERRIDE;
30 virtual void OnDestroy(GtkWidget* object) OVERRIDE;
31 virtual void ClearNativeFocus() OVERRIDE;
32 virtual void HandleGtkGrabBroke() OVERRIDE;
33
34 private:
35 friend class LockWindow;
36
37 LockWindowGtk();
38 virtual ~LockWindowGtk();
39
40 // Initialize the lock window.
41 void Init();
42
43 // Called when the window manager is ready to handle locked state.
44 void OnWindowManagerReady();
45
46 // Called when the all inputs are grabbed.
47 void OnGrabInputs();
48
49 // Clear current GTK grab.
50 void ClearGtkGrab();
51
52 // Try to grab all inputs. It initiates another try if it fails to
53 // grab and the retry count is within a limit, or fails with CHECK.
54 void TryGrabAllInputs();
55
56 // This method tries to steal pointer/keyboard grab from other
57 // client by sending events that will hopefully close menus or windows
58 // that have the grab.
59 void TryUngrabOtherClients();
60
61 // Event handler for client-event.
62 CHROMEGTK_CALLBACK_1(LockWindowGtk, void, OnClientEvent, GdkEventClient*)
63
64 // The screen locker window.
65 views::Widget* lock_window_;
66
67 // The widget to grab inputs on. This is initialized by Grab to be the
68 // RenderHostView displaying the WebUI.
69 GtkWidget* grab_widget_;
70
71 // True if the screen locker's window has been drawn.
72 bool drawn_;
73
74 // True if both mouse input and keyboard input are grabbed.
75 bool input_grabbed_;
76
77 base::WeakPtrFactory<LockWindowGtk> weak_factory_;
78
79 // The number times the widget tried to grab all focus.
80 int grab_failure_count_;
81
82 // Status of keyboard and mouse grab.
83 GdkGrabStatus kbd_grab_status_;
84 GdkGrabStatus mouse_grab_status_;
85
86 DISALLOW_COPY_AND_ASSIGN(LockWindowGtk);
87 };
88
89 } // namespace chromeos
90
91 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_WINDOW_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/lock_window_aura.cc ('k') | chrome/browser/chromeos/login/lock_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698