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

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 suggestions. 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 class DOMView;
16
17 namespace views {
18 class Widget;
19 class View;
20 }
21
22 namespace chromeos {
23
24 // A ScreenLock window that covers entire screen to keep the keyboard
25 // focus/events inside the grab widget.
26 class LockWindowGtk : public views::NativeWidgetGtk,
27 public LockWindow {
28 public:
29 // LockWindow implementation:
30 virtual void SetContentsView(views::View* content) OVERRIDE;
31 virtual void Show(DOMView* dom_view) OVERRIDE;
32 virtual views::Widget* GetWidget() OVERRIDE;
33
34 protected:
35 // NativeWidgetGtk overrides:
36 virtual gboolean OnButtonPress(GtkWidget* widget,
37 GdkEventButton* event) OVERRIDE;
38 virtual void OnDestroy(GtkWidget* object) OVERRIDE;
39 virtual void ClearNativeFocus() OVERRIDE;
40 virtual void HandleGtkGrabBroke() OVERRIDE;
41
42 private:
43 friend class LockWindow;
44
45 LockWindowGtk();
46 virtual ~LockWindowGtk();
47
48 // Initialize the lock window.
49 void Init();
50
51 // Called when the window manager is ready to handle locked state.
52 void OnWindowManagerReady();
53
54 // Called when the all inputs are grabbed.
55 void OnGrabInputs();
56
57 // Clear current GTK grab.
58 void ClearGtkGrab();
59
60 // Try to grab all inputs. It initiates another try if it fails to
61 // grab and the retry count is within a limit, or fails with CHECK.
62 void TryGrabAllInputs();
63
64 // This method tries to steal pointer/keyboard grab from other
65 // client by sending events that will hopefully close menus or windows
66 // that have the grab.
67 void TryUngrabOtherClients();
68
69 // Event handler for client-event.
70 CHROMEGTK_CALLBACK_1(LockWindowGtk, void, OnClientEvent, GdkEventClient*)
71
72 // The screen locker window.
73 views::Widget* lock_window_;
74
75 // The widget to grab inputs on. This is initialized by Grab to be the
76 // RenderHostView displaying the WebUI.
77 GtkWidget* grab_widget_;
78
79 // True if the screen locker's window has been drawn.
80 bool drawn_;
81
82 // True if both mouse input and keyboard input are grabbed.
83 bool input_grabbed_;
84
85 base::WeakPtrFactory<LockWindowGtk> weak_factory_;
86
87 // The number times the widget tried to grab all focus.
88 int grab_failure_count_;
89
90 // Status of keyboard and mouse grab.
91 GdkGrabStatus kbd_grab_status_;
92 GdkGrabStatus mouse_grab_status_;
93
94 DISALLOW_COPY_AND_ASSIGN(LockWindowGtk);
95 };
96
97 } // namespace chromeos
98
99 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_WINDOW_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698