OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/signin/signin_promo.h" | 5 #include "chrome/browser/signin/signin_promo.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 base::StringAppendF(&url, "&%s=1", kSignInPromoQueryKeyAutoClose); | 188 base::StringAppendF(&url, "&%s=1", kSignInPromoQueryKeyAutoClose); |
189 if (is_constrained) | 189 if (is_constrained) |
190 base::StringAppendF(&url, "&%s=1", kSignInPromoQueryKeyConstrained); | 190 base::StringAppendF(&url, "&%s=1", kSignInPromoQueryKeyConstrained); |
191 return GURL(url); | 191 return GURL(url); |
192 } | 192 } |
193 | 193 |
194 GURL GetReauthURL(Profile* profile, const std::string& account_id) { | 194 GURL GetReauthURL(Profile* profile, const std::string& account_id) { |
195 AccountTrackerService::AccountInfo info = | 195 AccountTrackerService::AccountInfo info = |
196 AccountTrackerServiceFactory::GetForProfile(profile)-> | 196 AccountTrackerServiceFactory::GetForProfile(profile)-> |
197 GetAccountInfo(account_id); | 197 GetAccountInfo(account_id); |
| 198 return GetReauthURLWithEmail(info.email); |
| 199 } |
198 | 200 |
| 201 GURL GetReauthURLWithEmail(const std::string& email) { |
199 signin_metrics::Source source = switches::IsNewAvatarMenu() ? | 202 signin_metrics::Source source = switches::IsNewAvatarMenu() ? |
200 signin_metrics::SOURCE_REAUTH : signin_metrics::SOURCE_SETTINGS; | 203 signin_metrics::SOURCE_REAUTH : signin_metrics::SOURCE_SETTINGS; |
201 | 204 |
202 GURL url = signin::GetPromoURL( | 205 GURL url = signin::GetPromoURL( |
203 source, true /* auto_close */, | 206 source, true /* auto_close */, |
204 switches::IsNewAvatarMenu() /* is_constrained */); | 207 switches::IsNewAvatarMenu() /* is_constrained */); |
205 url = net::AppendQueryParameter(url, "email", info.email); | 208 |
| 209 url = net::AppendQueryParameter(url, "email", email); |
206 url = net::AppendQueryParameter(url, "validateEmail", "1"); | 210 url = net::AppendQueryParameter(url, "validateEmail", "1"); |
207 return net::AppendQueryParameter(url, "readOnlyEmail", "1"); | 211 return net::AppendQueryParameter(url, "readOnlyEmail", "1"); |
208 } | 212 } |
209 | 213 |
210 GURL GetNextPageURLForPromoURL(const GURL& url) { | 214 GURL GetNextPageURLForPromoURL(const GURL& url) { |
211 std::string value; | 215 std::string value; |
212 if (net::GetValueForKeyInQuery(url, kSignInPromoQueryKeyContinue, &value)) { | 216 if (net::GetValueForKeyInQuery(url, kSignInPromoQueryKeyContinue, &value)) { |
213 GURL continue_url = GURL(value); | 217 GURL continue_url = GURL(value); |
214 if (continue_url.is_valid()) | 218 if (continue_url.is_valid()) |
215 return continue_url; | 219 return continue_url; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 266 |
263 void RegisterProfilePrefs( | 267 void RegisterProfilePrefs( |
264 user_prefs::PrefRegistrySyncable* registry) { | 268 user_prefs::PrefRegistrySyncable* registry) { |
265 registry->RegisterIntegerPref(prefs::kSignInPromoStartupCount, 0); | 269 registry->RegisterIntegerPref(prefs::kSignInPromoStartupCount, 0); |
266 registry->RegisterBooleanPref(prefs::kSignInPromoUserSkipped, false); | 270 registry->RegisterBooleanPref(prefs::kSignInPromoUserSkipped, false); |
267 registry->RegisterBooleanPref(prefs::kSignInPromoShowOnFirstRunAllowed, true); | 271 registry->RegisterBooleanPref(prefs::kSignInPromoShowOnFirstRunAllowed, true); |
268 registry->RegisterBooleanPref(prefs::kSignInPromoShowNTPBubble, false); | 272 registry->RegisterBooleanPref(prefs::kSignInPromoShowNTPBubble, false); |
269 } | 273 } |
270 | 274 |
271 } // namespace signin | 275 } // namespace signin |
OLD | NEW |