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

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

Issue 4980005: Allow sync with 2-factor StrongAuth accounts in ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactored 2-factor error passing Created 10 years, 1 month 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
OLDNEW
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 15 matching lines...) Expand all
26 #include "chrome/browser/chromeos/language_preferences.h" 26 #include "chrome/browser/chromeos/language_preferences.h"
27 #include "chrome/browser/chromeos/login/authenticator.h" 27 #include "chrome/browser/chromeos/login/authenticator.h"
28 #include "chrome/browser/chromeos/login/background_view.h" 28 #include "chrome/browser/chromeos/login/background_view.h"
29 #include "chrome/browser/chromeos/login/login_utils.h" 29 #include "chrome/browser/chromeos/login/login_utils.h"
30 #include "chrome/browser/chromeos/login/message_bubble.h" 30 #include "chrome/browser/chromeos/login/message_bubble.h"
31 #include "chrome/browser/chromeos/login/screen_lock_view.h" 31 #include "chrome/browser/chromeos/login/screen_lock_view.h"
32 #include "chrome/browser/chromeos/login/shutdown_button.h" 32 #include "chrome/browser/chromeos/login/shutdown_button.h"
33 #include "chrome/browser/chromeos/system_key_event_listener.h" 33 #include "chrome/browser/chromeos/system_key_event_listener.h"
34 #include "chrome/browser/chromeos/wm_ipc.h" 34 #include "chrome/browser/chromeos/wm_ipc.h"
35 #include "chrome/browser/metrics/user_metrics.h" 35 #include "chrome/browser/metrics/user_metrics.h"
36 #include "chrome/browser/profile_manager.h"
37 #include "chrome/browser/sync/profile_sync_service.h"
36 #include "chrome/browser/ui/browser.h" 38 #include "chrome/browser/ui/browser.h"
37 #include "chrome/common/chrome_switches.h" 39 #include "chrome/common/chrome_switches.h"
38 #include "chrome/common/notification_service.h" 40 #include "chrome/common/notification_service.h"
39 #include "cros/chromeos_wm_ipc_enums.h" 41 #include "cros/chromeos_wm_ipc_enums.h"
40 #include "googleurl/src/gurl.h" 42 #include "googleurl/src/gurl.h"
41 #include "grit/generated_resources.h" 43 #include "grit/generated_resources.h"
42 #include "grit/theme_resources.h" 44 #include "grit/theme_resources.h"
43 #include "views/screen.h" 45 #include "views/screen.h"
44 #include "views/widget/root_view.h" 46 #include "views/widget/root_view.h"
45 #include "views/widget/widget_gtk.h" 47 #include "views/widget/widget_gtk.h"
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 bool pending_requests) { 695 bool pending_requests) {
694 VLOG(1) << "OnLoginSuccess: Sending Unlock request."; 696 VLOG(1) << "OnLoginSuccess: Sending Unlock request.";
695 if (authentication_start_time_.is_null()) { 697 if (authentication_start_time_.is_null()) {
696 LOG(ERROR) << "authentication_start_time_ is not set"; 698 LOG(ERROR) << "authentication_start_time_ is not set";
697 } else { 699 } else {
698 base::TimeDelta delta = base::Time::Now() - authentication_start_time_; 700 base::TimeDelta delta = base::Time::Now() - authentication_start_time_;
699 VLOG(1) << "Authentication success time: " << delta.InSecondsF(); 701 VLOG(1) << "Authentication success time: " << delta.InSecondsF();
700 UMA_HISTOGRAM_TIMES("ScreenLocker.AuthenticationSuccessTime", delta); 702 UMA_HISTOGRAM_TIMES("ScreenLocker.AuthenticationSuccessTime", delta);
701 } 703 }
702 704
705 Profile* profile = ProfileManager::GetDefaultProfile();
706 if (profile) {
707 ProfileSyncService* service = profile->GetProfileSyncService(username);
708 if (service && !service->HasSyncSetupCompleted()) {
709 // If sync has failed somehow, try setting the sync passphrase here.
710 service->SetPassphrase(password, false);
711 }
712 }
713
703 if (CrosLibrary::Get()->EnsureLoaded()) 714 if (CrosLibrary::Get()->EnsureLoaded())
704 CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenUnlockRequested(); 715 CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenUnlockRequested();
705 } 716 }
706 717
707 void ScreenLocker::InfoBubbleClosing(InfoBubble* info_bubble, 718 void ScreenLocker::InfoBubbleClosing(InfoBubble* info_bubble,
708 bool closed_by_escape) { 719 bool closed_by_escape) {
709 error_info_ = NULL; 720 error_info_ = NULL;
710 screen_lock_view_->SetSignoutEnabled(true); 721 screen_lock_view_->SetSignoutEnabled(true);
711 if (mouse_event_relay_.get()) { 722 if (mouse_event_relay_.get()) {
712 MessageLoopForUI::current()->RemoveObserver(mouse_event_relay_.get()); 723 MessageLoopForUI::current()->RemoveObserver(mouse_event_relay_.get());
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 936
926 bool ScreenLocker::AcceleratorPressed(const views::Accelerator& accelerator) { 937 bool ScreenLocker::AcceleratorPressed(const views::Accelerator& accelerator) {
927 if (!background_view_->IsScreenSaverVisible()) { 938 if (!background_view_->IsScreenSaverVisible()) {
928 StartScreenSaver(); 939 StartScreenSaver();
929 return true; 940 return true;
930 } 941 }
931 return false; 942 return false;
932 } 943 }
933 944
934 } // namespace chromeos 945 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698