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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 reason == signin_metrics::Reason::REASON_UNLOCK || | 245 reason == signin_metrics::Reason::REASON_UNLOCK || |
246 reason == signin_metrics::Reason::REASON_ADD_SECONDARY_ACCOUNT) { | 246 reason == signin_metrics::Reason::REASON_ADD_SECONDARY_ACCOUNT) { |
247 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> | 247 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)-> |
248 UpdateCredentials(account_id, result.refresh_token); | 248 UpdateCredentials(account_id, result.refresh_token); |
249 | 249 |
250 if (signin::IsAutoCloseEnabledInURL(current_url_)) { | 250 if (signin::IsAutoCloseEnabledInURL(current_url_)) { |
251 // Close the gaia sign in tab via a task to make sure we aren't in the | 251 // Close the gaia sign in tab via a task to make sure we aren't in the |
252 // middle of any webui handler code. | 252 // middle of any webui handler code. |
253 base::ThreadTaskRunnerHandle::Get()->PostTask( | 253 base::ThreadTaskRunnerHandle::Get()->PostTask( |
254 FROM_HERE, | 254 FROM_HERE, |
255 base::Bind(&InlineLoginHandlerImpl::CloseTab, handler_, | 255 base::BindOnce(&InlineLoginHandlerImpl::CloseTab, handler_, |
256 signin::ShouldShowAccountManagement(current_url_))); | 256 signin::ShouldShowAccountManagement(current_url_))); |
257 } | 257 } |
258 | 258 |
259 if (reason == signin_metrics::Reason::REASON_REAUTHENTICATION || | 259 if (reason == signin_metrics::Reason::REASON_REAUTHENTICATION || |
260 reason == signin_metrics::Reason::REASON_UNLOCK) { | 260 reason == signin_metrics::Reason::REASON_UNLOCK) { |
261 signin_manager->MergeSigninCredentialIntoCookieJar(); | 261 signin_manager->MergeSigninCredentialIntoCookieJar(); |
262 } | 262 } |
263 LogSigninReason(reason); | 263 LogSigninReason(reason); |
264 } else { | 264 } else { |
265 browser_sync::ProfileSyncService* sync_service = | 265 browser_sync::ProfileSyncService* sync_service = |
266 ProfileSyncServiceFactory::GetForProfile(profile_); | 266 ProfileSyncServiceFactory::GetForProfile(profile_); |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 const GURL& current_url = contents->GetLastCommittedURL(); | 851 const GURL& current_url = contents->GetLastCommittedURL(); |
852 signin_metrics::AccessPoint access_point = | 852 signin_metrics::AccessPoint access_point = |
853 signin::GetAccessPointForPromoURL(current_url); | 853 signin::GetAccessPointForPromoURL(current_url); |
854 bool auto_close = signin::IsAutoCloseEnabledInURL(current_url); | 854 bool auto_close = signin::IsAutoCloseEnabledInURL(current_url); |
855 | 855 |
856 if (result == OneClickSigninSyncStarter::SYNC_SETUP_FAILURE) { | 856 if (result == OneClickSigninSyncStarter::SYNC_SETUP_FAILURE) { |
857 RedirectToNtpOrAppsPage(contents, access_point); | 857 RedirectToNtpOrAppsPage(contents, access_point); |
858 } else if (auto_close) { | 858 } else if (auto_close) { |
859 base::ThreadTaskRunnerHandle::Get()->PostTask( | 859 base::ThreadTaskRunnerHandle::Get()->PostTask( |
860 FROM_HERE, | 860 FROM_HERE, |
861 base::Bind(&InlineLoginHandlerImpl::CloseTab, | 861 base::BindOnce(&InlineLoginHandlerImpl::CloseTab, |
862 weak_factory_.GetWeakPtr(), | 862 weak_factory_.GetWeakPtr(), |
863 signin::ShouldShowAccountManagement(current_url))); | 863 signin::ShouldShowAccountManagement(current_url))); |
864 } else { | 864 } else { |
865 RedirectToNtpOrAppsPageIfNecessary(contents, access_point); | 865 RedirectToNtpOrAppsPageIfNecessary(contents, access_point); |
866 } | 866 } |
867 } | 867 } |
868 | 868 |
869 void InlineLoginHandlerImpl::CloseTab(bool show_account_management) { | 869 void InlineLoginHandlerImpl::CloseTab(bool show_account_management) { |
870 content::WebContents* tab = web_ui()->GetWebContents(); | 870 content::WebContents* tab = web_ui()->GetWebContents(); |
871 Browser* browser = chrome::FindBrowserWithWebContents(tab); | 871 Browser* browser = chrome::FindBrowserWithWebContents(tab); |
872 if (browser) { | 872 if (browser) { |
873 TabStripModel* tab_strip_model = browser->tab_strip_model(); | 873 TabStripModel* tab_strip_model = browser->tab_strip_model(); |
874 if (tab_strip_model) { | 874 if (tab_strip_model) { |
875 int index = tab_strip_model->GetIndexOfWebContents(tab); | 875 int index = tab_strip_model->GetIndexOfWebContents(tab); |
876 if (index != TabStripModel::kNoTab) { | 876 if (index != TabStripModel::kNoTab) { |
877 tab_strip_model->ExecuteContextMenuCommand( | 877 tab_strip_model->ExecuteContextMenuCommand( |
878 index, TabStripModel::CommandCloseTab); | 878 index, TabStripModel::CommandCloseTab); |
879 } | 879 } |
880 } | 880 } |
881 | 881 |
882 if (show_account_management) { | 882 if (show_account_management) { |
883 browser->window()->ShowAvatarBubbleFromAvatarButton( | 883 browser->window()->ShowAvatarBubbleFromAvatarButton( |
884 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, | 884 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, |
885 signin::ManageAccountsParams(), | 885 signin::ManageAccountsParams(), |
886 signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN, | 886 signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN, |
887 false); | 887 false); |
888 } | 888 } |
889 } | 889 } |
890 } | 890 } |
OLD | NEW |