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