| 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 <gdk/gdkx.h> | 7 #include <gdk/gdkx.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include <X11/extensions/XTest.h> | 10 #include <X11/extensions/XTest.h> |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 lock_window_->Init(NULL, init_bounds); | 641 lock_window_->Init(NULL, init_bounds); |
| 642 | 642 |
| 643 g_signal_connect(lock_window_->GetNativeView(), "client-event", | 643 g_signal_connect(lock_window_->GetNativeView(), "client-event", |
| 644 G_CALLBACK(OnClientEventThunk), this); | 644 G_CALLBACK(OnClientEventThunk), this); |
| 645 | 645 |
| 646 // GTK does not like zero width/height. | 646 // GTK does not like zero width/height. |
| 647 if (!unlock_on_input_) { | 647 if (!unlock_on_input_) { |
| 648 screen_lock_view_ = new ScreenLockView(this); | 648 screen_lock_view_ = new ScreenLockView(this); |
| 649 screen_lock_view_->Init(); | 649 screen_lock_view_->Init(); |
| 650 screen_lock_view_->SetEnabled(false); | 650 screen_lock_view_->SetEnabled(false); |
| 651 screen_lock_view_->StartThrobber(); |
| 651 } else { | 652 } else { |
| 652 input_event_observer_.reset(new InputEventObserver(this)); | 653 input_event_observer_.reset(new InputEventObserver(this)); |
| 653 MessageLoopForUI::current()->AddObserver(input_event_observer_.get()); | 654 MessageLoopForUI::current()->AddObserver(input_event_observer_.get()); |
| 654 } | 655 } |
| 655 | 656 |
| 656 // Hang on to a cast version of the grab widget so we can call its | 657 // Hang on to a cast version of the grab widget so we can call its |
| 657 // TryGrabAllInputs() method later. (Nobody else needs to use it, so moving | 658 // TryGrabAllInputs() method later. (Nobody else needs to use it, so moving |
| 658 // its declaration to the header instead of keeping it in an anonymous | 659 // its declaration to the header instead of keeping it in an anonymous |
| 659 // namespace feels a bit ugly.) | 660 // namespace feels a bit ugly.) |
| 660 GrabWidget* cast_lock_widget = new GrabWidget(this); | 661 GrabWidget* cast_lock_widget = new GrabWidget(this); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 if (mouse_event_relay_.get()) { | 778 if (mouse_event_relay_.get()) { |
| 778 MessageLoopForUI::current()->RemoveObserver(mouse_event_relay_.get()); | 779 MessageLoopForUI::current()->RemoveObserver(mouse_event_relay_.get()); |
| 779 mouse_event_relay_.reset(); | 780 mouse_event_relay_.reset(); |
| 780 } | 781 } |
| 781 } | 782 } |
| 782 | 783 |
| 783 void ScreenLocker::Authenticate(const string16& password) { | 784 void ScreenLocker::Authenticate(const string16& password) { |
| 784 authentication_start_time_ = base::Time::Now(); | 785 authentication_start_time_ = base::Time::Now(); |
| 785 screen_lock_view_->SetEnabled(false); | 786 screen_lock_view_->SetEnabled(false); |
| 786 screen_lock_view_->SetSignoutEnabled(false); | 787 screen_lock_view_->SetSignoutEnabled(false); |
| 788 screen_lock_view_->StartThrobber(); |
| 787 | 789 |
| 788 // If LoginPerformer instance exists, | 790 // If LoginPerformer instance exists, |
| 789 // initial online login phase is still active. | 791 // initial online login phase is still active. |
| 790 if (LoginPerformer::default_performer()) { | 792 if (LoginPerformer::default_performer()) { |
| 791 DVLOG(1) << "Delegating authentication to LoginPerformer."; | 793 DVLOG(1) << "Delegating authentication to LoginPerformer."; |
| 792 LoginPerformer::default_performer()->Login(user_.email(), | 794 LoginPerformer::default_performer()->Login(user_.email(), |
| 793 UTF16ToUTF8(password)); | 795 UTF16ToUTF8(password)); |
| 794 } else { | 796 } else { |
| 795 BrowserThread::PostTask( | 797 BrowserThread::PostTask( |
| 796 BrowserThread::UI, FROM_HERE, | 798 BrowserThread::UI, FROM_HERE, |
| 797 NewRunnableMethod(authenticator_.get(), | 799 NewRunnableMethod(authenticator_.get(), |
| 798 &Authenticator::AuthenticateToUnlock, | 800 &Authenticator::AuthenticateToUnlock, |
| 799 user_.email(), | 801 user_.email(), |
| 800 UTF16ToUTF8(password))); | 802 UTF16ToUTF8(password))); |
| 801 } | 803 } |
| 802 } | 804 } |
| 803 | 805 |
| 804 void ScreenLocker::ClearErrors() { | 806 void ScreenLocker::ClearErrors() { |
| 805 if (error_info_) { | 807 if (error_info_) { |
| 806 error_info_->Close(); | 808 error_info_->Close(); |
| 807 error_info_ = NULL; | 809 error_info_ = NULL; |
| 808 } | 810 } |
| 809 } | 811 } |
| 810 | 812 |
| 811 void ScreenLocker::EnableInput() { | 813 void ScreenLocker::EnableInput() { |
| 812 if (screen_lock_view_) { | 814 if (screen_lock_view_) { |
| 813 screen_lock_view_->SetEnabled(true); | 815 screen_lock_view_->SetEnabled(true); |
| 814 screen_lock_view_->ClearAndSetFocusToPassword(); | 816 screen_lock_view_->ClearAndSetFocusToPassword(); |
| 817 screen_lock_view_->StopThrobber(); |
| 815 } | 818 } |
| 816 } | 819 } |
| 817 | 820 |
| 818 void ScreenLocker::Signout() { | 821 void ScreenLocker::Signout() { |
| 819 if (!error_info_) { | 822 if (!error_info_) { |
| 820 UserMetrics::RecordAction(UserMetricsAction("ScreenLocker_Signout")); | 823 UserMetrics::RecordAction(UserMetricsAction("ScreenLocker_Signout")); |
| 821 if (CrosLibrary::Get()->EnsureLoaded()) { | 824 if (CrosLibrary::Get()->EnsureLoaded()) { |
| 822 CrosLibrary::Get()->GetLoginLibrary()->StopSession(""); | 825 CrosLibrary::Get()->GetLoginLibrary()->StopSession(""); |
| 823 } | 826 } |
| 824 | 827 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 | 1043 |
| 1041 bool ScreenLocker::AcceleratorPressed(const views::Accelerator& accelerator) { | 1044 bool ScreenLocker::AcceleratorPressed(const views::Accelerator& accelerator) { |
| 1042 if (!background_view_->IsScreenSaverVisible()) { | 1045 if (!background_view_->IsScreenSaverVisible()) { |
| 1043 StartScreenSaver(); | 1046 StartScreenSaver(); |
| 1044 return true; | 1047 return true; |
| 1045 } | 1048 } |
| 1046 return false; | 1049 return false; |
| 1047 } | 1050 } |
| 1048 | 1051 |
| 1049 } // namespace chromeos | 1052 } // namespace chromeos |
| OLD | NEW |