| 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 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 void OneClickSigninHelper::DidStopLoading( | 1207 void OneClickSigninHelper::DidStopLoading( |
| 1208 content::RenderViewHost* render_view_host) { | 1208 content::RenderViewHost* render_view_host) { |
| 1209 // If the user left the sign in process, clear all members. | 1209 // If the user left the sign in process, clear all members. |
| 1210 // TODO(rogerta): might need to allow some youtube URLs. | 1210 // TODO(rogerta): might need to allow some youtube URLs. |
| 1211 content::WebContents* contents = web_contents(); | 1211 content::WebContents* contents = web_contents(); |
| 1212 const GURL url = contents->GetLastCommittedURL(); | 1212 const GURL url = contents->GetLastCommittedURL(); |
| 1213 Profile* profile = | 1213 Profile* profile = |
| 1214 Profile::FromBrowserContext(contents->GetBrowserContext()); | 1214 Profile::FromBrowserContext(contents->GetBrowserContext()); |
| 1215 VLOG(1) << "OneClickSigninHelper::DidStopLoading: url=" << url.spec(); | 1215 VLOG(1) << "OneClickSigninHelper::DidStopLoading: url=" << url.spec(); |
| 1216 | 1216 |
| 1217 if (url.scheme() == content::kChromeUIScheme) { |
| 1218 // Suppresses OneClickSigninHelper on webUI pages to avoid inteference with |
| 1219 // inline signin flows. |
| 1220 VLOG(1) << "OneClickSigninHelper::DidStopLoading: suppressed for url=" |
| 1221 << url.spec(); |
| 1222 CleanTransientState(); |
| 1223 return; |
| 1224 } |
| 1225 |
| 1217 // If an error has already occured during the sign in flow, make sure to | 1226 // If an error has already occured during the sign in flow, make sure to |
| 1218 // display it to the user and abort the process. Do this only for | 1227 // display it to the user and abort the process. Do this only for |
| 1219 // explicit sign ins. | 1228 // explicit sign ins. |
| 1220 // TODO(rogerta): Could we move this code back up to ShowInfoBarUIThread()? | 1229 // TODO(rogerta): Could we move this code back up to ShowInfoBarUIThread()? |
| 1221 if (!error_message_.empty() && auto_accept_ == AUTO_ACCEPT_EXPLICIT) { | 1230 if (!error_message_.empty() && auto_accept_ == AUTO_ACCEPT_EXPLICIT) { |
| 1222 VLOG(1) << "OneClickSigninHelper::DidStopLoading: error=" << error_message_; | 1231 VLOG(1) << "OneClickSigninHelper::DidStopLoading: error=" << error_message_; |
| 1223 RemoveSigninRedirectURLHistoryItem(contents); | 1232 RemoveSigninRedirectURLHistoryItem(contents); |
| 1224 // After we redirect to NTP, our browser pointer gets corrupted because the | 1233 // After we redirect to NTP, our browser pointer gets corrupted because the |
| 1225 // WebContents have changed, so grab the browser pointer | 1234 // WebContents have changed, so grab the browser pointer |
| 1226 // before the navigation. | 1235 // before the navigation. |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 // If the web contents is showing a blank page and not about to be closed, | 1533 // If the web contents is showing a blank page and not about to be closed, |
| 1525 // redirect to the NTP or apps page. | 1534 // redirect to the NTP or apps page. |
| 1526 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && | 1535 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && |
| 1527 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { | 1536 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { |
| 1528 RedirectToNtpOrAppsPage( | 1537 RedirectToNtpOrAppsPage( |
| 1529 web_contents(), | 1538 web_contents(), |
| 1530 signin::GetSourceForPromoURL(original_continue_url_)); | 1539 signin::GetSourceForPromoURL(original_continue_url_)); |
| 1531 } | 1540 } |
| 1532 } | 1541 } |
| 1533 } | 1542 } |
| OLD | NEW |