| 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 #include "chrome/browser/chromeos/login/lock_window_gtk.h" | 5 #include "chrome/browser/chromeos/login/lock_window_gtk.h" |
| 6 | 6 |
| 7 #include <X11/extensions/XTest.h> | 7 #include <X11/extensions/XTest.h> |
| 8 #include <X11/keysym.h> | 8 #include <X11/keysym.h> |
| 9 #include <gdk/gdkkeysyms.h> | 9 #include <gdk/gdkkeysyms.h> |
| 10 #include <gdk/gdkx.h> | 10 #include <gdk/gdkx.h> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h" | 21 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h" |
| 22 #include "chrome/browser/chromeos/login/helper.h" | 22 #include "chrome/browser/chromeos/login/helper.h" |
| 23 #include "chrome/browser/chromeos/login/screen_locker.h" | 23 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 24 #include "chrome/browser/chromeos/login/user_manager.h" | 24 #include "chrome/browser/chromeos/login/user_manager.h" |
| 25 #include "chrome/browser/chromeos/login/webui_login_display.h" | 25 #include "chrome/browser/chromeos/login/webui_login_display.h" |
| 26 #include "chrome/browser/ui/views/dom_view.h" | 26 #include "chrome/browser/ui/views/dom_view.h" |
| 27 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 27 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 28 #include "chrome/common/chrome_notification_types.h" | 28 #include "chrome/common/chrome_notification_types.h" |
| 29 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
| 30 #include "content/browser/renderer_host/render_widget_host_view.h" | 30 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 31 #include "content/browser/tab_contents/tab_contents.h" | |
| 32 #include "content/public/browser/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
| 33 #include "content/public/browser/notification_types.h" | 32 #include "content/public/browser/notification_types.h" |
| 33 #include "content/public/browser/web_contents.h" |
| 34 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
| 35 #include "ui/base/x/x11_util.h" | 35 #include "ui/base/x/x11_util.h" |
| 36 #include "ui/gfx/screen.h" | 36 #include "ui/gfx/screen.h" |
| 37 #include "ui/views/widget/native_widget_gtk.h" | 37 #include "ui/views/widget/native_widget_gtk.h" |
| 38 #include "ui/views/widget/widget.h" | 38 #include "ui/views/widget/widget.h" |
| 39 | 39 |
| 40 namespace { | 40 namespace { |
| 41 | 41 |
| 42 // The maximum duration for which locker should try to grab the keyboard and | 42 // The maximum duration for which locker should try to grab the keyboard and |
| 43 // mouse and its interval for regrabbing on failure. | 43 // mouse and its interval for regrabbing on failure. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 72 | 72 |
| 73 LockWindow* LockWindow::Create() { | 73 LockWindow* LockWindow::Create() { |
| 74 return new LockWindowGtk(); | 74 return new LockWindowGtk(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 //////////////////////////////////////////////////////////////////////////////// | 77 //////////////////////////////////////////////////////////////////////////////// |
| 78 // LockWindowGtk implementation. | 78 // LockWindowGtk implementation. |
| 79 | 79 |
| 80 void LockWindowGtk::Grab(DOMView* dom_view) { | 80 void LockWindowGtk::Grab(DOMView* dom_view) { |
| 81 // Grab on the RenderWidgetHostView hosting the WebUI login screen. | 81 // Grab on the RenderWidgetHostView hosting the WebUI login screen. |
| 82 grab_widget_ = dom_view->dom_contents()->tab_contents()-> | 82 grab_widget_ = dom_view->dom_contents()->web_contents()-> |
| 83 GetRenderWidgetHostView()->GetNativeView(); | 83 GetRenderWidgetHostView()->GetNativeView(); |
| 84 ClearGtkGrab(); | 84 ClearGtkGrab(); |
| 85 | 85 |
| 86 // Call this after lock_window_->Show(); otherwise the 1st invocation | 86 // Call this after lock_window_->Show(); otherwise the 1st invocation |
| 87 // of gdk_xxx_grab() will always fail. | 87 // of gdk_xxx_grab() will always fail. |
| 88 TryGrabAllInputs(); | 88 TryGrabAllInputs(); |
| 89 | 89 |
| 90 // Add the window to its own group so that its grab won't be stolen if | 90 // Add the window to its own group so that its grab won't be stolen if |
| 91 // gtk_grab_add() gets called on behalf on a non-screen-locker widget (e.g. | 91 // gtk_grab_add() gets called on behalf on a non-screen-locker widget (e.g. |
| 92 // a modal dialog) -- see http://crosbug.com/8999. We intentionally do this | 92 // a modal dialog) -- see http://crosbug.com/8999. We intentionally do this |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 310 } |
| 311 | 311 |
| 312 void LockWindowGtk::OnClientEvent(GtkWidget* widge, GdkEventClient* event) { | 312 void LockWindowGtk::OnClientEvent(GtkWidget* widge, GdkEventClient* event) { |
| 313 WmIpc::Message msg; | 313 WmIpc::Message msg; |
| 314 WmIpc::instance()->DecodeMessage(*event, &msg); | 314 WmIpc::instance()->DecodeMessage(*event, &msg); |
| 315 if (msg.type() == WM_IPC_MESSAGE_CHROME_NOTIFY_SCREEN_REDRAWN_FOR_LOCK) | 315 if (msg.type() == WM_IPC_MESSAGE_CHROME_NOTIFY_SCREEN_REDRAWN_FOR_LOCK) |
| 316 OnWindowManagerReady(); | 316 OnWindowManagerReady(); |
| 317 } | 317 } |
| 318 | 318 |
| 319 } // namespace chromeos | 319 } // namespace chromeos |
| OLD | NEW |