| 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" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h" |
| 13 #include "chrome/browser/first_run/first_run.h" | 14 #include "chrome/browser/first_run/first_run.h" |
| 14 #include "chrome/browser/google/google_brand.h" | 15 #include "chrome/browser/google/google_brand.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/profiles/profile_info_cache.h" | 17 #include "chrome/browser/profiles/profile_info_cache.h" |
| 17 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
| 18 #include "chrome/browser/signin/signin_manager_factory.h" | 19 #include "chrome/browser/signin/signin_manager_factory.h" |
| 19 #include "chrome/browser/ui/webui/options/core_options_handler.h" | 20 #include "chrome/browser/ui/webui/options/core_options_handler.h" |
| 20 #include "chrome/browser/ui/webui/theme_source.h" | 21 #include "chrome/browser/ui/webui/theme_source.h" |
| 21 #include "chrome/common/net/url_util.h" | 22 #include "chrome/common/net/url_util.h" |
| 22 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 prefs::kSignInPromoStartupCount); | 157 prefs::kSignInPromoStartupCount); |
| 157 show_count++; | 158 show_count++; |
| 158 profile->GetPrefs()->SetInteger(prefs::kSignInPromoStartupCount, show_count); | 159 profile->GetPrefs()->SetInteger(prefs::kSignInPromoStartupCount, show_count); |
| 159 } | 160 } |
| 160 | 161 |
| 161 void SetUserSkippedPromo(Profile* profile) { | 162 void SetUserSkippedPromo(Profile* profile) { |
| 162 profile->GetPrefs()->SetBoolean(prefs::kSignInPromoUserSkipped, true); | 163 profile->GetPrefs()->SetBoolean(prefs::kSignInPromoUserSkipped, true); |
| 163 } | 164 } |
| 164 | 165 |
| 165 GURL GetLandingURL(const char* option, int value) { | 166 GURL GetLandingURL(const char* option, int value) { |
| 166 const std::string& locale = g_browser_process->GetApplicationLocale(); | 167 std::string url; |
| 167 std::string url = base::StringPrintf(kSignInLandingUrlPrefix, locale.c_str()); | 168 if (switches::IsEnableWebBasedSignin()) { |
| 169 const std::string& locale = g_browser_process->GetApplicationLocale(); |
| 170 url = base::StringPrintf(kSignInLandingUrlPrefix, locale.c_str()); |
| 171 } else { |
| 172 url = base::StringPrintf( |
| 173 "%s/success.html", extensions::kGaiaAuthExtensionOrigin); |
| 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 |