| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 const NotificationDetails& details) { | 68 const NotificationDetails& details) { |
| 69 if (type == NotificationType::LOGIN_USER_CHANGED) { | 69 if (type == NotificationType::LOGIN_USER_CHANGED) { |
| 70 // Register Screen Lock after login screen to make sure | 70 // Register Screen Lock after login screen to make sure |
| 71 // we don't show the screen lock on top of the login screen by accident. | 71 // we don't show the screen lock on top of the login screen by accident. |
| 72 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) | 72 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) |
| 73 chromeos::CrosLibrary::Get()->GetScreenLockLibrary()->AddObserver(this); | 73 chromeos::CrosLibrary::Get()->GetScreenLockLibrary()->AddObserver(this); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 virtual void LockScreen(chromeos::ScreenLockLibrary* obj) { | 77 virtual void LockScreen(chromeos::ScreenLockLibrary* obj) { |
| 78 LOG(INFO) << "In: ScreenLockObserver::LockScreen"; | 78 VLOG(1) << "In: ScreenLockObserver::LockScreen"; |
| 79 SetupInputMethodsForScreenLocker(); | 79 SetupInputMethodsForScreenLocker(); |
| 80 chromeos::ScreenLocker::Show(); | 80 chromeos::ScreenLocker::Show(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 virtual void UnlockScreen(chromeos::ScreenLockLibrary* obj) { | 83 virtual void UnlockScreen(chromeos::ScreenLockLibrary* obj) { |
| 84 RestoreInputMethods(); | 84 RestoreInputMethods(); |
| 85 chromeos::ScreenLocker::Hide(); | 85 chromeos::ScreenLocker::Hide(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 virtual void UnlockScreenFailed(chromeos::ScreenLockLibrary* obj) { | 88 virtual void UnlockScreenFailed(chromeos::ScreenLockLibrary* obj) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // Don't handle key event in the lock window. | 189 // Don't handle key event in the lock window. |
| 190 return false; | 190 return false; |
| 191 } | 191 } |
| 192 | 192 |
| 193 virtual gboolean OnKeyRelease(GtkWidget* widget, GdkEventKey* event) { | 193 virtual gboolean OnKeyRelease(GtkWidget* widget, GdkEventKey* event) { |
| 194 // Don't handle key event in the lock window. | 194 // Don't handle key event in the lock window. |
| 195 return false; | 195 return false; |
| 196 } | 196 } |
| 197 | 197 |
| 198 virtual void OnDestroy(GtkWidget* object) { | 198 virtual void OnDestroy(GtkWidget* object) { |
| 199 LOG(INFO) << "OnDestroy: LockWindow destroyed"; | 199 VLOG(1) << "OnDestroy: LockWindow destroyed"; |
| 200 views::WidgetGtk::OnDestroy(object); | 200 views::WidgetGtk::OnDestroy(object); |
| 201 } | 201 } |
| 202 | 202 |
| 203 virtual void ClearNativeFocus() { | 203 virtual void ClearNativeFocus() { |
| 204 DCHECK(toplevel_focus_widget_); | 204 DCHECK(toplevel_focus_widget_); |
| 205 gtk_widget_grab_focus(toplevel_focus_widget_); | 205 gtk_widget_grab_focus(toplevel_focus_widget_); |
| 206 } | 206 } |
| 207 | 207 |
| 208 // Sets the widget to move the focus to when clearning the native | 208 // Sets the widget to move the focus to when clearning the native |
| 209 // widget's focus. | 209 // widget's focus. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 << kbd_grab_status_ << ", mouse=" << mouse_grab_status_; | 313 << kbd_grab_status_ << ", mouse=" << mouse_grab_status_; |
| 314 MessageLoop::current()->PostDelayedTask( | 314 MessageLoop::current()->PostDelayedTask( |
| 315 FROM_HERE, | 315 FROM_HERE, |
| 316 task_factory_.NewRunnableMethod(&GrabWidget::TryGrabAllInputs), | 316 task_factory_.NewRunnableMethod(&GrabWidget::TryGrabAllInputs), |
| 317 kRetryGrabIntervalMs); | 317 kRetryGrabIntervalMs); |
| 318 } else { | 318 } else { |
| 319 CHECK_EQ(GDK_GRAB_SUCCESS, kbd_grab_status_) | 319 CHECK_EQ(GDK_GRAB_SUCCESS, kbd_grab_status_) |
| 320 << "Failed to grab keyboard input:" << kbd_grab_status_; | 320 << "Failed to grab keyboard input:" << kbd_grab_status_; |
| 321 CHECK_EQ(GDK_GRAB_SUCCESS, mouse_grab_status_) | 321 CHECK_EQ(GDK_GRAB_SUCCESS, mouse_grab_status_) |
| 322 << "Failed to grab pointer input:" << mouse_grab_status_; | 322 << "Failed to grab pointer input:" << mouse_grab_status_; |
| 323 DLOG(INFO) << "Grab Success"; | 323 DVLOG(1) << "Grab Success"; |
| 324 screen_locker_->OnGrabInputs(); | 324 screen_locker_->OnGrabInputs(); |
| 325 } | 325 } |
| 326 } | 326 } |
| 327 | 327 |
| 328 // BackgroundView for ScreenLocker, which layouts a lock widget in | 328 // BackgroundView for ScreenLocker, which layouts a lock widget in |
| 329 // addition to other background components. | 329 // addition to other background components. |
| 330 class ScreenLockerBackgroundView : public chromeos::BackgroundView { | 330 class ScreenLockerBackgroundView : public chromeos::BackgroundView { |
| 331 public: | 331 public: |
| 332 explicit ScreenLockerBackgroundView(views::WidgetGtk* lock_widget) | 332 explicit ScreenLockerBackgroundView(views::WidgetGtk* lock_widget) |
| 333 : lock_widget_(lock_widget) { | 333 : lock_widget_(lock_widget) { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 // Don't let X draw default background, which was causing flash on | 563 // Don't let X draw default background, which was causing flash on |
| 564 // resume. | 564 // resume. |
| 565 gdk_window_set_back_pixmap(lock_window_->GetNativeView()->window, | 565 gdk_window_set_back_pixmap(lock_window_->GetNativeView()->window, |
| 566 NULL, false); | 566 NULL, false); |
| 567 gdk_window_set_back_pixmap(lock_widget_->GetNativeView()->window, | 567 gdk_window_set_back_pixmap(lock_widget_->GetNativeView()->window, |
| 568 NULL, false); | 568 NULL, false); |
| 569 lock_window->set_toplevel_focus_widget(lock_widget_->window_contents()); | 569 lock_window->set_toplevel_focus_widget(lock_widget_->window_contents()); |
| 570 } | 570 } |
| 571 | 571 |
| 572 void ScreenLocker::OnLoginFailure(const LoginFailure& error) { | 572 void ScreenLocker::OnLoginFailure(const LoginFailure& error) { |
| 573 DLOG(INFO) << "OnLoginFailure"; | 573 DVLOG(1) << "OnLoginFailure"; |
| 574 EnableInput(); | 574 EnableInput(); |
| 575 // Don't enable signout button here as we're showing | 575 // Don't enable signout button here as we're showing |
| 576 // MessageBubble. | 576 // MessageBubble. |
| 577 gfx::Rect rect = screen_lock_view_->GetPasswordBoundsRelativeTo( | 577 gfx::Rect rect = screen_lock_view_->GetPasswordBoundsRelativeTo( |
| 578 lock_widget_->GetRootView()); | 578 lock_widget_->GetRootView()); |
| 579 gfx::Rect lock_widget_bounds; | 579 gfx::Rect lock_widget_bounds; |
| 580 lock_widget_->GetBounds(&lock_widget_bounds, false); | 580 lock_widget_->GetBounds(&lock_widget_bounds, false); |
| 581 rect.Offset(lock_widget_bounds.x(), lock_widget_bounds.y()); | 581 rect.Offset(lock_widget_bounds.x(), lock_widget_bounds.y()); |
| 582 | 582 |
| 583 if (error_info_) | 583 if (error_info_) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 606 mouse_event_relay_.reset( | 606 mouse_event_relay_.reset( |
| 607 new MouseEventRelay(lock_widget_->GetNativeView()->window, | 607 new MouseEventRelay(lock_widget_->GetNativeView()->window, |
| 608 error_info_->GetNativeView()->window)); | 608 error_info_->GetNativeView()->window)); |
| 609 MessageLoopForUI::current()->AddObserver(mouse_event_relay_.get()); | 609 MessageLoopForUI::current()->AddObserver(mouse_event_relay_.get()); |
| 610 } | 610 } |
| 611 | 611 |
| 612 void ScreenLocker::OnLoginSuccess( | 612 void ScreenLocker::OnLoginSuccess( |
| 613 const std::string& username, | 613 const std::string& username, |
| 614 const GaiaAuthConsumer::ClientLoginResult& unused, | 614 const GaiaAuthConsumer::ClientLoginResult& unused, |
| 615 bool pending_requests) { | 615 bool pending_requests) { |
| 616 LOG(INFO) << "OnLoginSuccess: Sending Unlock request."; | 616 VLOG(1) << "OnLoginSuccess: Sending Unlock request."; |
| 617 if (CrosLibrary::Get()->EnsureLoaded()) | 617 if (CrosLibrary::Get()->EnsureLoaded()) |
| 618 CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenUnlockRequested(); | 618 CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenUnlockRequested(); |
| 619 } | 619 } |
| 620 | 620 |
| 621 void ScreenLocker::InfoBubbleClosing(InfoBubble* info_bubble, | 621 void ScreenLocker::InfoBubbleClosing(InfoBubble* info_bubble, |
| 622 bool closed_by_escape) { | 622 bool closed_by_escape) { |
| 623 error_info_ = NULL; | 623 error_info_ = NULL; |
| 624 screen_lock_view_->SetSignoutEnabled(true); | 624 screen_lock_view_->SetSignoutEnabled(true); |
| 625 if (mouse_event_relay_.get()) { | 625 if (mouse_event_relay_.get()) { |
| 626 MessageLoopForUI::current()->RemoveObserver(mouse_event_relay_.get()); | 626 MessageLoopForUI::current()->RemoveObserver(mouse_event_relay_.get()); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 if (CrosLibrary::Get()->EnsureLoaded()) { | 659 if (CrosLibrary::Get()->EnsureLoaded()) { |
| 660 CrosLibrary::Get()->GetLoginLibrary()->StopSession(""); | 660 CrosLibrary::Get()->GetLoginLibrary()->StopSession(""); |
| 661 } | 661 } |
| 662 | 662 |
| 663 // Don't hide yet the locker because the chrome screen may become visible | 663 // Don't hide yet the locker because the chrome screen may become visible |
| 664 // briefly. | 664 // briefly. |
| 665 } | 665 } |
| 666 } | 666 } |
| 667 | 667 |
| 668 void ScreenLocker::OnGrabInputs() { | 668 void ScreenLocker::OnGrabInputs() { |
| 669 DLOG(INFO) << "OnGrabInputs"; | 669 DVLOG(1) << "OnGrabInputs"; |
| 670 input_grabbed_ = true; | 670 input_grabbed_ = true; |
| 671 if (drawn_) | 671 if (drawn_) |
| 672 ScreenLockReady(); | 672 ScreenLockReady(); |
| 673 } | 673 } |
| 674 | 674 |
| 675 // static | 675 // static |
| 676 void ScreenLocker::Show() { | 676 void ScreenLocker::Show() { |
| 677 LOG(INFO) << "In ScreenLocker::Show"; | 677 VLOG(1) << "In ScreenLocker::Show"; |
| 678 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); | 678 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); |
| 679 | 679 |
| 680 // Exit fullscreen. | 680 // Exit fullscreen. |
| 681 Browser* browser = BrowserList::GetLastActive(); | 681 Browser* browser = BrowserList::GetLastActive(); |
| 682 // browser can be NULL if we receive a lock request before the first browser | 682 // browser can be NULL if we receive a lock request before the first browser |
| 683 // window is shown. | 683 // window is shown. |
| 684 if (browser && browser->window()->IsFullscreen()) { | 684 if (browser && browser->window()->IsFullscreen()) { |
| 685 browser->ToggleFullscreenMode(); | 685 browser->ToggleFullscreenMode(); |
| 686 } | 686 } |
| 687 | 687 |
| 688 if (!screen_locker_) { | 688 if (!screen_locker_) { |
| 689 LOG(INFO) << "Show: Locking screen"; | 689 VLOG(1) << "Show: Locking screen"; |
| 690 ScreenLocker* locker = | 690 ScreenLocker* locker = |
| 691 new ScreenLocker(UserManager::Get()->logged_in_user()); | 691 new ScreenLocker(UserManager::Get()->logged_in_user()); |
| 692 locker->Init(); | 692 locker->Init(); |
| 693 } else { | 693 } else { |
| 694 // PowerManager re-sends lock screen signal if it doesn't | 694 // PowerManager re-sends lock screen signal if it doesn't |
| 695 // receive the response within timeout. Just send complete | 695 // receive the response within timeout. Just send complete |
| 696 // signal. | 696 // signal. |
| 697 LOG(INFO) << "Show: locker already exists. " | 697 VLOG(1) << "Show: locker already exists. Just sending completion event."; |
| 698 << "just sending completion event"; | |
| 699 if (CrosLibrary::Get()->EnsureLoaded()) | 698 if (CrosLibrary::Get()->EnsureLoaded()) |
| 700 CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenLockCompleted(); | 699 CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenLockCompleted(); |
| 701 } | 700 } |
| 702 } | 701 } |
| 703 | 702 |
| 704 // static | 703 // static |
| 705 void ScreenLocker::Hide() { | 704 void ScreenLocker::Hide() { |
| 706 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); | 705 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); |
| 707 DCHECK(screen_locker_); | 706 DCHECK(screen_locker_); |
| 708 LOG(INFO) << "Hide: Deleting ScreenLocker:" << screen_locker_; | 707 VLOG(1) << "Hide: Deleting ScreenLocker: " << screen_locker_; |
| 709 MessageLoopForUI::current()->DeleteSoon(FROM_HERE, screen_locker_); | 708 MessageLoopForUI::current()->DeleteSoon(FROM_HERE, screen_locker_); |
| 710 } | 709 } |
| 711 | 710 |
| 712 // static | 711 // static |
| 713 void ScreenLocker::UnlockScreenFailed() { | 712 void ScreenLocker::UnlockScreenFailed() { |
| 714 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); | 713 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); |
| 715 if (screen_locker_) { | 714 if (screen_locker_) { |
| 716 // Power manager decided no to unlock the screen even if a user | 715 // Power manager decided no to unlock the screen even if a user |
| 717 // typed in password, for example, when a user closed the lid | 716 // typed in password, for example, when a user closed the lid |
| 718 // immediately after typing in the password. | 717 // immediately after typing in the password. |
| 719 LOG(INFO) << "UnlockScreenFailed: re-enabling screen locker"; | 718 VLOG(1) << "UnlockScreenFailed: re-enabling screen locker."; |
| 720 screen_locker_->EnableInput(); | 719 screen_locker_->EnableInput(); |
| 721 } else { | 720 } else { |
| 722 // This can happen when a user requested unlock, but PowerManager | 721 // This can happen when a user requested unlock, but PowerManager |
| 723 // rejected because the computer is closed, then PowerManager unlocked | 722 // rejected because the computer is closed, then PowerManager unlocked |
| 724 // because it's open again and the above failure message arrives. | 723 // because it's open again and the above failure message arrives. |
| 725 // This'd be extremely rare, but may still happen. | 724 // This'd be extremely rare, but may still happen. |
| 726 LOG(INFO) << "UnlockScreenFailed: screen is already unlocked."; | 725 VLOG(1) << "UnlockScreenFailed: screen is already unlocked."; |
| 727 } | 726 } |
| 728 } | 727 } |
| 729 | 728 |
| 730 // static | 729 // static |
| 731 void ScreenLocker::InitClass() { | 730 void ScreenLocker::InitClass() { |
| 732 Singleton<ScreenLockObserver>::get(); | 731 Singleton<ScreenLockObserver>::get(); |
| 733 } | 732 } |
| 734 | 733 |
| 735 //////////////////////////////////////////////////////////////////////////////// | 734 //////////////////////////////////////////////////////////////////////////////// |
| 736 // ScreenLocker, private: | 735 // ScreenLocker, private: |
| 737 | 736 |
| 738 ScreenLocker::~ScreenLocker() { | 737 ScreenLocker::~ScreenLocker() { |
| 739 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); | 738 DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI); |
| 740 ClearErrors(); | 739 ClearErrors(); |
| 741 if (input_event_observer_.get()) | 740 if (input_event_observer_.get()) |
| 742 MessageLoopForUI::current()->RemoveObserver(input_event_observer_.get()); | 741 MessageLoopForUI::current()->RemoveObserver(input_event_observer_.get()); |
| 743 if (locker_input_event_observer_.get()) { | 742 if (locker_input_event_observer_.get()) { |
| 744 lock_widget_->GetFocusManager()->UnregisterAccelerator( | 743 lock_widget_->GetFocusManager()->UnregisterAccelerator( |
| 745 views::Accelerator(app::VKEY_ESCAPE, false, false, false), this); | 744 views::Accelerator(app::VKEY_ESCAPE, false, false, false), this); |
| 746 MessageLoopForUI::current()->RemoveObserver( | 745 MessageLoopForUI::current()->RemoveObserver( |
| 747 locker_input_event_observer_.get()); | 746 locker_input_event_observer_.get()); |
| 748 } | 747 } |
| 749 | 748 |
| 750 gdk_keyboard_ungrab(GDK_CURRENT_TIME); | 749 gdk_keyboard_ungrab(GDK_CURRENT_TIME); |
| 751 gdk_pointer_ungrab(GDK_CURRENT_TIME); | 750 gdk_pointer_ungrab(GDK_CURRENT_TIME); |
| 752 | 751 |
| 753 DCHECK(lock_window_); | 752 DCHECK(lock_window_); |
| 754 LOG(INFO) << "~ScreenLocker(): Closing ScreenLocker window"; | 753 VLOG(1) << "~ScreenLocker(): Closing ScreenLocker window."; |
| 755 lock_window_->Close(); | 754 lock_window_->Close(); |
| 756 // lock_widget_ will be deleted by gtk's destroy signal. | 755 // lock_widget_ will be deleted by gtk's destroy signal. |
| 757 screen_locker_ = NULL; | 756 screen_locker_ = NULL; |
| 758 bool state = false; | 757 bool state = false; |
| 759 NotificationService::current()->Notify( | 758 NotificationService::current()->Notify( |
| 760 NotificationType::SCREEN_LOCK_STATE_CHANGED, | 759 NotificationType::SCREEN_LOCK_STATE_CHANGED, |
| 761 Source<ScreenLocker>(this), | 760 Source<ScreenLocker>(this), |
| 762 Details<bool>(&state)); | 761 Details<bool>(&state)); |
| 763 if (CrosLibrary::Get()->EnsureLoaded()) | 762 if (CrosLibrary::Get()->EnsureLoaded()) |
| 764 CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenUnlockCompleted(); | 763 CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenUnlockCompleted(); |
| 765 } | 764 } |
| 766 | 765 |
| 767 void ScreenLocker::SetAuthenticator(Authenticator* authenticator) { | 766 void ScreenLocker::SetAuthenticator(Authenticator* authenticator) { |
| 768 authenticator_ = authenticator; | 767 authenticator_ = authenticator; |
| 769 } | 768 } |
| 770 | 769 |
| 771 void ScreenLocker::ScreenLockReady() { | 770 void ScreenLocker::ScreenLockReady() { |
| 772 LOG(INFO) << "ScreenLockReady: sending completed signal to power manager."; | 771 VLOG(1) << "ScreenLockReady: sending completed signal to power manager."; |
| 773 locked_ = true; | 772 locked_ = true; |
| 774 if (background_view_->ScreenSaverEnabled()) { | 773 if (background_view_->ScreenSaverEnabled()) { |
| 775 lock_widget_->GetFocusManager()->RegisterAccelerator( | 774 lock_widget_->GetFocusManager()->RegisterAccelerator( |
| 776 views::Accelerator(app::VKEY_ESCAPE, false, false, false), this); | 775 views::Accelerator(app::VKEY_ESCAPE, false, false, false), this); |
| 777 locker_input_event_observer_.reset(new LockerInputEventObserver(this)); | 776 locker_input_event_observer_.reset(new LockerInputEventObserver(this)); |
| 778 MessageLoopForUI::current()->AddObserver( | 777 MessageLoopForUI::current()->AddObserver( |
| 779 locker_input_event_observer_.get()); | 778 locker_input_event_observer_.get()); |
| 780 } else { | 779 } else { |
| 781 // Don't enable the password field until we grab all inputs. | 780 // Don't enable the password field until we grab all inputs. |
| 782 EnableInput(); | 781 EnableInput(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 793 | 792 |
| 794 void ScreenLocker::OnClientEvent(GtkWidget* widge, GdkEventClient* event) { | 793 void ScreenLocker::OnClientEvent(GtkWidget* widge, GdkEventClient* event) { |
| 795 WmIpc::Message msg; | 794 WmIpc::Message msg; |
| 796 WmIpc::instance()->DecodeMessage(*event, &msg); | 795 WmIpc::instance()->DecodeMessage(*event, &msg); |
| 797 if (msg.type() == WM_IPC_MESSAGE_CHROME_NOTIFY_SCREEN_REDRAWN_FOR_LOCK) { | 796 if (msg.type() == WM_IPC_MESSAGE_CHROME_NOTIFY_SCREEN_REDRAWN_FOR_LOCK) { |
| 798 OnWindowManagerReady(); | 797 OnWindowManagerReady(); |
| 799 } | 798 } |
| 800 } | 799 } |
| 801 | 800 |
| 802 void ScreenLocker::OnWindowManagerReady() { | 801 void ScreenLocker::OnWindowManagerReady() { |
| 803 DLOG(INFO) << "OnClientEvent: drawn for lock"; | 802 DVLOG(1) << "OnClientEvent: drawn for lock"; |
| 804 drawn_ = true; | 803 drawn_ = true; |
| 805 if (input_grabbed_) | 804 if (input_grabbed_) |
| 806 ScreenLockReady(); | 805 ScreenLockReady(); |
| 807 } | 806 } |
| 808 | 807 |
| 809 void ScreenLocker::StopScreenSaver() { | 808 void ScreenLocker::StopScreenSaver() { |
| 810 if (background_view_->IsScreenSaverVisible()) { | 809 if (background_view_->IsScreenSaverVisible()) { |
| 811 LOG(INFO) << "StopScreenSaver"; | 810 VLOG(1) << "StopScreenSaver"; |
| 812 background_view_->HideScreenSaver(); | 811 background_view_->HideScreenSaver(); |
| 813 if (screen_lock_view_) { | 812 if (screen_lock_view_) { |
| 814 screen_lock_view_->SetVisible(true); | 813 screen_lock_view_->SetVisible(true); |
| 815 screen_lock_view_->RequestFocus(); | 814 screen_lock_view_->RequestFocus(); |
| 816 } | 815 } |
| 817 EnableInput(); | 816 EnableInput(); |
| 818 } | 817 } |
| 819 } | 818 } |
| 820 | 819 |
| 821 void ScreenLocker::StartScreenSaver() { | 820 void ScreenLocker::StartScreenSaver() { |
| 822 if (!background_view_->IsScreenSaverVisible()) { | 821 if (!background_view_->IsScreenSaverVisible()) { |
| 823 LOG(INFO) << "StartScreenSaver"; | 822 VLOG(1) << "StartScreenSaver"; |
| 824 background_view_->ShowScreenSaver(); | 823 background_view_->ShowScreenSaver(); |
| 825 if (screen_lock_view_) { | 824 if (screen_lock_view_) { |
| 826 screen_lock_view_->SetEnabled(false); | 825 screen_lock_view_->SetEnabled(false); |
| 827 screen_lock_view_->SetVisible(false); | 826 screen_lock_view_->SetVisible(false); |
| 828 } | 827 } |
| 829 ClearErrors(); | 828 ClearErrors(); |
| 830 } | 829 } |
| 831 } | 830 } |
| 832 | 831 |
| 833 bool ScreenLocker::AcceleratorPressed(const views::Accelerator& accelerator) { | 832 bool ScreenLocker::AcceleratorPressed(const views::Accelerator& accelerator) { |
| 834 if (!background_view_->IsScreenSaverVisible()) { | 833 if (!background_view_->IsScreenSaverVisible()) { |
| 835 StartScreenSaver(); | 834 StartScreenSaver(); |
| 836 return true; | 835 return true; |
| 837 } | 836 } |
| 838 return false; | 837 return false; |
| 839 } | 838 } |
| 840 | 839 |
| 841 } // namespace chromeos | 840 } // namespace chromeos |
| OLD | NEW |