Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2410)

Unified Diff: chrome/browser/signin/signin_promo_util.cc

Issue 2138643004: [Autofill] Add support for signin promo on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@aaa
Patch Set: nits Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/signin/signin_promo_util.cc
diff --git a/chrome/browser/signin/signin_promo_util.cc b/chrome/browser/signin/signin_promo_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ba55a8a247cd19be1955ba3db8a07fc12822fb4e
--- /dev/null
+++ b/chrome/browser/signin/signin_promo_util.cc
@@ -0,0 +1,37 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/signin/signin_promo_util.h"
+
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/signin/signin_manager_factory.h"
+#include "components/signin/core/browser/signin_manager.h"
+#include "net/base/network_change_notifier.h"
+
+namespace signin {
+
+bool ShouldShowPromo(Profile* profile) {
+#if defined(OS_CHROMEOS)
+ // There's no need to show the sign in promo on cros since cros users are
+ // already logged in.
+ return false;
+#else
+
+ // Don't bother if we don't have any kind of network connection.
+ if (net::NetworkChangeNotifier::IsOffline())
+ return false;
+
+ // Don't show for supervised profiles.
+ if (profile->IsSupervised())
+ return false;
+
+ // Display the signin promo if the user is not signed in.
+ SigninManager* signin =
+ SigninManagerFactory::GetForProfile(profile->GetOriginalProfile());
+ return !signin->AuthInProgress() && signin->IsSigninAllowed() &&
+ !signin->IsAuthenticated();
+#endif
+}
+
+} // namespace signin
« no previous file with comments | « chrome/browser/signin/signin_promo_util.h ('k') | chrome/browser/ui/android/autofill/autofill_popup_view_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698