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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 return GURL(url); | 190 return GURL(url); |
191 } | 191 } |
192 | 192 |
193 GURL GetReauthURL(Profile* profile, const std::string& account_id) { | 193 GURL GetReauthURL(Profile* profile, const std::string& account_id) { |
194 AccountInfo info = AccountTrackerServiceFactory::GetForProfile(profile) | 194 AccountInfo info = AccountTrackerServiceFactory::GetForProfile(profile) |
195 ->GetAccountInfo(account_id); | 195 ->GetAccountInfo(account_id); |
196 return GetReauthURLWithEmail(info.email); | 196 return GetReauthURLWithEmail(info.email); |
197 } | 197 } |
198 | 198 |
199 GURL GetReauthURLWithEmail(const std::string& email) { | 199 GURL GetReauthURLWithEmail(const std::string& email) { |
200 signin_metrics::Source source = switches::IsNewAvatarMenu() ? | |
201 signin_metrics::SOURCE_REAUTH : signin_metrics::SOURCE_SETTINGS; | |
202 | |
203 GURL url = signin::GetPromoURL( | 200 GURL url = signin::GetPromoURL( |
204 source, true /* auto_close */, | 201 signin_metrics::SOURCE_REAUTH, true /* auto_close */, |
205 switches::IsNewAvatarMenu() /* is_constrained */); | 202 true /* is_constrained */); |
206 | 203 |
207 url = net::AppendQueryParameter(url, "email", email); | 204 url = net::AppendQueryParameter(url, "email", email); |
208 url = net::AppendQueryParameter(url, "validateEmail", "1"); | 205 url = net::AppendQueryParameter(url, "validateEmail", "1"); |
209 return net::AppendQueryParameter(url, "readOnlyEmail", "1"); | 206 return net::AppendQueryParameter(url, "readOnlyEmail", "1"); |
210 } | 207 } |
211 | 208 |
212 GURL GetNextPageURLForPromoURL(const GURL& url) { | 209 GURL GetNextPageURLForPromoURL(const GURL& url) { |
213 std::string value; | 210 std::string value; |
214 if (net::GetValueForKeyInQuery(url, kSignInPromoQueryKeyContinue, &value)) { | 211 if (net::GetValueForKeyInQuery(url, kSignInPromoQueryKeyContinue, &value)) { |
215 GURL continue_url = GURL(value); | 212 GURL continue_url = GURL(value); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 261 |
265 void RegisterProfilePrefs( | 262 void RegisterProfilePrefs( |
266 user_prefs::PrefRegistrySyncable* registry) { | 263 user_prefs::PrefRegistrySyncable* registry) { |
267 registry->RegisterIntegerPref(prefs::kSignInPromoStartupCount, 0); | 264 registry->RegisterIntegerPref(prefs::kSignInPromoStartupCount, 0); |
268 registry->RegisterBooleanPref(prefs::kSignInPromoUserSkipped, false); | 265 registry->RegisterBooleanPref(prefs::kSignInPromoUserSkipped, false); |
269 registry->RegisterBooleanPref(prefs::kSignInPromoShowOnFirstRunAllowed, true); | 266 registry->RegisterBooleanPref(prefs::kSignInPromoShowOnFirstRunAllowed, true); |
270 registry->RegisterBooleanPref(prefs::kSignInPromoShowNTPBubble, false); | 267 registry->RegisterBooleanPref(prefs::kSignInPromoShowNTPBubble, false); |
271 } | 268 } |
272 | 269 |
273 } // namespace signin | 270 } // namespace signin |
OLD | NEW |