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 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 | 1098 |
1099 return; | 1099 return; |
1100 } | 1100 } |
1101 | 1101 |
1102 // Only allow the dedicated signin process to sign the user into | 1102 // Only allow the dedicated signin process to sign the user into |
1103 // Chrome without intervention, because it doesn't load any untrusted | 1103 // Chrome without intervention, because it doesn't load any untrusted |
1104 // pages. If at any point an untrusted page is detected, chrome will | 1104 // pages. If at any point an untrusted page is detected, chrome will |
1105 // show a modal dialog asking the user to confirm. | 1105 // show a modal dialog asking the user to confirm. |
1106 Profile* profile = | 1106 Profile* profile = |
1107 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 1107 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
1108 ChromeSigninClient* signin_client = | 1108 SigninClient* signin_client = |
1109 profile ? ChromeSigninClientFactory::GetForProfile(profile) : NULL; | 1109 profile ? ChromeSigninClientFactory::GetForProfile(profile) : NULL; |
1110 helper->untrusted_confirmation_required_ |= | 1110 helper->untrusted_confirmation_required_ |= |
1111 (signin_client && !signin_client->IsSigninProcess(child_id)); | 1111 (signin_client && !signin_client->IsSigninProcess(child_id)); |
1112 | 1112 |
1113 if (continue_url.is_valid()) { | 1113 if (continue_url.is_valid()) { |
1114 // Set |original_continue_url_| if it is currently empty. |continue_url| | 1114 // Set |original_continue_url_| if it is currently empty. |continue_url| |
1115 // could be modified by gaia pages, thus we need to record the original | 1115 // could be modified by gaia pages, thus we need to record the original |
1116 // continue url to navigate back to the right page when sync setup is | 1116 // continue url to navigate back to the right page when sync setup is |
1117 // complete. | 1117 // complete. |
1118 if (helper->original_continue_url_.is_empty()) | 1118 if (helper->original_continue_url_.is_empty()) |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 } | 1299 } |
1300 | 1300 |
1301 void OneClickSigninHelper::DidNavigateMainFrame( | 1301 void OneClickSigninHelper::DidNavigateMainFrame( |
1302 const content::LoadCommittedDetails& details, | 1302 const content::LoadCommittedDetails& details, |
1303 const content::FrameNavigateParams& params) { | 1303 const content::FrameNavigateParams& params) { |
1304 if (!SigninManager::IsWebBasedSigninFlowURL(params.url)) { | 1304 if (!SigninManager::IsWebBasedSigninFlowURL(params.url)) { |
1305 // Make sure the renderer process is no longer considered the trusted | 1305 // Make sure the renderer process is no longer considered the trusted |
1306 // sign-in process when a navigation to a non-sign-in URL occurs. | 1306 // sign-in process when a navigation to a non-sign-in URL occurs. |
1307 Profile* profile = | 1307 Profile* profile = |
1308 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 1308 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
1309 ChromeSigninClient* signin_client = | 1309 SigninClient* signin_client = |
1310 profile ? ChromeSigninClientFactory::GetForProfile(profile) : NULL; | 1310 profile ? ChromeSigninClientFactory::GetForProfile(profile) : NULL; |
1311 int process_id = web_contents()->GetRenderProcessHost()->GetID(); | 1311 int process_id = web_contents()->GetRenderProcessHost()->GetID(); |
1312 if (signin_client && signin_client->IsSigninProcess(process_id)) | 1312 if (signin_client && signin_client->IsSigninProcess(process_id)) |
1313 signin_client->ClearSigninProcess(); | 1313 signin_client->ClearSigninProcess(); |
1314 | 1314 |
1315 // If the navigation to a non-sign-in URL hasn't been triggered by the web | 1315 // If the navigation to a non-sign-in URL hasn't been triggered by the web |
1316 // contents, the sign in flow has been aborted and the state must be | 1316 // contents, the sign in flow has been aborted and the state must be |
1317 // cleaned (crbug.com/269421). | 1317 // cleaned (crbug.com/269421). |
1318 if (!content::PageTransitionIsWebTriggerable(params.transition) && | 1318 if (!content::PageTransitionIsWebTriggerable(params.transition) && |
1319 auto_accept_ != AUTO_ACCEPT_NONE) { | 1319 auto_accept_ != AUTO_ACCEPT_NONE) { |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 // If the web contents is showing a blank page and not about to be closed, | 1597 // If the web contents is showing a blank page and not about to be closed, |
1598 // redirect to the NTP or apps page. | 1598 // redirect to the NTP or apps page. |
1599 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && | 1599 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && |
1600 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { | 1600 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { |
1601 RedirectToNtpOrAppsPage( | 1601 RedirectToNtpOrAppsPage( |
1602 web_contents(), | 1602 web_contents(), |
1603 signin::GetSourceForPromoURL(original_continue_url_)); | 1603 signin::GetSourceForPromoURL(original_continue_url_)); |
1604 } | 1604 } |
1605 } | 1605 } |
1606 } | 1606 } |
OLD | NEW |