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 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 // When Gaia finally redirects to the continue URL, Gaia will add some | 1052 // When Gaia finally redirects to the continue URL, Gaia will add some |
1053 // extra query parameters. So ignore the parameters when checking to see | 1053 // extra query parameters. So ignore the parameters when checking to see |
1054 // if the user has continued. | 1054 // if the user has continued. |
1055 GURL::Replacements replacements; | 1055 GURL::Replacements replacements; |
1056 replacements.ClearQuery(); | 1056 replacements.ClearQuery(); |
1057 const bool continue_url_match = ( | 1057 const bool continue_url_match = ( |
1058 continue_url_.is_valid() && | 1058 continue_url_.is_valid() && |
1059 url.ReplaceComponents(replacements) == | 1059 url.ReplaceComponents(replacements) == |
1060 continue_url_.ReplaceComponents(replacements)); | 1060 continue_url_.ReplaceComponents(replacements)); |
1061 | 1061 |
| 1062 if (continue_url_match) |
| 1063 RemoveCurrentHistoryItem(contents); |
| 1064 |
1062 // If there is no valid email yet, there is nothing to do. As of M26, the | 1065 // If there is no valid email yet, there is nothing to do. As of M26, the |
1063 // password is allowed to be empty, since its no longer required to setup | 1066 // password is allowed to be empty, since its no longer required to setup |
1064 // sync. | 1067 // sync. |
1065 if (email_.empty()) { | 1068 if (email_.empty()) { |
1066 VLOG(1) << "OneClickSigninHelper::DidStopLoading: nothing to do"; | 1069 VLOG(1) << "OneClickSigninHelper::DidStopLoading: nothing to do"; |
1067 if (continue_url_match && auto_accept_ == AUTO_ACCEPT_EXPLICIT) | 1070 if (continue_url_match && auto_accept_ == AUTO_ACCEPT_EXPLICIT) |
1068 RedirectToSignin(); | 1071 RedirectToSignin(); |
1069 std::string unused_value; | 1072 std::string unused_value; |
1070 if (net::GetValueForKeyInQuery(url, "ntp", &unused_value)) { | 1073 if (net::GetValueForKeyInQuery(url, "ntp", &unused_value)) { |
1071 SyncPromoUI::SetUserSkippedSyncPromo(profile); | 1074 SyncPromoUI::SetUserSkippedSyncPromo(profile); |
1072 RemoveCurrentHistoryItem(contents); | |
1073 RedirectToNtpOrAppsPage(); | 1075 RedirectToNtpOrAppsPage(); |
1074 } | 1076 } |
1075 | 1077 |
1076 if (!continue_url_match && !IsValidGaiaSigninRedirectOrResponseURL(url) && | 1078 if (!continue_url_match && !IsValidGaiaSigninRedirectOrResponseURL(url) && |
1077 ++untrusted_navigations_since_signin_visit_ > kMaxNavigationsSince) { | 1079 ++untrusted_navigations_since_signin_visit_ > kMaxNavigationsSince) { |
1078 CleanTransientState(); | 1080 CleanTransientState(); |
1079 } | 1081 } |
1080 | 1082 |
1081 return; | 1083 return; |
1082 } | 1084 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 if (sync_service) | 1224 if (sync_service) |
1223 sync_service->AddObserver(this); | 1225 sync_service->AddObserver(this); |
1224 } | 1226 } |
1225 | 1227 |
1226 // If this explicit sign in is not from settings page/webstore, show the | 1228 // If this explicit sign in is not from settings page/webstore, show the |
1227 // NTP/Apps page after sign in completes. In the case of the settings | 1229 // NTP/Apps page after sign in completes. In the case of the settings |
1228 // page, it will get closed by SyncSetupHandler. In the case of webstore, | 1230 // page, it will get closed by SyncSetupHandler. In the case of webstore, |
1229 // it will redirect back to webstore. | 1231 // it will redirect back to webstore. |
1230 if (source_ != SyncPromoUI::SOURCE_SETTINGS && | 1232 if (source_ != SyncPromoUI::SOURCE_SETTINGS && |
1231 source_ != SyncPromoUI::SOURCE_WEBSTORE_INSTALL) { | 1233 source_ != SyncPromoUI::SOURCE_WEBSTORE_INSTALL) { |
1232 RemoveCurrentHistoryItem(contents); | |
1233 RedirectToNtpOrAppsPage(); | 1234 RedirectToNtpOrAppsPage(); |
1234 } | 1235 } |
1235 break; | 1236 break; |
1236 } | 1237 } |
1237 case AUTO_ACCEPT_REJECTED_FOR_PROFILE: | 1238 case AUTO_ACCEPT_REJECTED_FOR_PROFILE: |
1238 AddEmailToOneClickRejectedList(profile, email_); | 1239 AddEmailToOneClickRejectedList(profile, email_); |
1239 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_REJECTED); | 1240 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_REJECTED); |
1240 break; | 1241 break; |
1241 default: | 1242 default: |
1242 NOTREACHED() << "Invalid auto_accept=" << auto_accept_; | 1243 NOTREACHED() << "Invalid auto_accept=" << auto_accept_; |
(...skipping 23 matching lines...) Expand all Loading... |
1266 contents->GetController().LoadURL(redirect_url_, | 1267 contents->GetController().LoadURL(redirect_url_, |
1267 content::Referrer(), | 1268 content::Referrer(), |
1268 content::PAGE_TRANSITION_AUTO_TOPLEVEL, | 1269 content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
1269 std::string()); | 1270 std::string()); |
1270 } | 1271 } |
1271 | 1272 |
1272 // Clear the redirect URL. | 1273 // Clear the redirect URL. |
1273 redirect_url_ = GURL(); | 1274 redirect_url_ = GURL(); |
1274 sync_service->RemoveObserver(this); | 1275 sync_service->RemoveObserver(this); |
1275 } | 1276 } |
OLD | NEW |