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

Unified 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: Make virtual constructors private and fix order of lock window initialization. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/lock_window_gtk.h
diff --git a/chrome/browser/chromeos/login/lock_window_gtk.h b/chrome/browser/chromeos/login/lock_window_gtk.h
new file mode 100644
index 0000000000000000000000000000000000000000..ad61af4b176d8b0347140a1b39082346f1fd9831
--- /dev/null
+++ b/chrome/browser/chromeos/login/lock_window_gtk.h
@@ -0,0 +1,100 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_WINDOW_GTK_H_
+#define CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_WINDOW_GTK_H_
+#pragma once
+
+#include <string>
oshima 2011/11/29 20:18:06 not necessary here?
flackr 2011/11/30 20:16:54 Done.
+
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/chromeos/login/lock_window.h"
+#include "chrome/browser/chromeos/login/screen_locker_delegate.h"
+#include "ui/views/widget/native_widget_gtk.h"
+
+class DOMView;
+
+namespace views {
+class Widget;
+class View;
+}
+
+namespace chromeos {
+
+// A ScreenLock window that covers entire screen to keep the keyboard
+// focus/events inside the grab widget.
+class LockWindowGtk : public views::NativeWidgetGtk,
+ public LockWindow {
+ public:
+ LockWindowGtk();
oshima 2011/11/29 20:18:06 ditto
flackr 2011/11/30 20:16:54 Done.
+
+ // LockWindow implementation:
+ virtual void SetContentsView(views::View* content) OVERRIDE;
+ virtual void Show(DOMView* dom_view) OVERRIDE;
+ virtual views::Widget* GetWidget() OVERRIDE;
+
+ protected:
+ // NativeWidgetGtk overrides:
+ virtual gboolean OnButtonPress(GtkWidget* widget,
+ GdkEventButton* event) OVERRIDE;
+ virtual void OnDestroy(GtkWidget* object) OVERRIDE;
+ virtual void ClearNativeFocus() OVERRIDE;
+ virtual void HandleGtkGrabBroke() OVERRIDE;
+
+ private:
+ virtual ~LockWindowGtk() {}
oshima 2011/11/29 20:18:06 move impl to .cc
flackr 2011/11/30 20:16:54 Done.
+
+ // Initialize the lock window.
+ void Init();
+
+ // Called when the window manager is ready to handle locked state.
+ void OnWindowManagerReady();
+
+ // Called when the all inputs are grabbed.
+ void OnGrabInputs();
+
+ // Clear current GTK grab.
+ void ClearGtkGrab();
+
+ // Try to grab all inputs. It initiates another try if it fails to
+ // grab and the retry count is within a limit, or fails with CHECK.
+ void TryGrabAllInputs();
+
+ // This method tries to steal pointer/keyboard grab from other
+ // client by sending events that will hopefully close menus or windows
+ // that have the grab.
+ void TryUngrabOtherClients();
+
+ // Event handler for client-event.
+ CHROMEGTK_CALLBACK_1(LockWindowGtk, void, OnClientEvent, GdkEventClient*)
+
+ // The screen locker window.
+ views::Widget* lock_window_;
+
+ // The widget to grab inputs on. This is initialized by Grab to be the
+ // RenderHostView displaying the WebUI.
+ GtkWidget* grab_widget_;
+
+ // True if the screen locker's window has been drawn.
+ bool drawn_;
+
+ // True if both mouse input and keyboard input are grabbed.
+ bool input_grabbed_;
+
+ base::WeakPtrFactory<LockWindowGtk> weak_factory_;
+
+ // The number times the widget tried to grab all focus.
+ int grab_failure_count_;
+
+ // Status of keyboard and mouse grab.
+ GdkGrabStatus kbd_grab_status_;
+ GdkGrabStatus mouse_grab_status_;
+
+ DISALLOW_COPY_AND_ASSIGN(LockWindowGtk);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_WINDOW_GTK_H_

Powered by Google App Engine
This is Rietveld 408576698