Chromium Code Reviews| 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 12 matching lines...) Expand all Loading... | |
| 23 #include "base/values.h" | 23 #include "base/values.h" |
| 24 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
| 25 #include "chrome/browser/defaults.h" | 25 #include "chrome/browser/defaults.h" |
| 26 #include "chrome/browser/google/google_util.h" | 26 #include "chrome/browser/google/google_util.h" |
| 27 #include "chrome/browser/infobars/infobar_service.h" | 27 #include "chrome/browser/infobars/infobar_service.h" |
| 28 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 28 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/browser/profiles/profile_info_cache.h" | 30 #include "chrome/browser/profiles/profile_info_cache.h" |
| 31 #include "chrome/browser/profiles/profile_io_data.h" | 31 #include "chrome/browser/profiles/profile_io_data.h" |
| 32 #include "chrome/browser/profiles/profile_manager.h" | 32 #include "chrome/browser/profiles/profile_manager.h" |
| 33 #include "chrome/browser/search/search.h" | |
| 33 #include "chrome/browser/signin/signin_manager.h" | 34 #include "chrome/browser/signin/signin_manager.h" |
| 34 #include "chrome/browser/signin/signin_manager_factory.h" | 35 #include "chrome/browser/signin/signin_manager_factory.h" |
| 35 #include "chrome/browser/signin/signin_names_io_thread.h" | 36 #include "chrome/browser/signin/signin_names_io_thread.h" |
| 36 #include "chrome/browser/sync/profile_sync_service.h" | 37 #include "chrome/browser/sync/profile_sync_service.h" |
| 37 #include "chrome/browser/sync/profile_sync_service_factory.h" | 38 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 38 #include "chrome/browser/sync/sync_prefs.h" | 39 #include "chrome/browser/sync/sync_prefs.h" |
| 39 #include "chrome/browser/tab_contents/tab_util.h" | 40 #include "chrome/browser/tab_contents/tab_util.h" |
| 40 #include "chrome/browser/ui/browser_finder.h" | 41 #include "chrome/browser/ui/browser_finder.h" |
| 41 #include "chrome/browser/ui/browser_window.h" | 42 #include "chrome/browser/ui/browser_window.h" |
| 42 #include "chrome/browser/ui/chrome_pages.h" | 43 #include "chrome/browser/ui/chrome_pages.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 one_click_signin::HISTOGRAM_MAX); | 116 one_click_signin::HISTOGRAM_MAX); |
| 116 break; | 117 break; |
| 117 case SyncPromoUI::SOURCE_WEBSTORE_INSTALL: | 118 case SyncPromoUI::SOURCE_WEBSTORE_INSTALL: |
| 118 UMA_HISTOGRAM_ENUMERATION("Signin.WebstoreInstallActions", action, | 119 UMA_HISTOGRAM_ENUMERATION("Signin.WebstoreInstallActions", action, |
| 119 one_click_signin::HISTOGRAM_MAX); | 120 one_click_signin::HISTOGRAM_MAX); |
| 120 break; | 121 break; |
| 121 case SyncPromoUI::SOURCE_APP_LAUNCHER: | 122 case SyncPromoUI::SOURCE_APP_LAUNCHER: |
| 122 UMA_HISTOGRAM_ENUMERATION("Signin.AppLauncherActions", action, | 123 UMA_HISTOGRAM_ENUMERATION("Signin.AppLauncherActions", action, |
| 123 one_click_signin::HISTOGRAM_MAX); | 124 one_click_signin::HISTOGRAM_MAX); |
| 124 break; | 125 break; |
| 126 case SyncPromoUI::SOURCE_APPS_PAGE_LINK: | |
| 127 UMA_HISTOGRAM_ENUMERATION("Signin.AppsPageLinkActions", action, | |
| 128 one_click_signin::HISTOGRAM_MAX); | |
| 129 break; | |
| 125 default: | 130 default: |
| 126 NOTREACHED() << "Invalid Source"; | 131 NOTREACHED() << "Invalid Source"; |
| 127 return; | 132 return; |
| 128 } | 133 } |
| 129 UMA_HISTOGRAM_ENUMERATION("Signin.AllAccessPointActions", action, | 134 UMA_HISTOGRAM_ENUMERATION("Signin.AllAccessPointActions", action, |
| 130 one_click_signin::HISTOGRAM_MAX); | 135 one_click_signin::HISTOGRAM_MAX); |
| 131 } | 136 } |
| 132 | 137 |
| 133 void LogOneClickHistogramValue(int action) { | 138 void LogOneClickHistogramValue(int action) { |
| 134 UMA_HISTOGRAM_ENUMERATION("Signin.OneClickActions", action, | 139 UMA_HISTOGRAM_ENUMERATION("Signin.OneClickActions", action, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 } | 221 } |
| 217 } | 222 } |
| 218 | 223 |
| 219 void ClearPendingEmailOnIOThread(content::ResourceContext* context) { | 224 void ClearPendingEmailOnIOThread(content::ResourceContext* context) { |
| 220 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 225 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
| 221 DCHECK(io_data); | 226 DCHECK(io_data); |
| 222 io_data->set_reverse_autologin_pending_email(std::string()); | 227 io_data->set_reverse_autologin_pending_email(std::string()); |
| 223 } | 228 } |
| 224 | 229 |
| 225 // Determines the source of the sign in and the continue URL. Its either one | 230 // Determines the source of the sign in and the continue URL. Its either one |
| 226 // of the known sign in access point (first run, NTP, menu, settings) or its | 231 // of the known sign in access point (first run, NTP, Apps page, menu, settings) |
| 227 // an implicit sign in via another Google property. In the former case, | 232 // or its an implicit sign in via another Google property. In the former case, |
| 228 // "service" is also checked to make sure its "chromiumsync". | 233 // "service" is also checked to make sure its "chromiumsync". |
| 229 SyncPromoUI::Source GetSigninSource(const GURL& url, GURL* continue_url) { | 234 SyncPromoUI::Source GetSigninSource(const GURL& url, GURL* continue_url) { |
| 230 std::string value; | 235 std::string value; |
| 231 net::GetValueForKeyInQuery(url, "service", &value); | 236 net::GetValueForKeyInQuery(url, "service", &value); |
| 232 bool possibly_an_explicit_signin = value == "chromiumsync"; | 237 bool possibly_an_explicit_signin = value == "chromiumsync"; |
| 233 | 238 |
| 234 // Find the final continue URL for this sign in. In some cases, Gaia can | 239 // Find the final continue URL for this sign in. In some cases, Gaia can |
| 235 // continue to itself, with the original continue URL buried under a couple | 240 // continue to itself, with the original continue URL buried under a couple |
| 236 // of layers of indirection. Peel those layers away. The final destination | 241 // of layers of indirection. Peel those layers away. The final destination |
| 237 // can also be "IsGaiaSignonRealm" so stop if we get to the end (but be sure | 242 // can also be "IsGaiaSignonRealm" so stop if we get to the end (but be sure |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 858 const std::string& token = tokens[i]; | 863 const std::string& token = tokens[i]; |
| 859 if (token == "accepted") { | 864 if (token == "accepted") { |
| 860 auto_accept = AUTO_ACCEPT_ACCEPTED; | 865 auto_accept = AUTO_ACCEPT_ACCEPTED; |
| 861 } else if (token == "configure") { | 866 } else if (token == "configure") { |
| 862 auto_accept = AUTO_ACCEPT_CONFIGURE; | 867 auto_accept = AUTO_ACCEPT_CONFIGURE; |
| 863 } else if (token == "rejected-for-profile") { | 868 } else if (token == "rejected-for-profile") { |
| 864 auto_accept = AUTO_ACCEPT_REJECTED_FOR_PROFILE; | 869 auto_accept = AUTO_ACCEPT_REJECTED_FOR_PROFILE; |
| 865 } | 870 } |
| 866 } | 871 } |
| 867 | 872 |
| 868 // If this is an explicit sign in (i.e., first run, NTP, menu,settings) | 873 // If this is an explicit sign in (i.e., first run, NTP, Apps page, menu, |
| 869 // then force the auto accept type to explicit. | 874 // settings) then force the auto accept type to explicit. |
| 870 source = GetSigninSource(request->url(), &continue_url); | 875 source = GetSigninSource(request->url(), &continue_url); |
| 871 if (source != SyncPromoUI::SOURCE_UNKNOWN) | 876 if (source != SyncPromoUI::SOURCE_UNKNOWN) |
| 872 auto_accept = AUTO_ACCEPT_EXPLICIT; | 877 auto_accept = AUTO_ACCEPT_EXPLICIT; |
| 873 } | 878 } |
| 874 | 879 |
| 875 if (auto_accept != AUTO_ACCEPT_NONE) { | 880 if (auto_accept != AUTO_ACCEPT_NONE) { |
| 876 VLOG(1) << "OneClickSigninHelper::ShowInfoBarIfPossible:" | 881 VLOG(1) << "OneClickSigninHelper::ShowInfoBarIfPossible:" |
| 877 << " auto_accept=" << auto_accept; | 882 << " auto_accept=" << auto_accept; |
| 878 } | 883 } |
| 879 | 884 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 948 if (!session_index.empty()) | 953 if (!session_index.empty()) |
| 949 helper->session_index_ = session_index; | 954 helper->session_index_ = session_index; |
| 950 | 955 |
| 951 if (!email.empty()) | 956 if (!email.empty()) |
| 952 helper->email_ = email; | 957 helper->email_ = email; |
| 953 | 958 |
| 954 if (continue_url.is_valid()) | 959 if (continue_url.is_valid()) |
| 955 helper->continue_url_ = continue_url; | 960 helper->continue_url_ = continue_url; |
| 956 } | 961 } |
| 957 | 962 |
| 958 void OneClickSigninHelper::RedirectToNTP(bool show_bubble) { | 963 void OneClickSigninHelper::RedirectToAppsPage(bool show_bubble) { |
| 959 VLOG(1) << "OneClickSigninHelper::RedirectToNTP"; | 964 VLOG(1) << "OneClickSigninHelper::RedirectToAppsPage"; |
|
Roger Tawa OOO till Jul 10th
2013/03/22 14:23:23
Please rename to RedirectToNtpOrAppsPage
kmadhusu
2013/03/22 15:03:09
Done.
| |
| 960 | 965 |
| 961 // Redirect to NTP with sign in bubble visible. | 966 // Redirect to NTP/Apps page with sign in bubble visible. |
| 962 content::WebContents* contents = web_contents(); | 967 content::WebContents* contents = web_contents(); |
| 963 Profile* profile = | 968 Profile* profile = |
| 964 Profile::FromBrowserContext(contents->GetBrowserContext()); | 969 Profile::FromBrowserContext(contents->GetBrowserContext()); |
| 965 PrefService* pref_service = profile->GetPrefs(); | 970 PrefService* pref_service = profile->GetPrefs(); |
| 966 if (show_bubble) { | 971 if (show_bubble) { |
| 967 pref_service->SetBoolean(prefs::kSyncPromoShowNTPBubble, true); | 972 pref_service->SetBoolean(prefs::kSyncPromoShowNTPBubble, true); |
| 968 pref_service->SetString(prefs::kSyncPromoErrorMessage, error_message_); | 973 pref_service->SetString(prefs::kSyncPromoErrorMessage, error_message_); |
| 969 } | 974 } |
| 970 | 975 |
| 971 content::OpenURLParams params( | 976 GURL url(chrome::kChromeUINewTabURL); |
| 972 GURL(chrome::kChromeUINewTabURL), | 977 if ((source_ == SyncPromoUI::SOURCE_APPS_PAGE_LINK) || |
| 973 content::Referrer(), | 978 (source_ == SyncPromoUI::SOURCE_MENU && |
|
Roger Tawa OOO till Jul 10th
2013/03/22 14:23:23
Why does the menu redirect to the apps page?
kmadhusu
2013/03/22 15:03:09
If there is an error during "signing to chrome" fr
Roger Tawa OOO till Jul 10th
2013/03/22 20:44:01
if that is the case with instant extended, then I'
kmadhusu
2013/03/22 21:29:06
Done.
| |
| 974 CURRENT_TAB, | 979 chrome::search::IsInstantExtendedAPIEnabled())) { |
| 975 content::PAGE_TRANSITION_AUTO_TOPLEVEL, | 980 // Navigate to Apps page. |
| 976 false); | 981 url = GURL(chrome::kChromeUIAppsURL); |
| 982 } | |
| 983 content::OpenURLParams params(url, | |
| 984 content::Referrer(), | |
| 985 CURRENT_TAB, | |
| 986 content::PAGE_TRANSITION_AUTO_TOPLEVEL, | |
| 987 false); | |
| 977 contents->OpenURL(params); | 988 contents->OpenURL(params); |
| 978 | 989 |
| 979 error_message_.clear(); | 990 error_message_.clear(); |
| 980 } | 991 } |
| 981 | 992 |
| 982 void OneClickSigninHelper::RedirectToSignin() { | 993 void OneClickSigninHelper::RedirectToSignin() { |
| 983 VLOG(1) << "OneClickSigninHelper::RedirectToSignin"; | 994 VLOG(1) << "OneClickSigninHelper::RedirectToSignin"; |
| 984 | 995 |
| 985 // Extract the existing sounce=X value. Default to "2" if missing. | 996 // Extract the existing sounce=X value. Default to "2" if missing. |
| 986 SyncPromoUI::Source source = | 997 SyncPromoUI::Source source = |
| 987 SyncPromoUI::GetSourceForSyncPromoURL(continue_url_); | 998 SyncPromoUI::GetSourceForSyncPromoURL(continue_url_); |
| 988 if (source == SyncPromoUI::SOURCE_UNKNOWN) | 999 if (source == SyncPromoUI::SOURCE_UNKNOWN) |
| 989 source = SyncPromoUI::SOURCE_MENU; | 1000 source = SyncPromoUI::SOURCE_MENU; |
| 990 GURL page = SyncPromoUI::GetSyncPromoURL(GURL(), source, false); | 1001 GURL page = SyncPromoUI::GetSyncPromoURL(GURL(), source, false); |
| 991 | 1002 |
| 992 content::WebContents* contents = web_contents(); | 1003 content::WebContents* contents = web_contents(); |
| 993 contents->GetController().LoadURL(page, | 1004 contents->GetController().LoadURL(page, |
| 994 content::Referrer(), | 1005 content::Referrer(), |
| 995 content::PAGE_TRANSITION_AUTO_TOPLEVEL, | 1006 content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
| 996 std::string()); | 1007 std::string()); |
| 997 } | 1008 } |
| 998 | 1009 |
| 999 void OneClickSigninHelper::CleanTransientState() { | 1010 void OneClickSigninHelper::CleanTransientState() { |
| 1000 VLOG(1) << "OneClickSigninHelper::CleanTransientState"; | 1011 VLOG(1) << "OneClickSigninHelper::CleanTransientState"; |
| 1001 showing_signin_ = false; | 1012 showing_signin_ = false; |
| 1002 email_.clear(); | 1013 email_.clear(); |
| 1003 password_.clear(); | 1014 password_.clear(); |
| 1004 auto_accept_ = AUTO_ACCEPT_NONE; | 1015 auto_accept_ = AUTO_ACCEPT_NONE; |
| 1005 source_ = SyncPromoUI::SOURCE_UNKNOWN; | |
|
Roger Tawa OOO till Jul 10th
2013/03/22 14:23:23
This method is meant to reset the state of OneClic
kmadhusu
2013/03/22 15:03:09
OneClickSigninHelper::SigninSuccess() is called wh
Roger Tawa OOO till Jul 10th
2013/03/22 20:44:01
Once you fix RedirectToNtpOrAppsPage() to no longe
kmadhusu
2013/03/22 21:29:06
Done.
| |
| 1006 switched_to_advanced_ = false; | 1016 switched_to_advanced_ = false; |
| 1007 original_source_ = SyncPromoUI::SOURCE_UNKNOWN; | 1017 original_source_ = SyncPromoUI::SOURCE_UNKNOWN; |
| 1008 continue_url_ = GURL(); | 1018 continue_url_ = GURL(); |
| 1009 | 1019 |
| 1010 // Post to IO thread to clear pending email. | 1020 // Post to IO thread to clear pending email. |
| 1011 Profile* profile = | 1021 Profile* profile = |
| 1012 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 1022 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| 1013 content::BrowserThread::PostTask( | 1023 content::BrowserThread::PostTask( |
| 1014 content::BrowserThread::IO, FROM_HERE, | 1024 content::BrowserThread::IO, FROM_HERE, |
| 1015 base::Bind(&ClearPendingEmailOnIOThread, | 1025 base::Bind(&ClearPendingEmailOnIOThread, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1049 const GURL url = contents->GetURL(); | 1059 const GURL url = contents->GetURL(); |
| 1050 Profile* profile = | 1060 Profile* profile = |
| 1051 Profile::FromBrowserContext(contents->GetBrowserContext()); | 1061 Profile::FromBrowserContext(contents->GetBrowserContext()); |
| 1052 VLOG(1) << "OneClickSigninHelper::DidStopLoading: url=" << url.spec(); | 1062 VLOG(1) << "OneClickSigninHelper::DidStopLoading: url=" << url.spec(); |
| 1053 | 1063 |
| 1054 // If an error has already occured during the sign in flow, make sure to | 1064 // If an error has already occured during the sign in flow, make sure to |
| 1055 // display it to the user and abort the process. Do this only for | 1065 // display it to the user and abort the process. Do this only for |
| 1056 // explicit sign ins. | 1066 // explicit sign ins. |
| 1057 if (!error_message_.empty() && auto_accept_ == AUTO_ACCEPT_EXPLICIT) { | 1067 if (!error_message_.empty() && auto_accept_ == AUTO_ACCEPT_EXPLICIT) { |
| 1058 VLOG(1) << "OneClickSigninHelper::DidStopLoading: error=" << error_message_; | 1068 VLOG(1) << "OneClickSigninHelper::DidStopLoading: error=" << error_message_; |
| 1059 RedirectToNTP(true); | 1069 RedirectToAppsPage(true); |
| 1060 return; | 1070 return; |
| 1061 } | 1071 } |
| 1062 | 1072 |
| 1063 if (AreWeShowingSignin(url, source_, email_)) { | 1073 if (AreWeShowingSignin(url, source_, email_)) { |
| 1064 if (!showing_signin_) { | 1074 if (!showing_signin_) { |
| 1065 if (source_ == SyncPromoUI::SOURCE_UNKNOWN) | 1075 if (source_ == SyncPromoUI::SOURCE_UNKNOWN) |
| 1066 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_SHOWN); | 1076 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_SHOWN); |
| 1067 else | 1077 else |
| 1068 LogHistogramValue(source_, one_click_signin::HISTOGRAM_SHOWN); | 1078 LogHistogramValue(source_, one_click_signin::HISTOGRAM_SHOWN); |
| 1069 } | 1079 } |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1081 continue_url_.ReplaceComponents(replacements)); | 1091 continue_url_.ReplaceComponents(replacements)); |
| 1082 | 1092 |
| 1083 // If there is no valid email or password yet, there is nothing to do. | 1093 // If there is no valid email or password yet, there is nothing to do. |
| 1084 if (email_.empty() || password_.empty()) { | 1094 if (email_.empty() || password_.empty()) { |
| 1085 VLOG(1) << "OneClickSigninHelper::DidStopLoading: nothing to do"; | 1095 VLOG(1) << "OneClickSigninHelper::DidStopLoading: nothing to do"; |
| 1086 if (continue_url_match && auto_accept_ == AUTO_ACCEPT_EXPLICIT) | 1096 if (continue_url_match && auto_accept_ == AUTO_ACCEPT_EXPLICIT) |
| 1087 RedirectToSignin(); | 1097 RedirectToSignin(); |
| 1088 std::string unused_value; | 1098 std::string unused_value; |
| 1089 if (net::GetValueForKeyInQuery(url, "ntp", &unused_value)) { | 1099 if (net::GetValueForKeyInQuery(url, "ntp", &unused_value)) { |
| 1090 SyncPromoUI::SetUserSkippedSyncPromo(profile); | 1100 SyncPromoUI::SetUserSkippedSyncPromo(profile); |
| 1091 RedirectToNTP(false); | 1101 RedirectToAppsPage(false); |
| 1092 } | 1102 } |
| 1093 return; | 1103 return; |
| 1094 } | 1104 } |
| 1095 | 1105 |
| 1096 // When the user uses the first-run, ntp, or hotdog menu to sign in, then have | 1106 // When the user uses the first-run, ntp, or hotdog menu to sign in, then have |
| 1097 // the option of checking the the box "Let me choose what to sync". When the | 1107 // the option of checking the the box "Let me choose what to sync". When the |
| 1098 // sign in process started, the source parameter in the continue URL may have | 1108 // sign in process started, the source parameter in the continue URL may have |
| 1099 // indicated one of the three options above. However, once this box is | 1109 // indicated one of the three options above. However, once this box is |
| 1100 // checked, the source parameter will indicate settings. This will only be | 1110 // checked, the source parameter will indicate settings. This will only be |
| 1101 // communicated back to chrome when Gaia redirects to the continue URL, and | 1111 // communicated back to chrome when Gaia redirects to the continue URL, and |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1115 // If this is not an explicit sign in, we don't need to check if we landed | 1125 // If this is not an explicit sign in, we don't need to check if we landed |
| 1116 // on the right continue URL. This is important because the continue URL | 1126 // on the right continue URL. This is important because the continue URL |
| 1117 // may itself lead to a redirect, which means this function will never see | 1127 // may itself lead to a redirect, which means this function will never see |
| 1118 // the continue URL go by. | 1128 // the continue URL go by. |
| 1119 if (auto_accept_ == AUTO_ACCEPT_EXPLICIT) { | 1129 if (auto_accept_ == AUTO_ACCEPT_EXPLICIT) { |
| 1120 DCHECK(source_ != SyncPromoUI::SOURCE_UNKNOWN); | 1130 DCHECK(source_ != SyncPromoUI::SOURCE_UNKNOWN); |
| 1121 if (!continue_url_match) { | 1131 if (!continue_url_match) { |
| 1122 VLOG(1) << "OneClickSigninHelper::DidStopLoading: invalid url='" | 1132 VLOG(1) << "OneClickSigninHelper::DidStopLoading: invalid url='" |
| 1123 << url.spec() | 1133 << url.spec() |
| 1124 << "' expected continue url=" << continue_url_; | 1134 << "' expected continue url=" << continue_url_; |
| 1135 source_ = SyncPromoUI::SOURCE_UNKNOWN; | |
| 1125 CleanTransientState(); | 1136 CleanTransientState(); |
| 1126 return; | 1137 return; |
| 1127 } | 1138 } |
| 1128 | 1139 |
| 1129 // In explicit sign ins, the user may have changed the box | 1140 // In explicit sign ins, the user may have changed the box |
| 1130 // "Let me choose what to sync". This is reflected as a change in the | 1141 // "Let me choose what to sync". This is reflected as a change in the |
| 1131 // source of the continue URL. Make one last check of the current URL | 1142 // source of the continue URL. Make one last check of the current URL |
| 1132 // to see if there is a valid source. If so, it overrides the | 1143 // to see if there is a valid source. If so, it overrides the |
| 1133 // current source. | 1144 // current source. |
| 1134 // | 1145 // |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1233 SyncPromoUI::GetSourceForSyncPromoURL(continue_url_) == | 1244 SyncPromoUI::GetSourceForSyncPromoURL(continue_url_) == |
| 1234 SyncPromoUI::SOURCE_WEBSTORE_INSTALL) { | 1245 SyncPromoUI::SOURCE_WEBSTORE_INSTALL) { |
| 1235 redirect_url_ = continue_url_; | 1246 redirect_url_ = continue_url_; |
| 1236 ProfileSyncService* sync_service = | 1247 ProfileSyncService* sync_service = |
| 1237 ProfileSyncServiceFactory::GetForProfile(profile); | 1248 ProfileSyncServiceFactory::GetForProfile(profile); |
| 1238 if (sync_service) | 1249 if (sync_service) |
| 1239 sync_service->AddObserver(this); | 1250 sync_service->AddObserver(this); |
| 1240 } | 1251 } |
| 1241 | 1252 |
| 1242 // If this explicit sign in is not from settings page/webstore, show the | 1253 // If this explicit sign in is not from settings page/webstore, show the |
| 1243 // NTP after sign in completes. In the case of the settings page, it will | 1254 // NTP/Apps page after sign in completes. In the case of the settings |
| 1244 // get closed by SyncSetupHandler. In the case of webstore, it will | 1255 // page, it will get closed by SyncSetupHandler. In the case of webstore, |
| 1245 // redirect back to webstore. | 1256 // it will redirect back to webstore. |
| 1246 if (source_ != SyncPromoUI::SOURCE_SETTINGS && | 1257 if (source_ != SyncPromoUI::SOURCE_SETTINGS && |
| 1247 source_ != SyncPromoUI::SOURCE_WEBSTORE_INSTALL) { | 1258 source_ != SyncPromoUI::SOURCE_WEBSTORE_INSTALL) { |
| 1248 signin_tracker_.reset(new SigninTracker(profile, this)); | 1259 signin_tracker_.reset(new SigninTracker(profile, this)); |
| 1249 // Show the NTP, but don't show the signed-in bubble yet. | 1260 RedirectToAppsPage(false); |
| 1250 RedirectToNTP(false); | |
| 1251 } | 1261 } |
| 1252 break; | 1262 break; |
| 1253 } | 1263 } |
| 1254 case AUTO_ACCEPT_REJECTED_FOR_PROFILE: | 1264 case AUTO_ACCEPT_REJECTED_FOR_PROFILE: |
| 1255 AddEmailToOneClickRejectedList(profile, email_); | 1265 AddEmailToOneClickRejectedList(profile, email_); |
| 1256 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_REJECTED); | 1266 LogOneClickHistogramValue(one_click_signin::HISTOGRAM_REJECTED); |
| 1257 break; | 1267 break; |
| 1258 default: | 1268 default: |
| 1259 NOTREACHED() << "Invalid auto_accept=" << auto_accept_; | 1269 NOTREACHED() << "Invalid auto_accept=" << auto_accept_; |
| 1260 break; | 1270 break; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1304 error_message_.clear(); | 1314 error_message_.clear(); |
| 1305 break; | 1315 break; |
| 1306 case GoogleServiceAuthError::SERVICE_UNAVAILABLE: | 1316 case GoogleServiceAuthError::SERVICE_UNAVAILABLE: |
| 1307 error_message_ = l10n_util::GetStringUTF8(IDS_SYNC_UNRECOVERABLE_ERROR); | 1317 error_message_ = l10n_util::GetStringUTF8(IDS_SYNC_UNRECOVERABLE_ERROR); |
| 1308 break; | 1318 break; |
| 1309 default: | 1319 default: |
| 1310 error_message_ = l10n_util::GetStringUTF8(IDS_SYNC_ERROR_SIGNING_IN); | 1320 error_message_ = l10n_util::GetStringUTF8(IDS_SYNC_ERROR_SIGNING_IN); |
| 1311 break; | 1321 break; |
| 1312 } | 1322 } |
| 1313 } | 1323 } |
| 1314 | 1324 RedirectOnSigninComplete(); |
| 1315 RedirectToNTP(true); | |
| 1316 signin_tracker_.reset(); | |
| 1317 } | 1325 } |
| 1318 | 1326 |
| 1319 void OneClickSigninHelper::SigninSuccess() { | 1327 void OneClickSigninHelper::SigninSuccess() { |
| 1320 // Signed in now, so show the signed-in bubble. | 1328 RedirectOnSigninComplete(); |
| 1321 RedirectToNTP(true); | 1329 } |
| 1330 | |
| 1331 void OneClickSigninHelper::RedirectOnSigninComplete() { | |
| 1332 // Show the result in the sign-in bubble. | |
| 1333 RedirectToAppsPage(true); | |
| 1322 signin_tracker_.reset(); | 1334 signin_tracker_.reset(); |
| 1335 source_ = SyncPromoUI::SOURCE_UNKNOWN; | |
| 1323 } | 1336 } |
| OLD | NEW |