| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/signin/signin_promo_util.h" |
| 6 |
| 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/signin/signin_manager_factory.h" |
| 9 #include "components/signin/core/browser/signin_manager.h" |
| 10 #include "net/base/network_change_notifier.h" |
| 11 |
| 12 namespace signin { |
| 13 |
| 14 bool ShouldShowPromo(Profile* profile) { |
| 15 #if defined(OS_CHROMEOS) |
| 16 // There's no need to show the sign in promo on cros since cros users are |
| 17 // already logged in. |
| 18 return false; |
| 19 #else |
| 20 |
| 21 // Don't bother if we don't have any kind of network connection. |
| 22 if (net::NetworkChangeNotifier::IsOffline()) |
| 23 return false; |
| 24 |
| 25 // Don't show for supervised profiles. |
| 26 if (profile->IsSupervised()) |
| 27 return false; |
| 28 |
| 29 // Display the signin promo if the user is not signed in. |
| 30 SigninManager* signin = |
| 31 SigninManagerFactory::GetForProfile(profile->GetOriginalProfile()); |
| 32 return !signin->AuthInProgress() && signin->IsSigninAllowed() && |
| 33 !signin->IsAuthenticated(); |
| 34 #endif |
| 35 } |
| 36 |
| 37 } // namespace signin |
| OLD | NEW |