| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // Don't show if the profile is an incognito. | 132 // Don't show if the profile is an incognito. |
| 133 if (profile->IsOffTheRecord()) | 133 if (profile->IsOffTheRecord()) |
| 134 return false; | 134 return false; |
| 135 | 135 |
| 136 // Don't show for managed profiles. |
| 137 if (profile->GetPrefs()->GetBoolean(prefs::kProfileIsManaged)) |
| 138 return false; |
| 139 |
| 136 // Display the signin promo if the user is not signed in. | 140 // Display the signin promo if the user is not signed in. |
| 137 SigninManager* signin = SigninManagerFactory::GetForProfile( | 141 SigninManager* signin = SigninManagerFactory::GetForProfile( |
| 138 profile->GetOriginalProfile()); | 142 profile->GetOriginalProfile()); |
| 139 return !signin->AuthInProgress() && signin->IsSigninAllowed() && | 143 return !signin->AuthInProgress() && signin->IsSigninAllowed() && |
| 140 signin->GetAuthenticatedUsername().empty(); | 144 signin->GetAuthenticatedUsername().empty(); |
| 141 #endif | 145 #endif |
| 142 } | 146 } |
| 143 | 147 |
| 144 // static | 148 // static |
| 145 void SyncPromoUI::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 149 void SyncPromoUI::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 g_force_web_based_signin_flow; | 310 g_force_web_based_signin_flow; |
| 307 #else | 311 #else |
| 308 return false; | 312 return false; |
| 309 #endif | 313 #endif |
| 310 } | 314 } |
| 311 | 315 |
| 312 // static | 316 // static |
| 313 void SyncPromoUI::ForceWebBasedSigninFlowForTesting(bool force) { | 317 void SyncPromoUI::ForceWebBasedSigninFlowForTesting(bool force) { |
| 314 g_force_web_based_signin_flow = force; | 318 g_force_web_based_signin_flow = force; |
| 315 } | 319 } |
| OLD | NEW |