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