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