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 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 PrefService* pref_service = profile->GetPrefs(); | 879 PrefService* pref_service = profile->GetPrefs(); |
880 pref_service->SetBoolean(prefs::kSyncPromoShowNTPBubble, true); | 880 pref_service->SetBoolean(prefs::kSyncPromoShowNTPBubble, true); |
881 pref_service->SetString(prefs::kSyncPromoErrorMessage, error_message_); | 881 pref_service->SetString(prefs::kSyncPromoErrorMessage, error_message_); |
882 | 882 |
883 contents->GetController().LoadURL(GURL(chrome::kChromeUINewTabURL), | 883 contents->GetController().LoadURL(GURL(chrome::kChromeUINewTabURL), |
884 content::Referrer(), | 884 content::Referrer(), |
885 content::PAGE_TRANSITION_AUTO_TOPLEVEL, | 885 content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
886 std::string()); | 886 std::string()); |
887 | 887 |
888 error_message_.clear(); | 888 error_message_.clear(); |
889 signin_tracker_.reset(); | |
890 } | 889 } |
891 | 890 |
892 void OneClickSigninHelper::CleanTransientState() { | 891 void OneClickSigninHelper::CleanTransientState() { |
893 VLOG(1) << "OneClickSigninHelper::CleanTransientState"; | 892 VLOG(1) << "OneClickSigninHelper::CleanTransientState"; |
894 email_.clear(); | 893 email_.clear(); |
895 password_.clear(); | 894 password_.clear(); |
896 auto_accept_ = AUTO_ACCEPT_NONE; | 895 auto_accept_ = AUTO_ACCEPT_NONE; |
897 source_ = SyncPromoUI::SOURCE_UNKNOWN; | 896 source_ = SyncPromoUI::SOURCE_UNKNOWN; |
898 continue_url_ = GURL(); | 897 continue_url_ = GURL(); |
899 | 898 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 sync_service->AddObserver(this); | 1094 sync_service->AddObserver(this); |
1096 } | 1095 } |
1097 | 1096 |
1098 // If this explicit sign in is not from settings page/webstore, show the | 1097 // If this explicit sign in is not from settings page/webstore, show the |
1099 // NTP after sign in completes. In the case of the settings page, it will | 1098 // NTP after sign in completes. In the case of the settings page, it will |
1100 // get closed by SyncSetupHandler. In the case of webstore, it will | 1099 // get closed by SyncSetupHandler. In the case of webstore, it will |
1101 // redirect back to webstore. | 1100 // redirect back to webstore. |
1102 if (source_ != SyncPromoUI::SOURCE_SETTINGS && | 1101 if (source_ != SyncPromoUI::SOURCE_SETTINGS && |
1103 source_ != SyncPromoUI::SOURCE_WEBSTORE_INSTALL) { | 1102 source_ != SyncPromoUI::SOURCE_WEBSTORE_INSTALL) { |
1104 signin_tracker_.reset(new SigninTracker(profile, this)); | 1103 signin_tracker_.reset(new SigninTracker(profile, this)); |
| 1104 RedirectToNTP(); |
1105 } | 1105 } |
1106 break; | 1106 break; |
1107 } | 1107 } |
1108 case AUTO_ACCEPT_REJECTED_FOR_PROFILE: | 1108 case AUTO_ACCEPT_REJECTED_FOR_PROFILE: |
1109 AddEmailToOneClickRejectedList(profile, email_); | 1109 AddEmailToOneClickRejectedList(profile, email_); |
1110 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Reverse", | 1110 UMA_HISTOGRAM_ENUMERATION("AutoLogin.Reverse", |
1111 one_click_signin::HISTOGRAM_REJECTED, | 1111 one_click_signin::HISTOGRAM_REJECTED, |
1112 one_click_signin::HISTOGRAM_MAX); | 1112 one_click_signin::HISTOGRAM_MAX); |
1113 break; | 1113 break; |
1114 default: | 1114 default: |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 case GoogleServiceAuthError::SERVICE_UNAVAILABLE: | 1162 case GoogleServiceAuthError::SERVICE_UNAVAILABLE: |
1163 error_message_ = l10n_util::GetStringUTF8(IDS_SYNC_UNRECOVERABLE_ERROR); | 1163 error_message_ = l10n_util::GetStringUTF8(IDS_SYNC_UNRECOVERABLE_ERROR); |
1164 break; | 1164 break; |
1165 default: | 1165 default: |
1166 error_message_ = l10n_util::GetStringUTF8(IDS_SYNC_ERROR_SIGNING_IN); | 1166 error_message_ = l10n_util::GetStringUTF8(IDS_SYNC_ERROR_SIGNING_IN); |
1167 break; | 1167 break; |
1168 } | 1168 } |
1169 } | 1169 } |
1170 | 1170 |
1171 RedirectToNTP(); | 1171 RedirectToNTP(); |
| 1172 signin_tracker_.reset(); |
1172 } | 1173 } |
1173 | 1174 |
1174 void OneClickSigninHelper::SigninSuccess() { | 1175 void OneClickSigninHelper::SigninSuccess() { |
1175 RedirectToNTP(); | 1176 signin_tracker_.reset(); |
1176 } | 1177 } |
OLD | NEW |