| 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 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 if (source_ == signin::SOURCE_UNKNOWN) | 1235 if (source_ == signin::SOURCE_UNKNOWN) |
| 1236 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_SHOWN); | 1236 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_SHOWN); |
| 1237 else | 1237 else |
| 1238 LogHistogramValue(source_, one_click_signin::HISTOGRAM_SHOWN); | 1238 LogHistogramValue(source_, one_click_signin::HISTOGRAM_SHOWN); |
| 1239 } | 1239 } |
| 1240 showing_signin_ = true; | 1240 showing_signin_ = true; |
| 1241 } | 1241 } |
| 1242 | 1242 |
| 1243 // When Gaia finally redirects to the continue URL, Gaia will add some | 1243 // When Gaia finally redirects to the continue URL, Gaia will add some |
| 1244 // extra query parameters. So ignore the parameters when checking to see | 1244 // extra query parameters. So ignore the parameters when checking to see |
| 1245 // if the user has continued. | 1245 // if the user has continued. Sometimes locales will redirect to a country- |
| 1246 // specific TLD so just make sure it's a valid domain instead of comparing |
| 1247 // for an exact match. |
| 1246 GURL::Replacements replacements; | 1248 GURL::Replacements replacements; |
| 1247 replacements.ClearQuery(); | 1249 replacements.ClearQuery(); |
| 1248 const bool continue_url_match = ( | 1250 const bool continue_url_match = ( |
| 1249 continue_url_.is_valid() && | 1251 google_util::IsGoogleDomainUrl( |
| 1250 url.ReplaceComponents(replacements) == | 1252 continue_url_, |
| 1251 continue_url_.ReplaceComponents(replacements)); | 1253 google_util::ALLOW_SUBDOMAIN, |
| 1254 google_util::DISALLOW_NON_STANDARD_PORTS) && |
| 1255 url.ReplaceComponents(replacements).path() == |
| 1256 continue_url_.ReplaceComponents(replacements).path()); |
| 1252 const bool original_continue_url_match = ( | 1257 const bool original_continue_url_match = ( |
| 1253 original_continue_url_.is_valid() && | 1258 google_util::IsGoogleDomainUrl( |
| 1254 url.ReplaceComponents(replacements) == | 1259 original_continue_url_, |
| 1255 original_continue_url_.ReplaceComponents(replacements)); | 1260 google_util::ALLOW_SUBDOMAIN, |
| 1261 google_util::DISALLOW_NON_STANDARD_PORTS) && |
| 1262 url.ReplaceComponents(replacements).path() == |
| 1263 original_continue_url_.ReplaceComponents(replacements).path()); |
| 1256 | 1264 |
| 1257 if (continue_url_match) | 1265 if (continue_url_match) |
| 1258 RemoveSigninRedirectURLHistoryItem(contents); | 1266 RemoveSigninRedirectURLHistoryItem(contents); |
| 1259 | 1267 |
| 1260 // If there is no valid email yet, there is nothing to do. As of M26, the | 1268 // If there is no valid email yet, there is nothing to do. As of M26, the |
| 1261 // password is allowed to be empty, since its no longer required to setup | 1269 // password is allowed to be empty, since its no longer required to setup |
| 1262 // sync. | 1270 // sync. |
| 1263 if (email_.empty()) { | 1271 if (email_.empty()) { |
| 1264 VLOG(1) << "OneClickSigninHelper::DidStopLoading: nothing to do"; | 1272 VLOG(1) << "OneClickSigninHelper::DidStopLoading: nothing to do"; |
| 1265 // Original-url check done because some user actions cans get us to a page | 1273 // Original-url check done because some user actions cans get us to a page |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1515 // If the web contents is showing a blank page and not about to be closed, | 1523 // If the web contents is showing a blank page and not about to be closed, |
| 1516 // redirect to the NTP or apps page. | 1524 // redirect to the NTP or apps page. |
| 1517 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && | 1525 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && |
| 1518 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { | 1526 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { |
| 1519 RedirectToNtpOrAppsPage( | 1527 RedirectToNtpOrAppsPage( |
| 1520 web_contents(), | 1528 web_contents(), |
| 1521 signin::GetSourceForPromoURL(original_continue_url_)); | 1529 signin::GetSourceForPromoURL(original_continue_url_)); |
| 1522 } | 1530 } |
| 1523 } | 1531 } |
| 1524 } | 1532 } |
| OLD | NEW |