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

Side by Side Diff: chrome/browser/chromeos/login/screen_locker.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months 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
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.h" 5 #include "chrome/browser/chromeos/login/screen_locker.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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 const int kMaxGrabFailures = kMaxGrabFailureSec * 1000 / kRetryGrabIntervalMs; 67 const int kMaxGrabFailures = kMaxGrabFailureSec * 1000 / kRetryGrabIntervalMs;
68 68
69 // A idle time to show the screen saver in seconds. 69 // A idle time to show the screen saver in seconds.
70 const int kScreenSaverIdleTimeout = 15; 70 const int kScreenSaverIdleTimeout = 15;
71 71
72 // Observer to start ScreenLocker when the screen lock 72 // Observer to start ScreenLocker when the screen lock
73 class ScreenLockObserver : public chromeos::ScreenLockLibrary::Observer, 73 class ScreenLockObserver : public chromeos::ScreenLockLibrary::Observer,
74 public NotificationObserver { 74 public NotificationObserver {
75 public: 75 public:
76 ScreenLockObserver() { 76 ScreenLockObserver() {
77 registrar_.Add(this, NotificationType::LOGIN_USER_CHANGED, 77 registrar_.Add(this, chrome::LOGIN_USER_CHANGED,
78 NotificationService::AllSources()); 78 NotificationService::AllSources());
79 } 79 }
80 80
81 // NotificationObserver overrides: 81 // NotificationObserver overrides:
82 virtual void Observe(NotificationType type, 82 virtual void Observe(int type,
83 const NotificationSource& source, 83 const NotificationSource& source,
84 const NotificationDetails& details) OVERRIDE { 84 const NotificationDetails& details) OVERRIDE {
85 if (type == NotificationType::LOGIN_USER_CHANGED) { 85 if (type == chrome::LOGIN_USER_CHANGED) {
86 // Register Screen Lock after login screen to make sure 86 // Register Screen Lock after login screen to make sure
87 // we don't show the screen lock on top of the login screen by accident. 87 // we don't show the screen lock on top of the login screen by accident.
88 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) 88 if (chromeos::CrosLibrary::Get()->EnsureLoaded())
89 chromeos::CrosLibrary::Get()->GetScreenLockLibrary()->AddObserver(this); 89 chromeos::CrosLibrary::Get()->GetScreenLockLibrary()->AddObserver(this);
90 } 90 }
91 } 91 }
92 92
93 virtual void LockScreen(chromeos::ScreenLockLibrary* obj) OVERRIDE { 93 virtual void LockScreen(chromeos::ScreenLockLibrary* obj) OVERRIDE {
94 VLOG(1) << "In: ScreenLockObserver::LockScreen"; 94 VLOG(1) << "In: ScreenLockObserver::LockScreen";
95 SetupInputMethodsForScreenLocker(); 95 SetupInputMethodsForScreenLocker();
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 gdk_keyboard_ungrab(GDK_CURRENT_TIME); 1105 gdk_keyboard_ungrab(GDK_CURRENT_TIME);
1106 gdk_pointer_ungrab(GDK_CURRENT_TIME); 1106 gdk_pointer_ungrab(GDK_CURRENT_TIME);
1107 1107
1108 DCHECK(lock_window_); 1108 DCHECK(lock_window_);
1109 VLOG(1) << "~ScreenLocker(): Closing ScreenLocker window."; 1109 VLOG(1) << "~ScreenLocker(): Closing ScreenLocker window.";
1110 lock_window_->Close(); 1110 lock_window_->Close();
1111 // lock_widget_ will be deleted by gtk's destroy signal. 1111 // lock_widget_ will be deleted by gtk's destroy signal.
1112 screen_locker_ = NULL; 1112 screen_locker_ = NULL;
1113 bool state = false; 1113 bool state = false;
1114 NotificationService::current()->Notify( 1114 NotificationService::current()->Notify(
1115 NotificationType::SCREEN_LOCK_STATE_CHANGED, 1115 chrome::SCREEN_LOCK_STATE_CHANGED,
1116 Source<ScreenLocker>(this), 1116 Source<ScreenLocker>(this),
1117 Details<bool>(&state)); 1117 Details<bool>(&state));
1118 if (CrosLibrary::Get()->EnsureLoaded()) 1118 if (CrosLibrary::Get()->EnsureLoaded())
1119 CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenUnlockCompleted(); 1119 CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenUnlockCompleted();
1120 } 1120 }
1121 1121
1122 void ScreenLocker::SetAuthenticator(Authenticator* authenticator) { 1122 void ScreenLocker::SetAuthenticator(Authenticator* authenticator) {
1123 authenticator_ = authenticator; 1123 authenticator_ = authenticator;
1124 } 1124 }
1125 1125
(...skipping 10 matching lines...) Expand all
1136 locker_input_event_observer_.reset(new LockerInputEventObserver(this)); 1136 locker_input_event_observer_.reset(new LockerInputEventObserver(this));
1137 MessageLoopForUI::current()->AddObserver( 1137 MessageLoopForUI::current()->AddObserver(
1138 locker_input_event_observer_.get()); 1138 locker_input_event_observer_.get());
1139 } else { 1139 } else {
1140 // Don't enable the password field until we grab all inputs. 1140 // Don't enable the password field until we grab all inputs.
1141 EnableInput(); 1141 EnableInput();
1142 } 1142 }
1143 1143
1144 bool state = true; 1144 bool state = true;
1145 NotificationService::current()->Notify( 1145 NotificationService::current()->Notify(
1146 NotificationType::SCREEN_LOCK_STATE_CHANGED, 1146 chrome::SCREEN_LOCK_STATE_CHANGED,
1147 Source<ScreenLocker>(this), 1147 Source<ScreenLocker>(this),
1148 Details<bool>(&state)); 1148 Details<bool>(&state));
1149 if (CrosLibrary::Get()->EnsureLoaded()) 1149 if (CrosLibrary::Get()->EnsureLoaded())
1150 CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenLockCompleted(); 1150 CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenLockCompleted();
1151 } 1151 }
1152 1152
1153 void ScreenLocker::OnClientEvent(GtkWidget* widge, GdkEventClient* event) { 1153 void ScreenLocker::OnClientEvent(GtkWidget* widge, GdkEventClient* event) {
1154 WmIpc::Message msg; 1154 WmIpc::Message msg;
1155 WmIpc::instance()->DecodeMessage(*event, &msg); 1155 WmIpc::instance()->DecodeMessage(*event, &msg);
1156 if (msg.type() == WM_IPC_MESSAGE_CHROME_NOTIFY_SCREEN_REDRAWN_FOR_LOCK) { 1156 if (msg.type() == WM_IPC_MESSAGE_CHROME_NOTIFY_SCREEN_REDRAWN_FOR_LOCK) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 1222
1223 bool ScreenLocker::AcceleratorPressed(const views::Accelerator& accelerator) { 1223 bool ScreenLocker::AcceleratorPressed(const views::Accelerator& accelerator) {
1224 if (!background_view_->IsScreenSaverVisible()) { 1224 if (!background_view_->IsScreenSaverVisible()) {
1225 StartScreenSaver(); 1225 StartScreenSaver();
1226 return true; 1226 return true;
1227 } 1227 }
1228 return false; 1228 return false;
1229 } 1229 }
1230 1230
1231 } // namespace chromeos 1231 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698