| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 #if defined(OS_CHROMEOS) | 122 #if defined(OS_CHROMEOS) |
| 123 // There's no need to show the sync promo on cros since cros users are logged | 123 // There's no need to show the sync promo on cros since cros users are logged |
| 124 // into sync already. | 124 // into sync already. |
| 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 // Don't show if the profile is an incognito. |
| 133 if (profile->IsOffTheRecord()) |
| 134 return false; |
| 135 |
| 132 // Display the signin promo if the user is not signed in. | 136 // Display the signin promo if the user is not signed in. |
| 133 SigninManager* signin = SigninManagerFactory::GetForProfile( | 137 SigninManager* signin = SigninManagerFactory::GetForProfile( |
| 134 profile->GetOriginalProfile()); | 138 profile->GetOriginalProfile()); |
| 135 return !signin->AuthInProgress() && signin->IsSigninAllowed() && | 139 return !signin->AuthInProgress() && signin->IsSigninAllowed() && |
| 136 signin->GetAuthenticatedUsername().empty(); | 140 signin->GetAuthenticatedUsername().empty(); |
| 137 #endif | 141 #endif |
| 138 } | 142 } |
| 139 | 143 |
| 140 // static | 144 // static |
| 141 void SyncPromoUI::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 145 void SyncPromoUI::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 g_force_web_based_signin_flow; | 306 g_force_web_based_signin_flow; |
| 303 #else | 307 #else |
| 304 return false; | 308 return false; |
| 305 #endif | 309 #endif |
| 306 } | 310 } |
| 307 | 311 |
| 308 // static | 312 // static |
| 309 void SyncPromoUI::ForceWebBasedSigninFlowForTesting(bool force) { | 313 void SyncPromoUI::ForceWebBasedSigninFlowForTesting(bool force) { |
| 310 g_force_web_based_signin_flow = force; | 314 g_force_web_based_signin_flow = force; |
| 311 } | 315 } |
| OLD | NEW |