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/login_performer.h" | 5 #include "chrome/browser/chromeos/login/login_performer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/chromeos/boot_times_loader.h" | 14 #include "chrome/browser/chromeos/boot_times_loader.h" |
15 #include "chrome/browser/chromeos/cros/cros_library.h" | 15 #include "chrome/browser/chromeos/cros/cros_library.h" |
16 #include "chrome/browser/chromeos/cros/screen_lock_library.h" | 16 #include "chrome/browser/chromeos/cros/screen_lock_library.h" |
17 #include "chrome/browser/chromeos/cros_settings_names.h" | 17 #include "chrome/browser/chromeos/cros_settings_names.h" |
18 #include "chrome/browser/chromeos/login/login_utils.h" | 18 #include "chrome/browser/chromeos/login/login_utils.h" |
19 #include "chrome/browser/chromeos/login/screen_locker.h" | 19 #include "chrome/browser/chromeos/login/screen_locker.h" |
20 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | 20 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
21 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
| 24 #include "chrome/common/chrome_notification_types.h" |
24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
25 #include "content/browser/browser_thread.h" | 26 #include "content/browser/browser_thread.h" |
26 #include "content/browser/user_metrics.h" | 27 #include "content/browser/user_metrics.h" |
| 28 #include "content/common/content_notification_types.h" |
27 #include "content/common/notification_service.h" | 29 #include "content/common/notification_service.h" |
28 #include "content/common/notification_type.h" | |
29 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
30 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
31 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
32 | 33 |
33 namespace chromeos { | 34 namespace chromeos { |
34 | 35 |
35 // Initialize default LoginPerformer. | 36 // Initialize default LoginPerformer. |
36 // static | 37 // static |
37 LoginPerformer* LoginPerformer::default_performer_ = NULL; | 38 LoginPerformer* LoginPerformer::default_performer_ = NULL; |
38 | 39 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 delegate_->WhiteListCheckFailed(email); | 207 delegate_->WhiteListCheckFailed(email); |
207 else | 208 else |
208 NOTREACHED(); | 209 NOTREACHED(); |
209 } | 210 } |
210 } | 211 } |
211 | 212 |
212 //////////////////////////////////////////////////////////////////////////////// | 213 //////////////////////////////////////////////////////////////////////////////// |
213 // LoginPerformer, NotificationObserver implementation: | 214 // LoginPerformer, NotificationObserver implementation: |
214 // | 215 // |
215 | 216 |
216 void LoginPerformer::Observe(NotificationType type, | 217 void LoginPerformer::Observe(int type, |
217 const NotificationSource& source, | 218 const NotificationSource& source, |
218 const NotificationDetails& details) { | 219 const NotificationDetails& details) { |
219 if (type != NotificationType::SCREEN_LOCK_STATE_CHANGED) | 220 if (type != chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED) |
220 return; | 221 return; |
221 | 222 |
222 bool is_screen_locked = *Details<bool>(details).ptr(); | 223 bool is_screen_locked = *Details<bool>(details).ptr(); |
223 if (is_screen_locked) { | 224 if (is_screen_locked) { |
224 if (screen_lock_requested_) { | 225 if (screen_lock_requested_) { |
225 screen_lock_requested_ = false; | 226 screen_lock_requested_ = false; |
226 ResolveScreenLocked(); | 227 ResolveScreenLocked(); |
227 } | 228 } |
228 } else { | 229 } else { |
229 ResolveScreenUnlocked(); | 230 ResolveScreenUnlocked(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 cached_credentials_ = GaiaAuthConsumer::ClientLoginResult(); | 308 cached_credentials_ = GaiaAuthConsumer::ClientLoginResult(); |
308 } | 309 } |
309 | 310 |
310 //////////////////////////////////////////////////////////////////////////////// | 311 //////////////////////////////////////////////////////////////////////////////// |
311 // LoginPerformer, private: | 312 // LoginPerformer, private: |
312 | 313 |
313 void LoginPerformer::RequestScreenLock() { | 314 void LoginPerformer::RequestScreenLock() { |
314 DVLOG(1) << "Screen lock requested"; | 315 DVLOG(1) << "Screen lock requested"; |
315 // Will receive notifications on screen unlock and delete itself. | 316 // Will receive notifications on screen unlock and delete itself. |
316 registrar_.Add(this, | 317 registrar_.Add(this, |
317 NotificationType::SCREEN_LOCK_STATE_CHANGED, | 318 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
318 NotificationService::AllSources()); | 319 NotificationService::AllSources()); |
319 if (ScreenLocker::default_screen_locker()) { | 320 if (ScreenLocker::default_screen_locker()) { |
320 DVLOG(1) << "Screen already locked"; | 321 DVLOG(1) << "Screen already locked"; |
321 ResolveScreenLocked(); | 322 ResolveScreenLocked(); |
322 } else { | 323 } else { |
323 screen_lock_requested_ = true; | 324 screen_lock_requested_ = true; |
324 chromeos::CrosLibrary::Get()->GetScreenLockLibrary()-> | 325 chromeos::CrosLibrary::Get()->GetScreenLockLibrary()-> |
325 NotifyScreenLockRequested(); | 326 NotifyScreenLockRequested(); |
326 } | 327 } |
327 } | 328 } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 profile, | 488 profile, |
488 username_, | 489 username_, |
489 password_, | 490 password_, |
490 captcha_token_, | 491 captcha_token_, |
491 captcha_)); | 492 captcha_)); |
492 } | 493 } |
493 password_.clear(); | 494 password_.clear(); |
494 } | 495 } |
495 | 496 |
496 } // namespace chromeos | 497 } // namespace chromeos |
OLD | NEW |