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

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

Issue 8842002: Remove lock screen item from menu and disable screen lock on guest session. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change VLOG to DVLOG in ScreenLocker::Show. Created 9 years 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
« no previous file with comments | « no previous file | chrome/browser/ui/toolbar/wrench_menu_model_chromeos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 delegate_->ShowErrorMessage(message, sign_out_only); 340 delegate_->ShowErrorMessage(message, sign_out_only);
341 } 341 }
342 342
343 void ScreenLocker::SetLoginStatusConsumer( 343 void ScreenLocker::SetLoginStatusConsumer(
344 chromeos::LoginStatusConsumer* consumer) { 344 chromeos::LoginStatusConsumer* consumer) {
345 login_status_consumer_ = consumer; 345 login_status_consumer_ = consumer;
346 } 346 }
347 347
348 // static 348 // static
349 void ScreenLocker::Show() { 349 void ScreenLocker::Show() {
350 VLOG(1) << "In ScreenLocker::Show"; 350 DVLOG(1) << "In ScreenLocker::Show";
351 UserMetrics::RecordAction(UserMetricsAction("ScreenLocker_Show")); 351 UserMetrics::RecordAction(UserMetricsAction("ScreenLocker_Show"));
352 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); 352 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI);
353 353
354 // Check whether the currently logged in user is a guest account and if so,
355 // refuse to lock the screen (crosbug.com/23764).
356 // TODO(flackr): We can allow lock screen for guest accounts when
357 // unlock_on_input is supported by the WebUI screen locker.
358 if (UserManager::Get()->logged_in_user().email().empty()) {
359 DVLOG(1) << "Show: Refusing to lock screen for guest account.";
360 return;
361 }
362
354 // Exit fullscreen. 363 // Exit fullscreen.
355 Browser* browser = BrowserList::GetLastActive(); 364 Browser* browser = BrowserList::GetLastActive();
356 // browser can be NULL if we receive a lock request before the first browser 365 // browser can be NULL if we receive a lock request before the first browser
357 // window is shown. 366 // window is shown.
358 if (browser && browser->window()->IsFullscreen()) { 367 if (browser && browser->window()->IsFullscreen()) {
359 browser->ToggleFullscreenMode(false); 368 browser->ToggleFullscreenMode(false);
360 } 369 }
361 370
362 if (!screen_locker_) { 371 if (!screen_locker_) {
363 VLOG(1) << "Show: Locking screen"; 372 DVLOG(1) << "Show: Locking screen";
364 ScreenLocker* locker = 373 ScreenLocker* locker =
365 new ScreenLocker(UserManager::Get()->logged_in_user()); 374 new ScreenLocker(UserManager::Get()->logged_in_user());
366 locker->Init(); 375 locker->Init();
367 } else { 376 } else {
368 // PowerManager re-sends lock screen signal if it doesn't 377 // PowerManager re-sends lock screen signal if it doesn't
369 // receive the response within timeout. Just send complete 378 // receive the response within timeout. Just send complete
370 // signal. 379 // signal.
371 VLOG(1) << "Show: locker already exists. Just sending completion event."; 380 DVLOG(1) << "Show: locker already exists. Just sending completion event.";
372 CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenLockCompleted(); 381 CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenLockCompleted();
373 } 382 }
374 } 383 }
375 384
376 // static 385 // static
377 void ScreenLocker::Hide() { 386 void ScreenLocker::Hide() {
378 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); 387 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI);
379 DCHECK(screen_locker_); 388 DCHECK(screen_locker_);
380 VLOG(1) << "Hide: Deleting ScreenLocker: " << screen_locker_; 389 VLOG(1) << "Hide: Deleting ScreenLocker: " << screen_locker_;
381 MessageLoopForUI::current()->DeleteSoon(FROM_HERE, screen_locker_); 390 MessageLoopForUI::current()->DeleteSoon(FROM_HERE, screen_locker_);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 450
442 bool state = true; 451 bool state = true;
443 content::NotificationService::current()->Notify( 452 content::NotificationService::current()->Notify(
444 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, 453 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
445 content::Source<ScreenLocker>(this), 454 content::Source<ScreenLocker>(this),
446 content::Details<bool>(&state)); 455 content::Details<bool>(&state));
447 CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenLockCompleted(); 456 CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenLockCompleted();
448 } 457 }
449 458
450 } // namespace chromeos 459 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/toolbar/wrench_menu_model_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698