| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 void CloseModalSigninIfNeeded(InlineLoginHandlerImpl* handler) { | 229 void CloseModalSigninIfNeeded(InlineLoginHandlerImpl* handler) { |
| 230 if (handler && switches::UsePasswordSeparatedSigninFlow()) { | 230 if (handler && switches::UsePasswordSeparatedSigninFlow()) { |
| 231 Browser* browser = handler->GetDesktopBrowser(); | 231 Browser* browser = handler->GetDesktopBrowser(); |
| 232 if (browser) | 232 if (browser) |
| 233 browser->CloseModalSigninWindow(); | 233 browser->CloseModalSigninWindow(); |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 | 236 |
| 237 void UnlockProfileAndHideLoginUI(const base::FilePath profile_path, | 237 void UnlockProfileAndHideLoginUI(const base::FilePath profile_path, |
| 238 InlineLoginHandlerImpl* handler) { | 238 InlineLoginHandlerImpl* handler) { |
| 239 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 239 if (!profile_path.empty()) { |
| 240 if (profile_manager) { | 240 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 241 ProfileAttributesEntry* entry; | 241 if (profile_manager) { |
| 242 if (profile_manager->GetProfileAttributesStorage() | 242 ProfileAttributesEntry* entry; |
| 243 .GetProfileAttributesWithPath(profile_path, &entry)) { | 243 if (profile_manager->GetProfileAttributesStorage() |
| 244 entry->SetIsSigninRequired(false); | 244 .GetProfileAttributesWithPath(profile_path, &entry)) { |
| 245 entry->SetIsSigninRequired(false); |
| 246 } |
| 245 } | 247 } |
| 246 } | 248 } |
| 247 if (handler) | 249 if (handler) |
| 248 handler->web_ui()->CallJavascriptFunctionUnsafe("inline.login.closeDialog"); | 250 handler->web_ui()->CallJavascriptFunctionUnsafe("inline.login.closeDialog"); |
| 249 UserManager::Hide(); | 251 UserManager::Hide(); |
| 250 } | 252 } |
| 251 | 253 |
| 252 bool IsCrossAccountError(Profile* profile, | 254 bool IsCrossAccountError(Profile* profile, |
| 253 const std::string& email, | 255 const std::string& email, |
| 254 const std::string& gaia_id) { | 256 const std::string& gaia_id) { |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 | 912 |
| 911 // InlineSigninHelper will delete itself. | 913 // InlineSigninHelper will delete itself. |
| 912 new InlineSigninHelper( | 914 new InlineSigninHelper( |
| 913 handler_weak_ptr, params.partition->GetURLRequestContext(), profile, | 915 handler_weak_ptr, params.partition->GetURLRequestContext(), profile, |
| 914 status, params.url, params.email, params.gaia_id, params.password, | 916 status, params.url, params.email, params.gaia_id, params.password, |
| 915 params.session_index, params.auth_code, signin_scoped_device_id, | 917 params.session_index, params.auth_code, signin_scoped_device_id, |
| 916 params.choose_what_to_sync, params.confirm_untrusted_signin); | 918 params.choose_what_to_sync, params.confirm_untrusted_signin); |
| 917 | 919 |
| 918 // If opened from user manager to unlock a profile, make sure the user manager | 920 // If opened from user manager to unlock a profile, make sure the user manager |
| 919 // is closed and that the profile is marked as unlocked. | 921 // is closed and that the profile is marked as unlocked. |
| 920 if (!params.profile_path.empty() && !signin::IsForceSigninEnabled()) { | 922 if (!signin::IsForceSigninEnabled()) { |
| 921 UnlockProfileAndHideLoginUI(params.profile_path, params.handler); | 923 UnlockProfileAndHideLoginUI(params.profile_path, params.handler); |
| 922 } | 924 } |
| 923 } | 925 } |
| 924 | 926 |
| 925 void InlineLoginHandlerImpl::HandleLoginError(const std::string& error_msg, | 927 void InlineLoginHandlerImpl::HandleLoginError(const std::string& error_msg, |
| 926 const base::string16& email) { | 928 const base::string16& email) { |
| 927 SyncStarterCallback(OneClickSigninSyncStarter::SYNC_SETUP_FAILURE); | 929 SyncStarterCallback(OneClickSigninSyncStarter::SYNC_SETUP_FAILURE); |
| 928 Browser* browser = GetDesktopBrowser(); | 930 Browser* browser = GetDesktopBrowser(); |
| 929 Profile* profile = Profile::FromWebUI(web_ui()); | 931 Profile* profile = Profile::FromWebUI(web_ui()); |
| 930 | 932 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 } | 991 } |
| 990 | 992 |
| 991 if (show_account_management) { | 993 if (show_account_management) { |
| 992 browser->window()->ShowAvatarBubbleFromAvatarButton( | 994 browser->window()->ShowAvatarBubbleFromAvatarButton( |
| 993 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, | 995 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, |
| 994 signin::ManageAccountsParams(), | 996 signin::ManageAccountsParams(), |
| 995 signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN); | 997 signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN); |
| 996 } | 998 } |
| 997 } | 999 } |
| 998 } | 1000 } |
| OLD | NEW |