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

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

Issue 141683005: Removes MessageLoop::Type checks in favor of IsCurrent on MessageLoops. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: base:: Created 6 years, 11 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // for sure. 240 // for sure.
241 base::MessageLoop::current()->PostDelayedTask( 241 base::MessageLoop::current()->PostDelayedTask(
242 FROM_HERE, 242 FROM_HERE,
243 base::Bind(&ScreenLocker::UnlockOnLoginSuccess, 243 base::Bind(&ScreenLocker::UnlockOnLoginSuccess,
244 weak_factory_.GetWeakPtr()), 244 weak_factory_.GetWeakPtr()),
245 base::TimeDelta::FromMilliseconds(kUnlockGuardTimeoutMs)); 245 base::TimeDelta::FromMilliseconds(kUnlockGuardTimeoutMs));
246 delegate_->AnimateAuthenticationSuccess(); 246 delegate_->AnimateAuthenticationSuccess();
247 } 247 }
248 248
249 void ScreenLocker::UnlockOnLoginSuccess() { 249 void ScreenLocker::UnlockOnLoginSuccess() {
250 DCHECK(base::MessageLoop::current()->type() == base::MessageLoop::TYPE_UI); 250 DCHECK(base::MessageLoopForUI::IsCurrent());
251 if (!authentication_capture_.get()) { 251 if (!authentication_capture_.get()) {
252 LOG(WARNING) << "Call to UnlockOnLoginSuccess without previous " << 252 LOG(WARNING) << "Call to UnlockOnLoginSuccess without previous " <<
253 "authentication success."; 253 "authentication success.";
254 return; 254 return;
255 } 255 }
256 256
257 if (login_status_consumer_) { 257 if (login_status_consumer_) {
258 login_status_consumer_->OnLoginSuccess( 258 login_status_consumer_->OnLoginSuccess(
259 UserContext(authentication_capture_->user_context.username, 259 UserContext(authentication_capture_->user_context.username,
260 authentication_capture_->user_context.password, 260 authentication_capture_->user_context.password,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 } 332 }
333 333
334 void ScreenLocker::SetLoginStatusConsumer( 334 void ScreenLocker::SetLoginStatusConsumer(
335 chromeos::LoginStatusConsumer* consumer) { 335 chromeos::LoginStatusConsumer* consumer) {
336 login_status_consumer_ = consumer; 336 login_status_consumer_ = consumer;
337 } 337 }
338 338
339 // static 339 // static
340 void ScreenLocker::Show() { 340 void ScreenLocker::Show() {
341 content::RecordAction(UserMetricsAction("ScreenLocker_Show")); 341 content::RecordAction(UserMetricsAction("ScreenLocker_Show"));
342 DCHECK(base::MessageLoop::current()->type() == base::MessageLoop::TYPE_UI); 342 DCHECK(base::MessageLoopForUI::IsCurrent());
343 343
344 // Check whether the currently logged in user is a guest account and if so, 344 // Check whether the currently logged in user is a guest account and if so,
345 // refuse to lock the screen (crosbug.com/23764). 345 // refuse to lock the screen (crosbug.com/23764).
346 // For a demo user, we should never show the lock screen (crosbug.com/27647). 346 // For a demo user, we should never show the lock screen (crosbug.com/27647).
347 if (UserManager::Get()->IsLoggedInAsGuest() || 347 if (UserManager::Get()->IsLoggedInAsGuest() ||
348 UserManager::Get()->IsLoggedInAsDemoUser()) { 348 UserManager::Get()->IsLoggedInAsDemoUser()) {
349 VLOG(1) << "Refusing to lock screen for guest/demo account"; 349 VLOG(1) << "Refusing to lock screen for guest/demo account";
350 return; 350 return;
351 } 351 }
352 352
(...skipping 16 matching lines...) Expand all
369 } else { 369 } else {
370 VLOG(1) << "ScreenLocker " << screen_locker_ << " already exists; " 370 VLOG(1) << "ScreenLocker " << screen_locker_ << " already exists; "
371 << " calling session manager's HandleLockScreenShown D-Bus method"; 371 << " calling session manager's HandleLockScreenShown D-Bus method";
372 DBusThreadManager::Get()->GetSessionManagerClient()-> 372 DBusThreadManager::Get()->GetSessionManagerClient()->
373 NotifyLockScreenShown(); 373 NotifyLockScreenShown();
374 } 374 }
375 } 375 }
376 376
377 // static 377 // static
378 void ScreenLocker::Hide() { 378 void ScreenLocker::Hide() {
379 DCHECK(base::MessageLoop::current()->type() == base::MessageLoop::TYPE_UI); 379 DCHECK(base::MessageLoopForUI::IsCurrent());
380 // For a guest/demo user, screen_locker_ would have never been initialized. 380 // For a guest/demo user, screen_locker_ would have never been initialized.
381 if (UserManager::Get()->IsLoggedInAsGuest() || 381 if (UserManager::Get()->IsLoggedInAsGuest() ||
382 UserManager::Get()->IsLoggedInAsDemoUser()) { 382 UserManager::Get()->IsLoggedInAsDemoUser()) {
383 VLOG(1) << "Refusing to hide lock screen for guest/demo account"; 383 VLOG(1) << "Refusing to hide lock screen for guest/demo account";
384 return; 384 return;
385 } 385 }
386 386
387 DCHECK(screen_locker_); 387 DCHECK(screen_locker_);
388 base::Callback<void(void)> callback = 388 base::Callback<void(void)> callback =
389 base::Bind(&ScreenLocker::ScheduleDeletion); 389 base::Bind(&ScreenLocker::ScheduleDeletion);
(...skipping 16 matching lines...) Expand all
406 // static 406 // static
407 void ScreenLocker::InitClass() { 407 void ScreenLocker::InitClass() {
408 g_screen_lock_observer.Get(); 408 g_screen_lock_observer.Get();
409 } 409 }
410 410
411 //////////////////////////////////////////////////////////////////////////////// 411 ////////////////////////////////////////////////////////////////////////////////
412 // ScreenLocker, private: 412 // ScreenLocker, private:
413 413
414 ScreenLocker::~ScreenLocker() { 414 ScreenLocker::~ScreenLocker() {
415 VLOG(1) << "Destroying ScreenLocker " << this; 415 VLOG(1) << "Destroying ScreenLocker " << this;
416 DCHECK(base::MessageLoop::current()->type() == base::MessageLoop::TYPE_UI); 416 DCHECK(base::MessageLoopForUI::IsCurrent());
417 417
418 if (authenticator_.get()) 418 if (authenticator_.get())
419 authenticator_->SetConsumer(NULL); 419 authenticator_->SetConsumer(NULL);
420 ClearErrors(); 420 ClearErrors();
421 421
422 VLOG(1) << "Moving desktop background to unlocked container"; 422 VLOG(1) << "Moving desktop background to unlocked container";
423 ash::Shell::GetInstance()-> 423 ash::Shell::GetInstance()->
424 desktop_background_controller()->MoveDesktopToUnlockedContainer(); 424 desktop_background_controller()->MoveDesktopToUnlockedContainer();
425 425
426 screen_locker_ = NULL; 426 screen_locker_ = NULL;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 466
467 bool ScreenLocker::IsUserLoggedIn(const std::string& username) { 467 bool ScreenLocker::IsUserLoggedIn(const std::string& username) {
468 for (UserList::const_iterator it = users_.begin(); it != users_.end(); ++it) { 468 for (UserList::const_iterator it = users_.begin(); it != users_.end(); ++it) {
469 if ((*it)->email() == username) 469 if ((*it)->email() == username)
470 return true; 470 return true;
471 } 471 }
472 return false; 472 return false;
473 } 473 }
474 474
475 } // namespace chromeos 475 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/external_protocol/external_protocol_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698