OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/sync/one_click_signin_helper.h" | 5 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1180 | 1180 |
1181 // No need to display a second confirmation so pass false below. | 1181 // No need to display a second confirmation so pass false below. |
1182 // TODO(atwilson): Move this into OneClickSigninSyncStarter. | 1182 // TODO(atwilson): Move this into OneClickSigninSyncStarter. |
1183 // The tab modal dialog always executes its callback before |contents| | 1183 // The tab modal dialog always executes its callback before |contents| |
1184 // is deleted. | 1184 // is deleted. |
1185 Browser* browser = chrome::FindLastActiveWithProfile( | 1185 Browser* browser = chrome::FindLastActiveWithProfile( |
1186 profile, chrome::GetActiveDesktop()); | 1186 profile, chrome::GetActiveDesktop()); |
1187 content::WebContents* contents = | 1187 content::WebContents* contents = |
1188 browser->tab_strip_model()->GetActiveWebContents(); | 1188 browser->tab_strip_model()->GetActiveWebContents(); |
1189 | 1189 |
1190 OneClickSigninHelper::StartSyncArgs start_sync_args( | |
1191 StartSyncArgs(profile, browser, auto_accept, | |
Roger Tawa OOO till Jul 10th
2014/08/14 21:54:09
Can this just be:
StartSyncArgs start_sync_arg
| |
1192 session_index, email, password, | |
1193 refresh_token, | |
1194 contents, false /* untrusted_confirmation_required */, | |
1195 source, sync_callback)); | |
1190 // If the user signs in from the new avatar bubble, the confirm email dialog | 1196 // If the user signs in from the new avatar bubble, the confirm email dialog |
1191 // would dismiss the avatar bubble, thus it won't show any confirmation upon | 1197 // would dismiss the avatar bubble, thus we need to manually re-show the |
1192 // sign in completes. This confirmation dialog already mentions that user | 1198 // avatar bubble to confirm sync settings. |
1193 // data would be synced, thus we just start sync immediately. | 1199 if (start_mode == OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST) { |
1194 // TODO(guohui): add a sync settings link to allow user to configure sync | 1200 start_sync_args.confirmation_required = |
1195 // settings before sync starts. | 1201 OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN; |
1196 if (start_mode == OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST) | 1202 } |
1197 start_mode = OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS; | |
1198 | |
1199 ConfirmEmailDialogDelegate::AskForConfirmation( | 1203 ConfirmEmailDialogDelegate::AskForConfirmation( |
1200 contents, | 1204 contents, |
1201 last_email, | 1205 last_email, |
1202 email, | 1206 email, |
1203 base::Bind( | 1207 base::Bind(&StartExplicitSync, start_sync_args, contents, start_mode)); |
1204 &StartExplicitSync, | |
1205 StartSyncArgs(profile, browser, auto_accept, | |
1206 session_index, email, password, | |
1207 refresh_token, | |
1208 contents, false /* confirmation_required */, source, | |
1209 sync_callback), | |
1210 contents, | |
1211 start_mode)); | |
1212 return true; | 1208 return true; |
1213 } | 1209 } |
1214 | 1210 |
1215 return false; | 1211 return false; |
1216 } | 1212 } |
1217 | 1213 |
1218 // static | 1214 // static |
1219 void OneClickSigninHelper::RedirectToNtpOrAppsPage( | 1215 void OneClickSigninHelper::RedirectToNtpOrAppsPage( |
1220 content::WebContents* contents, signin::Source source) { | 1216 content::WebContents* contents, signin::Source source) { |
1221 // Do nothing if a navigation is pending, since this call can be triggered | 1217 // Do nothing if a navigation is pending, since this call can be triggered |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1623 // If the web contents is showing a blank page and not about to be closed, | 1619 // If the web contents is showing a blank page and not about to be closed, |
1624 // redirect to the NTP or apps page. | 1620 // redirect to the NTP or apps page. |
1625 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && | 1621 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && |
1626 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { | 1622 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { |
1627 RedirectToNtpOrAppsPage( | 1623 RedirectToNtpOrAppsPage( |
1628 web_contents(), | 1624 web_contents(), |
1629 signin::GetSourceForPromoURL(original_continue_url_)); | 1625 signin::GetSourceForPromoURL(original_continue_url_)); |
1630 } | 1626 } |
1631 } | 1627 } |
1632 } | 1628 } |
OLD | NEW |