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 20 matching lines...) Expand all Loading... |
31 #include "content/public/browser/url_data_source.h" | 31 #include "content/public/browser/url_data_source.h" |
32 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
33 #include "content/public/browser/web_ui.h" | 33 #include "content/public/browser/web_ui.h" |
34 #include "content/public/browser/web_ui_data_source.h" | 34 #include "content/public/browser/web_ui_data_source.h" |
35 #include "google_apis/gaia/gaia_urls.h" | 35 #include "google_apis/gaia/gaia_urls.h" |
36 #include "net/base/escape.h" | 36 #include "net/base/escape.h" |
37 #include "net/base/network_change_notifier.h" | 37 #include "net/base/network_change_notifier.h" |
38 #include "net/base/url_util.h" | 38 #include "net/base/url_util.h" |
39 #include "url/gurl.h" | 39 #include "url/gurl.h" |
40 | 40 |
| 41 #if defined(OS_WIN) |
| 42 #include "base/win/windows_version.h" |
| 43 #endif |
| 44 |
41 using content::WebContents; | 45 using content::WebContents; |
42 | 46 |
43 namespace { | 47 namespace { |
44 | 48 |
45 // The maximum number of times we want to show the sign in promo at startup. | 49 // The maximum number of times we want to show the sign in promo at startup. |
46 const int kSignInPromoShowAtStartupMaximum = 10; | 50 const int kSignInPromoShowAtStartupMaximum = 10; |
47 | 51 |
48 // Forces the web based signin flow when set. | 52 // Forces the web based signin flow when set. |
49 bool g_force_web_based_signin_flow = false; | 53 bool g_force_web_based_signin_flow = false; |
50 | 54 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 return false; | 112 return false; |
109 | 113 |
110 if (!ShouldShowPromo(profile)) | 114 if (!ShouldShowPromo(profile)) |
111 return false; | 115 return false; |
112 | 116 |
113 if (!is_new_profile) { | 117 if (!is_new_profile) { |
114 if (!HasShownPromoAtStartup(profile)) | 118 if (!HasShownPromoAtStartup(profile)) |
115 return false; | 119 return false; |
116 } | 120 } |
117 | 121 |
| 122 #if defined(OS_WIN) |
| 123 // Do not show the promo on first run on Win10 and newer. |
| 124 if (is_new_profile && base::win::GetVersion() >= base::win::VERSION_WIN10) |
| 125 return false; |
| 126 #endif |
| 127 |
118 if (HasUserSkippedPromo(profile)) | 128 if (HasUserSkippedPromo(profile)) |
119 return false; | 129 return false; |
120 | 130 |
121 // For Chinese users skip the sign in promo. | 131 // For Chinese users skip the sign in promo. |
122 if (g_browser_process->GetApplicationLocale() == "zh-CN") | 132 if (g_browser_process->GetApplicationLocale() == "zh-CN") |
123 return false; | 133 return false; |
124 | 134 |
125 PrefService* prefs = profile->GetPrefs(); | 135 PrefService* prefs = profile->GetPrefs(); |
126 int show_count = prefs->GetInteger(prefs::kSignInPromoStartupCount); | 136 int show_count = prefs->GetInteger(prefs::kSignInPromoStartupCount); |
127 if (show_count >= kSignInPromoShowAtStartupMaximum) | 137 if (show_count >= kSignInPromoShowAtStartupMaximum) |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 262 |
253 void RegisterProfilePrefs( | 263 void RegisterProfilePrefs( |
254 user_prefs::PrefRegistrySyncable* registry) { | 264 user_prefs::PrefRegistrySyncable* registry) { |
255 registry->RegisterIntegerPref(prefs::kSignInPromoStartupCount, 0); | 265 registry->RegisterIntegerPref(prefs::kSignInPromoStartupCount, 0); |
256 registry->RegisterBooleanPref(prefs::kSignInPromoUserSkipped, false); | 266 registry->RegisterBooleanPref(prefs::kSignInPromoUserSkipped, false); |
257 registry->RegisterBooleanPref(prefs::kSignInPromoShowOnFirstRunAllowed, true); | 267 registry->RegisterBooleanPref(prefs::kSignInPromoShowOnFirstRunAllowed, true); |
258 registry->RegisterBooleanPref(prefs::kSignInPromoShowNTPBubble, false); | 268 registry->RegisterBooleanPref(prefs::kSignInPromoShowNTPBubble, false); |
259 } | 269 } |
260 | 270 |
261 } // namespace signin | 271 } // namespace signin |
OLD | NEW |