| 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/screen_locker_views.h" | 5 #include "chrome/browser/chromeos/login/screen_locker_views.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> |
| 11 | 11 |
| 12 // Evil hack to undo X11 evil #define. | 12 // Evil hack to undo X11 evil #define. |
| 13 #undef None | 13 #undef None |
| 14 #undef Status | 14 #undef Status |
| 15 | 15 |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 18 #include "chrome/browser/chromeos/login/background_view.h" | 18 #include "chrome/browser/chromeos/login/background_view.h" |
| 19 #include "chrome/browser/chromeos/login/login_performer.h" | 19 #include "chrome/browser/chromeos/login/login_performer.h" |
| 20 #include "chrome/browser/chromeos/login/message_bubble.h" | 20 #include "chrome/browser/chromeos/login/message_bubble.h" |
| 21 #include "chrome/browser/chromeos/login/screen_lock_view.h" | 21 #include "chrome/browser/chromeos/login/screen_lock_view.h" |
| 22 #include "chrome/browser/chromeos/login/screen_locker.h" | 22 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 23 #include "chrome/browser/chromeos/login/shutdown_button.h" | 23 #include "chrome/browser/chromeos/login/shutdown_button.h" |
| 24 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h" | 24 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h" |
| 25 #include "chrome/browser/chromeos/view_ids.h" | 25 #include "chrome/browser/chromeos/view_ids.h" |
| 26 #include "chrome/browser/prefs/pref_service.h" | 26 #include "chrome/browser/prefs/pref_service.h" |
| 27 #include "chrome/browser/ui/views/window.h" | 27 #include "chrome/browser/ui/views/window.h" |
| 28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
| 29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 30 #include "content/browser/user_metrics.h" | 30 #include "content/public/browser/user_metrics.h" |
| 31 #include "grit/theme_resources.h" | 31 #include "grit/theme_resources.h" |
| 32 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
| 33 #include "ui/base/x/x11_util.h" | 33 #include "ui/base/x/x11_util.h" |
| 34 #include "ui/gfx/screen.h" | 34 #include "ui/gfx/screen.h" |
| 35 #include "ui/views/controls/textfield/textfield.h" | 35 #include "ui/views/controls/textfield/textfield.h" |
| 36 | 36 |
| 37 #if defined(TOOLKIT_USES_GTK) | 37 #if defined(TOOLKIT_USES_GTK) |
| 38 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h" | 38 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h" |
| 39 #include "ui/views/widget/native_widget_gtk.h" | 39 #include "ui/views/widget/native_widget_gtk.h" |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 using content::UserMetricsAction; |
| 43 |
| 42 namespace { | 44 namespace { |
| 43 | 45 |
| 44 // The active ScreenLockerDelegate. | 46 // The active ScreenLockerDelegate. |
| 45 chromeos::ScreenLockerViews* screen_locker_view_ = NULL; | 47 chromeos::ScreenLockerViews* screen_locker_view_ = NULL; |
| 46 | 48 |
| 47 // The maximum duration for which locker should try to grab the keyboard and | 49 // The maximum duration for which locker should try to grab the keyboard and |
| 48 // mouse and its interval for regrabbing on failure. | 50 // mouse and its interval for regrabbing on failure. |
| 49 const int kMaxGrabFailureSec = 30; | 51 const int kMaxGrabFailureSec = 30; |
| 50 const int64 kRetryGrabIntervalMs = 500; | 52 const int64 kRetryGrabIntervalMs = 500; |
| 51 | 53 |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 void ScreenLockerViews::OnGrabInputs() { | 696 void ScreenLockerViews::OnGrabInputs() { |
| 695 DVLOG(1) << "OnGrabInputs"; | 697 DVLOG(1) << "OnGrabInputs"; |
| 696 input_grabbed_ = true; | 698 input_grabbed_ = true; |
| 697 if (drawn_) | 699 if (drawn_) |
| 698 ScreenLockReady(); | 700 ScreenLockReady(); |
| 699 } | 701 } |
| 700 | 702 |
| 701 void ScreenLockerViews::StartScreenSaver() { | 703 void ScreenLockerViews::StartScreenSaver() { |
| 702 if (!background_view_->IsScreenSaverVisible()) { | 704 if (!background_view_->IsScreenSaverVisible()) { |
| 703 VLOG(1) << "StartScreenSaver"; | 705 VLOG(1) << "StartScreenSaver"; |
| 704 UserMetrics::RecordAction( | 706 content::RecordAction( |
| 705 UserMetricsAction("ScreenLocker_StartScreenSaver")); | 707 UserMetricsAction("ScreenLocker_StartScreenSaver")); |
| 706 background_view_->ShowScreenSaver(); | 708 background_view_->ShowScreenSaver(); |
| 707 if (screen_lock_view_) { | 709 if (screen_lock_view_) { |
| 708 screen_lock_view_->SetEnabled(false); | 710 screen_lock_view_->SetEnabled(false); |
| 709 screen_lock_view_->SetVisible(false); | 711 screen_lock_view_->SetVisible(false); |
| 710 } | 712 } |
| 711 screen_locker_->ClearErrors(); | 713 screen_locker_->ClearErrors(); |
| 712 } | 714 } |
| 713 } | 715 } |
| 714 | 716 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 #if defined(TOOLKIT_USES_GTK) | 903 #if defined(TOOLKIT_USES_GTK) |
| 902 WmIpc::Message msg; | 904 WmIpc::Message msg; |
| 903 WmIpc::instance()->DecodeMessage(*event, &msg); | 905 WmIpc::instance()->DecodeMessage(*event, &msg); |
| 904 if (msg.type() == WM_IPC_MESSAGE_CHROME_NOTIFY_SCREEN_REDRAWN_FOR_LOCK) { | 906 if (msg.type() == WM_IPC_MESSAGE_CHROME_NOTIFY_SCREEN_REDRAWN_FOR_LOCK) { |
| 905 OnWindowManagerReady(); | 907 OnWindowManagerReady(); |
| 906 } | 908 } |
| 907 #endif | 909 #endif |
| 908 } | 910 } |
| 909 | 911 |
| 910 } // namespace chromeos | 912 } // namespace chromeos |
| OLD | NEW |