| 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/first_run/first_run.h" | 13 #include "chrome/browser/first_run/first_run.h" |
| 14 #include "chrome/browser/google/google_brand.h" |
| 14 #include "chrome/browser/google/google_util.h" | 15 #include "chrome/browser/google/google_util.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" |
| 23 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 56 |
| 56 // The maximum number of times we want to show the sign in promo at startup. | 57 // The maximum number of times we want to show the sign in promo at startup. |
| 57 const int kSignInPromoShowAtStartupMaximum = 10; | 58 const int kSignInPromoShowAtStartupMaximum = 10; |
| 58 | 59 |
| 59 // Forces the web based signin flow when set. | 60 // Forces the web based signin flow when set. |
| 60 bool g_force_web_based_signin_flow = false; | 61 bool g_force_web_based_signin_flow = false; |
| 61 | 62 |
| 62 // Checks we want to show the sign in promo for the given brand. | 63 // Checks we want to show the sign in promo for the given brand. |
| 63 bool AllowPromoAtStartupForCurrentBrand() { | 64 bool AllowPromoAtStartupForCurrentBrand() { |
| 64 std::string brand; | 65 std::string brand; |
| 65 google_util::GetBrand(&brand); | 66 google_brand::GetBrand(&brand); |
| 66 | 67 |
| 67 if (brand.empty()) | 68 if (brand.empty()) |
| 68 return true; | 69 return true; |
| 69 | 70 |
| 70 if (google_util::IsInternetCafeBrandCode(brand)) | 71 if (google_brand::IsInternetCafeBrandCode(brand)) |
| 71 return false; | 72 return false; |
| 72 | 73 |
| 73 // Enable for both organic and distribution. | 74 // Enable for both organic and distribution. |
| 74 return true; | 75 return true; |
| 75 } | 76 } |
| 76 | 77 |
| 77 // Returns true if a user has seen the sign in promo at startup previously. | 78 // Returns true if a user has seen the sign in promo at startup previously. |
| 78 bool HasShownPromoAtStartup(Profile* profile) { | 79 bool HasShownPromoAtStartup(Profile* profile) { |
| 79 return profile->GetPrefs()->HasPrefPath(prefs::kSignInPromoStartupCount); | 80 return profile->GetPrefs()->HasPrefPath(prefs::kSignInPromoStartupCount); |
| 80 } | 81 } |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 prefs::kSignInPromoShowOnFirstRunAllowed, | 325 prefs::kSignInPromoShowOnFirstRunAllowed, |
| 325 true, | 326 true, |
| 326 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 327 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 327 registry->RegisterBooleanPref( | 328 registry->RegisterBooleanPref( |
| 328 prefs::kSignInPromoShowNTPBubble, | 329 prefs::kSignInPromoShowNTPBubble, |
| 329 false, | 330 false, |
| 330 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 331 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 331 } | 332 } |
| 332 | 333 |
| 333 } // namespace signin | 334 } // namespace signin |
| OLD | NEW |