| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 prefs::kSignInPromoStartupCount); | 156 prefs::kSignInPromoStartupCount); |
| 157 show_count++; | 157 show_count++; |
| 158 profile->GetPrefs()->SetInteger(prefs::kSignInPromoStartupCount, show_count); | 158 profile->GetPrefs()->SetInteger(prefs::kSignInPromoStartupCount, show_count); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void SetUserSkippedPromo(Profile* profile) { | 161 void SetUserSkippedPromo(Profile* profile) { |
| 162 profile->GetPrefs()->SetBoolean(prefs::kSignInPromoUserSkipped, true); | 162 profile->GetPrefs()->SetBoolean(prefs::kSignInPromoUserSkipped, true); |
| 163 } | 163 } |
| 164 | 164 |
| 165 GURL GetLandingURL(const char* option, int value) { | 165 GURL GetLandingURL(const char* option, int value) { |
| 166 const std::string& locale = g_browser_process->GetApplicationLocale(); | 166 std::string url; |
| 167 std::string url = base::StringPrintf(kSignInLandingUrlPrefix, locale.c_str()); | 167 if (switches::IsEnableWebBasedSignin()) { |
| 168 const std::string& locale = g_browser_process->GetApplicationLocale(); |
| 169 url = base::StringPrintf(kSignInLandingUrlPrefix, locale.c_str()); |
| 170 } else { |
| 171 const char kGaiaExtSuccessURLPrefix[] = |
| 172 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/success.html"; |
| 173 url = kGaiaExtSuccessURLPrefix; |
| 174 } |
| 168 base::StringAppendF(&url, "?%s=%d", option, value); | 175 base::StringAppendF(&url, "?%s=%d", option, value); |
| 169 return GURL(url); | 176 return GURL(url); |
| 170 } | 177 } |
| 171 | 178 |
| 172 GURL GetPromoURL(Source source, bool auto_close) { | 179 GURL GetPromoURL(Source source, bool auto_close) { |
| 173 return GetPromoURL(source, auto_close, false /* is_constrained */); | 180 return GetPromoURL(source, auto_close, false /* is_constrained */); |
| 174 } | 181 } |
| 175 | 182 |
| 176 GURL GetPromoURL(Source source, bool auto_close, bool is_constrained) { | 183 GURL GetPromoURL(Source source, bool auto_close, bool is_constrained) { |
| 177 return GetPromoURLWithContinueURL(source, auto_close, is_constrained, GURL()); | 184 return GetPromoURLWithContinueURL(source, auto_close, is_constrained, GURL()); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 prefs::kSignInPromoShowOnFirstRunAllowed, | 338 prefs::kSignInPromoShowOnFirstRunAllowed, |
| 332 true, | 339 true, |
| 333 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 340 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 334 registry->RegisterBooleanPref( | 341 registry->RegisterBooleanPref( |
| 335 prefs::kSignInPromoShowNTPBubble, | 342 prefs::kSignInPromoShowNTPBubble, |
| 336 false, | 343 false, |
| 337 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 344 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 338 } | 345 } |
| 339 | 346 |
| 340 } // namespace signin | 347 } // namespace signin |
| OLD | NEW |