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

Unified Diff: chrome/browser/ui/autofill/chrome_autofill_client.cc

Issue 2138643004: [Autofill] Add support for signin promo on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@aaa
Patch Set: fix return type 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
« no previous file with comments | « chrome/browser/ui/android/autofill/autofill_popup_view_android.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/autofill/chrome_autofill_client.cc
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.cc b/chrome/browser/ui/autofill/chrome_autofill_client.cc
index a79166311efe32669afdebd5c6642d63c06c0a4f..a6fb0fa874eb1bb6caa4a41bb588a2a5ef86af67 100644
--- a/chrome/browser/ui/autofill/chrome_autofill_client.cc
+++ b/chrome/browser/ui/autofill/chrome_autofill_client.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/password_manager/chrome_password_manager_client.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/signin/signin_promo.h"
@@ -59,6 +60,8 @@
#endif
#if defined(OS_ANDROID)
+#include "base/android/context_utils.h"
+#include "chrome/browser/android/signin/signin_promo_util.h"
#include "components/autofill/core/browser/autofill_save_card_infobar_delegate_mobile.h"
#include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h"
#include "components/infobars/core/infobar.h"
@@ -340,10 +343,17 @@ bool ChromeAutofillClient::IsContextSecure(const GURL& form_origin) {
}
bool ChromeAutofillClient::ShouldShowSigninPromo() {
-#if defined(OS_ANDROID) || defined(OS_IOS)
- // TODO(crbug.com/626383): Implement signin promo for Android and iOS by
- // changing the logic of StartSigninFlow() below.
+#if defined(OS_IOS)
+ // TODO(crbug.com/626383): Implement sign-in promo for iOS by changing the
+ // logic of StartSigninFlow() below.
return false;
+#elif defined(OS_ANDROID)
+ // On Android, we show the promo if the user is signed out and not currently
+ // signing in.
+ Profile* profile = ProfileManager::GetActiveUserProfile();
+ SigninManager* signin = SigninManagerFactory::GetForProfile(profile);
+ return !signin->AuthInProgress() && signin->IsSigninAllowed() &&
Evan Stade 2016/07/12 18:16:22 this looks suspiciously similar to the implementat
Mathieu 2016/07/12 18:47:25 Unfortunately signing_promo.h/cc is not included o
+ !signin->IsAuthenticated();
#else
return chrome::FindBrowserWithWebContents(web_contents()) &&
signin::ShouldShowPromo(
@@ -353,7 +363,12 @@ bool ChromeAutofillClient::ShouldShowSigninPromo() {
void ChromeAutofillClient::StartSigninFlow() {
// See ShouldShowSigninPromo.
-#if !defined(OS_ANDROID) && !defined(OS_IOS)
+#if defined(OS_IOS)
+ return;
+#elif defined(OS_ANDROID)
+ chrome::android::SigninPromoUtil::OpenAccountSigninActivityForPromo(
+ signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN);
+#else
chrome::FindBrowserWithWebContents(web_contents())
->window()
->ShowAvatarBubbleFromAvatarButton(
« no previous file with comments | « chrome/browser/ui/android/autofill/autofill_popup_view_android.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698