Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/inline_login_handler_impl.h" | 5 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 void CloseModalSigninIfNeeded(InlineLoginHandlerImpl* handler) { | 113 void CloseModalSigninIfNeeded(InlineLoginHandlerImpl* handler) { |
| 114 if (handler && switches::UsePasswordSeparatedSigninFlow()) { | 114 if (handler && switches::UsePasswordSeparatedSigninFlow()) { |
| 115 Browser* browser = handler->GetDesktopBrowser(); | 115 Browser* browser = handler->GetDesktopBrowser(); |
| 116 if (browser) | 116 if (browser) |
| 117 browser->CloseModalSigninWindow(); | 117 browser->CloseModalSigninWindow(); |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 void UnlockProfileAndHideLoginUI(const base::FilePath profile_path, | 121 void UnlockProfileAndHideLoginUI(const base::FilePath profile_path, |
| 122 InlineLoginHandlerImpl* handler) { | 122 InlineLoginHandlerImpl* handler) { |
| 123 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 123 if (!profile_path.empty()) { |
|
anthonyvd
2016/11/28 12:36:13
This should only be the case when sign in happens
| |
| 124 if (profile_manager) { | 124 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 125 ProfileAttributesEntry* entry; | 125 if (profile_manager) { |
| 126 if (profile_manager->GetProfileAttributesStorage() | 126 ProfileAttributesEntry* entry; |
| 127 .GetProfileAttributesWithPath(profile_path, &entry)) { | 127 if (profile_manager->GetProfileAttributesStorage() |
| 128 entry->SetIsSigninRequired(false); | 128 .GetProfileAttributesWithPath(profile_path, &entry)) { |
| 129 entry->SetIsSigninRequired(false); | |
| 130 } | |
| 129 } | 131 } |
| 130 } | 132 } |
| 131 if (handler) | 133 if (handler) |
| 132 handler->web_ui()->CallJavascriptFunctionUnsafe("inline.login.closeDialog"); | 134 handler->web_ui()->CallJavascriptFunctionUnsafe("inline.login.closeDialog"); |
| 133 UserManager::Hide(); | 135 UserManager::Hide(); |
| 134 } | 136 } |
| 135 | 137 |
| 136 bool IsCrossAccountError(Profile* profile, | 138 bool IsCrossAccountError(Profile* profile, |
| 137 const std::string& email, | 139 const std::string& email, |
| 138 const std::string& gaia_id) { | 140 const std::string& gaia_id) { |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 789 | 791 |
| 790 // InlineSigninHelper will delete itself. | 792 // InlineSigninHelper will delete itself. |
| 791 new InlineSigninHelper( | 793 new InlineSigninHelper( |
| 792 handler_weak_ptr, params.partition->GetURLRequestContext(), profile, | 794 handler_weak_ptr, params.partition->GetURLRequestContext(), profile, |
| 793 status, params.url, params.email, params.gaia_id, params.password, | 795 status, params.url, params.email, params.gaia_id, params.password, |
| 794 params.session_index, params.auth_code, signin_scoped_device_id, | 796 params.session_index, params.auth_code, signin_scoped_device_id, |
| 795 params.choose_what_to_sync, params.confirm_untrusted_signin); | 797 params.choose_what_to_sync, params.confirm_untrusted_signin); |
| 796 | 798 |
| 797 // If opened from user manager to unlock a profile, make sure the user manager | 799 // If opened from user manager to unlock a profile, make sure the user manager |
| 798 // is closed and that the profile is marked as unlocked. | 800 // is closed and that the profile is marked as unlocked. |
| 799 if (!params.profile_path.empty() && !signin::IsForceSigninEnabled()) { | 801 if (!signin::IsForceSigninEnabled()) { |
| 800 UnlockProfileAndHideLoginUI(params.profile_path, params.handler); | 802 UnlockProfileAndHideLoginUI(params.profile_path, params.handler); |
| 801 } | 803 } |
| 802 } | 804 } |
| 803 | 805 |
| 804 void InlineLoginHandlerImpl::HandleLoginError(const std::string& error_msg, | 806 void InlineLoginHandlerImpl::HandleLoginError(const std::string& error_msg, |
| 805 const base::string16& email) { | 807 const base::string16& email) { |
| 806 SyncStarterCallback(OneClickSigninSyncStarter::SYNC_SETUP_FAILURE); | 808 SyncStarterCallback(OneClickSigninSyncStarter::SYNC_SETUP_FAILURE); |
| 807 Browser* browser = GetDesktopBrowser(); | 809 Browser* browser = GetDesktopBrowser(); |
| 808 Profile* profile = Profile::FromWebUI(web_ui()); | 810 Profile* profile = Profile::FromWebUI(web_ui()); |
| 809 | 811 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 868 } | 870 } |
| 869 | 871 |
| 870 if (show_account_management) { | 872 if (show_account_management) { |
| 871 browser->window()->ShowAvatarBubbleFromAvatarButton( | 873 browser->window()->ShowAvatarBubbleFromAvatarButton( |
| 872 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, | 874 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, |
| 873 signin::ManageAccountsParams(), | 875 signin::ManageAccountsParams(), |
| 874 signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN); | 876 signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN); |
| 875 } | 877 } |
| 876 } | 878 } |
| 877 } | 879 } |
| OLD | NEW |