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

Side by Side Diff: chrome/browser/ui/webui/signin/user_manager_screen_handler.cc

Issue 694593002: Profile unlock should always use session restore, regardless of system preference. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/webui/signin/user_manager_screen_handler.h" 5 #include "chrome/browser/ui/webui/signin/user_manager_screen_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/value_conversions.h" 10 #include "base/value_conversions.h"
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 689
690 void UserManagerScreenHandler::ReportAuthenticationResult( 690 void UserManagerScreenHandler::ReportAuthenticationResult(
691 bool success, 691 bool success,
692 ProfileMetrics::ProfileAuth auth) { 692 ProfileMetrics::ProfileAuth auth) {
693 ProfileMetrics::LogProfileAuthResult(auth); 693 ProfileMetrics::LogProfileAuthResult(auth);
694 password_attempt_.clear(); 694 password_attempt_.clear();
695 695
696 if (success) { 696 if (success) {
697 ProfileInfoCache& info_cache = 697 ProfileInfoCache& info_cache =
698 g_browser_process->profile_manager()->GetProfileInfoCache(); 698 g_browser_process->profile_manager()->GetProfileInfoCache();
699 info_cache.SetProfileSigninRequiredAtIndex(
700 authenticating_profile_index_, false);
701 base::FilePath path = info_cache.GetPathOfProfileAtIndex( 699 base::FilePath path = info_cache.GetPathOfProfileAtIndex(
702 authenticating_profile_index_); 700 authenticating_profile_index_);
703 profiles::SwitchToProfile( 701 profiles::SwitchToProfile(
704 path, 702 path,
705 desktop_type_, 703 desktop_type_,
706 true, 704 true,
707 base::Bind(&UserManagerScreenHandler::OnSwitchToProfileComplete, 705 base::Bind(&UserManagerScreenHandler::OnSwitchToProfileComplete,
708 weak_ptr_factory_.GetWeakPtr()), 706 weak_ptr_factory_.GetWeakPtr()),
709 ProfileMetrics::SWITCH_PROFILE_UNLOCK); 707 ProfileMetrics::SWITCH_PROFILE_UNLOCK);
710 } else { 708 } else {
711 web_ui()->CallJavascriptFunction( 709 web_ui()->CallJavascriptFunction(
712 "cr.ui.Oobe.showSignInError", 710 "cr.ui.Oobe.showSignInError",
713 base::FundamentalValue(0), 711 base::FundamentalValue(0),
714 base::StringValue(l10n_util::GetStringUTF8( 712 base::StringValue(l10n_util::GetStringUTF8(
715 auth == ProfileMetrics::AUTH_FAILED_OFFLINE ? 713 auth == ProfileMetrics::AUTH_FAILED_OFFLINE ?
716 IDS_LOGIN_ERROR_AUTHENTICATING_OFFLINE : 714 IDS_LOGIN_ERROR_AUTHENTICATING_OFFLINE :
717 IDS_LOGIN_ERROR_AUTHENTICATING)), 715 IDS_LOGIN_ERROR_AUTHENTICATING)),
718 base::StringValue(""), 716 base::StringValue(""),
719 base::FundamentalValue(0)); 717 base::FundamentalValue(0));
720 } 718 }
721 } 719 }
722 720
723 void UserManagerScreenHandler::OnBrowserWindowReady(Browser* browser) { 721 void UserManagerScreenHandler::OnBrowserWindowReady(Browser* browser) {
724 DCHECK(browser); 722 DCHECK(browser);
725 DCHECK(browser->window()); 723 DCHECK(browser->window());
724
725 // Unlock the profile after browser opens so startup can read the lock bit.
bcwhite 2014/10/30 19:39:44 Can you add something like "any authentication mus
726 ProfileInfoCache& info_cache =
727 g_browser_process->profile_manager()->GetProfileInfoCache();
728 size_t index = info_cache.GetIndexOfProfileWithPath(
729 browser->profile()->GetPath());
730 info_cache.SetProfileSigninRequiredAtIndex(index, false);
731
726 if (url_hash_ == profiles::kUserManagerSelectProfileTaskManager) { 732 if (url_hash_ == profiles::kUserManagerSelectProfileTaskManager) {
727 base::MessageLoop::current()->PostTask( 733 base::MessageLoop::current()->PostTask(
728 FROM_HERE, base::Bind(&chrome::ShowTaskManager, browser)); 734 FROM_HERE, base::Bind(&chrome::ShowTaskManager, browser));
729 } else if (url_hash_ == profiles::kUserManagerSelectProfileAboutChrome) { 735 } else if (url_hash_ == profiles::kUserManagerSelectProfileAboutChrome) {
730 base::MessageLoop::current()->PostTask( 736 base::MessageLoop::current()->PostTask(
731 FROM_HERE, base::Bind(&chrome::ShowAboutChrome, browser)); 737 FROM_HERE, base::Bind(&chrome::ShowAboutChrome, browser));
732 } 738 }
733 739
734 // This call is last as it deletes this object. 740 // This call is last as it deletes this object.
735 UserManager::Hide(); 741 UserManager::Hide();
(...skipping 25 matching lines...) Expand all
761 Profile* profile, Profile::CreateStatus profile_create_status) { 767 Profile* profile, Profile::CreateStatus profile_create_status) {
762 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_); 768 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_);
763 if (browser && browser->window()) { 769 if (browser && browser->window()) {
764 OnBrowserWindowReady(browser); 770 OnBrowserWindowReady(browser);
765 } else { 771 } else {
766 registrar_.Add(this, 772 registrar_.Add(this,
767 chrome::NOTIFICATION_BROWSER_WINDOW_READY, 773 chrome::NOTIFICATION_BROWSER_WINDOW_READY,
768 content::NotificationService::AllSources()); 774 content::NotificationService::AllSources());
769 } 775 }
770 } 776 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698