OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/sync_promo/sync_promo_ui.h" | 5 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 return false; | 125 return false; |
126 #else | 126 #else |
127 | 127 |
128 // Don't bother if we don't have any kind of network connection. | 128 // Don't bother if we don't have any kind of network connection. |
129 if (net::NetworkChangeNotifier::IsOffline()) | 129 if (net::NetworkChangeNotifier::IsOffline()) |
130 return false; | 130 return false; |
131 | 131 |
132 // Display the signin promo if the user is not signed in. | 132 // Display the signin promo if the user is not signed in. |
133 SigninManager* signin = SigninManagerFactory::GetForProfile( | 133 SigninManager* signin = SigninManagerFactory::GetForProfile( |
134 profile->GetOriginalProfile()); | 134 profile->GetOriginalProfile()); |
135 return signin->GetAuthenticatedUsername().empty(); | 135 return signin->IsSigninAllowed() && |
| 136 signin->GetAuthenticatedUsername().empty(); |
136 #endif | 137 #endif |
137 } | 138 } |
138 | 139 |
139 // static | 140 // static |
140 void SyncPromoUI::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 141 void SyncPromoUI::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
141 registry->RegisterIntegerPref(prefs::kSyncPromoStartupCount, 0, | 142 registry->RegisterIntegerPref(prefs::kSyncPromoStartupCount, 0, |
142 PrefRegistrySyncable::UNSYNCABLE_PREF); | 143 PrefRegistrySyncable::UNSYNCABLE_PREF); |
143 registry->RegisterBooleanPref(prefs::kSyncPromoUserSkipped, false, | 144 registry->RegisterBooleanPref(prefs::kSyncPromoUserSkipped, false, |
144 PrefRegistrySyncable::UNSYNCABLE_PREF); | 145 PrefRegistrySyncable::UNSYNCABLE_PREF); |
145 registry->RegisterBooleanPref(prefs::kSyncPromoShowOnFirstRunAllowed, true, | 146 registry->RegisterBooleanPref(prefs::kSyncPromoShowOnFirstRunAllowed, true, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 g_force_web_based_signin_flow; | 302 g_force_web_based_signin_flow; |
302 #else | 303 #else |
303 return false; | 304 return false; |
304 #endif | 305 #endif |
305 } | 306 } |
306 | 307 |
307 // static | 308 // static |
308 void SyncPromoUI::ForceWebBasedSigninFlowForTesting(bool force) { | 309 void SyncPromoUI::ForceWebBasedSigninFlowForTesting(bool force) { |
309 g_force_web_based_signin_flow = force; | 310 g_force_web_based_signin_flow = force; |
310 } | 311 } |
OLD | NEW |