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

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

Issue 2836163002: mash: Shell ref clean up for screen lock (Closed)
Patch Set: rebase, fix compile Created 3 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/lock/screen_locker.h" 5 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 20 matching lines...) Expand all
31 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h" 31 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h"
32 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h" 32 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h"
33 #include "chrome/browser/chromeos/login/session/user_session_manager.h" 33 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
34 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio n.h" 34 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio n.h"
35 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" 35 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
36 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 36 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
37 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" 37 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h"
38 #include "chrome/browser/lifetime/application_lifetime.h" 38 #include "chrome/browser/lifetime/application_lifetime.h"
39 #include "chrome/browser/signin/easy_unlock_service.h" 39 #include "chrome/browser/signin/easy_unlock_service.h"
40 #include "chrome/browser/signin/signin_manager_factory.h" 40 #include "chrome/browser/signin/signin_manager_factory.h"
41 #include "chrome/browser/ui/ash/ash_util.h"
41 #include "chrome/browser/ui/ash/session_controller_client.h" 42 #include "chrome/browser/ui/ash/session_controller_client.h"
42 #include "chrome/browser/ui/webui/chromeos/login/screenlock_icon_provider.h" 43 #include "chrome/browser/ui/webui/chromeos/login/screenlock_icon_provider.h"
43 #include "chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h" 44 #include "chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h"
44 #include "chrome/common/chrome_switches.h" 45 #include "chrome/common/chrome_switches.h"
45 #include "chrome/grit/browser_resources.h" 46 #include "chrome/grit/browser_resources.h"
46 #include "chrome/grit/generated_resources.h" 47 #include "chrome/grit/generated_resources.h"
47 #include "chromeos/audio/chromeos_sounds.h" 48 #include "chromeos/audio/chromeos_sounds.h"
48 #include "chromeos/dbus/dbus_thread_manager.h" 49 #include "chromeos/dbus/dbus_thread_manager.h"
49 #include "chromeos/dbus/session_manager_client.h" 50 #include "chromeos/dbus/session_manager_client.h"
50 #include "chromeos/login/auth/authenticator.h" 51 #include "chromeos/login/auth/authenticator.h"
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 return nullptr; 379 return nullptr;
379 } 380 }
380 381
381 void ScreenLocker::OnStartLockCallback(bool locked) { 382 void ScreenLocker::OnStartLockCallback(bool locked) {
382 // Happens in tests that exit with a pending lock. In real lock failure, 383 // Happens in tests that exit with a pending lock. In real lock failure,
383 // ash::LockStateController would cause the current user session to be 384 // ash::LockStateController would cause the current user session to be
384 // terminated. 385 // terminated.
385 if (!locked) 386 if (!locked)
386 return; 387 return;
387 388
388 web_ui()->OnLockAnimationFinished(); 389 web_ui()->OnAshLockAnimationFinished();
389 390
390 AccessibilityManager::Get()->PlayEarcon( 391 AccessibilityManager::Get()->PlayEarcon(
391 chromeos::SOUND_LOCK, PlaySoundOption::SPOKEN_FEEDBACK_ENABLED); 392 chromeos::SOUND_LOCK, PlaySoundOption::SPOKEN_FEEDBACK_ENABLED);
392 } 393 }
393 394
394 void ScreenLocker::ClearErrors() { 395 void ScreenLocker::ClearErrors() {
395 web_ui()->ClearErrors(); 396 web_ui()->ClearErrors();
396 } 397 }
397 398
398 void ScreenLocker::Signout() { 399 void ScreenLocker::Signout() {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 base::RecordAction(UserMetricsAction("ScreenLocker_Show")); 467 base::RecordAction(UserMetricsAction("ScreenLocker_Show"));
467 DCHECK(base::MessageLoopForUI::IsCurrent()); 468 DCHECK(base::MessageLoopForUI::IsCurrent());
468 469
469 // Check whether the currently logged in user is a guest account and if so, 470 // Check whether the currently logged in user is a guest account and if so,
470 // refuse to lock the screen (crosbug.com/23764). 471 // refuse to lock the screen (crosbug.com/23764).
471 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) { 472 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) {
472 VLOG(1) << "Refusing to lock screen for guest account"; 473 VLOG(1) << "Refusing to lock screen for guest account";
473 return; 474 return;
474 } 475 }
475 476
476 // If the active window is fullscreen, exit fullscreen to avoid the web page 477 // Manipulating active window state directly does not work in mash so skip it
477 // or app mimicking the lock screen. Do not exit fullscreen if the shelf is 478 // for mash. http://crbug.com/714677 tracks work to add the support for mash.
478 // visible while in fullscreen because the shelf makes it harder for a web 479 if (!ash_util::IsRunningInMash()) {
479 // page or app to mimick the lock screen. 480 // If the active window is fullscreen, exit fullscreen to avoid the web page
480 ash::wm::WindowState* active_window_state = ash::wm::GetActiveWindowState(); 481 // or app mimicking the lock screen. Do not exit fullscreen if the shelf is
481 if (active_window_state && active_window_state->IsFullscreen() && 482 // visible while in fullscreen because the shelf makes it harder for a web
482 active_window_state->hide_shelf_when_fullscreen()) { 483 // page or app to mimick the lock screen.
483 const ash::wm::WMEvent event(ash::wm::WM_EVENT_TOGGLE_FULLSCREEN); 484 ash::wm::WindowState* active_window_state = ash::wm::GetActiveWindowState();
484 active_window_state->OnWMEvent(&event); 485 if (active_window_state && active_window_state->IsFullscreen() &&
486 active_window_state->hide_shelf_when_fullscreen()) {
487 const ash::wm::WMEvent event(ash::wm::WM_EVENT_TOGGLE_FULLSCREEN);
488 active_window_state->OnWMEvent(&event);
489 }
485 } 490 }
486 491
487 if (!screen_locker_) { 492 if (!screen_locker_) {
488 ScreenLocker* locker = 493 ScreenLocker* locker =
489 new ScreenLocker(user_manager::UserManager::Get()->GetUnlockUsers()); 494 new ScreenLocker(user_manager::UserManager::Get()->GetUnlockUsers());
490 VLOG(1) << "Created ScreenLocker " << locker; 495 VLOG(1) << "Created ScreenLocker " << locker;
491 locker->Init(); 496 locker->Init();
492 } else { 497 } else {
493 VLOG(1) << "ScreenLocker " << screen_locker_ << " already exists; " 498 VLOG(1) << "ScreenLocker " << screen_locker_ << " already exists; "
494 << " calling session manager's HandleLockScreenShown D-Bus method"; 499 << " calling session manager's HandleLockScreenShown D-Bus method";
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 auth_status_consumer_->OnAuthFailure(failure); 658 auth_status_consumer_->OnAuthFailure(failure);
654 } 659 }
655 } 660 }
656 661
657 void ScreenLocker::OnEndCurrentAuthSession(bool success) { 662 void ScreenLocker::OnEndCurrentAuthSession(bool success) {
658 LOG_IF(ERROR, !success) 663 LOG_IF(ERROR, !success)
659 << "Failed to end current fingerprint authentication session."; 664 << "Failed to end current fingerprint authentication session.";
660 } 665 }
661 666
662 } // namespace chromeos 667 } // namespace chromeos
OLDNEW
« no previous file with comments | « ash/session/session_controller.cc ('k') | chrome/browser/chromeos/login/lock/webui_screen_locker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698