Chromium Code Reviews| 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 2f58f126f1d738c1e7ef835c0caf4c7a15d5eefb..ecb224a01f5ba8e444acc6d6cee6da080a961f19 100644 |
| --- a/chrome/browser/ui/autofill/chrome_autofill_client.cc |
| +++ b/chrome/browser/ui/autofill/chrome_autofill_client.cc |
| @@ -19,6 +19,7 @@ |
| #include "chrome/browser/profiles/profile.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" |
| #include "chrome/browser/sync/profile_sync_service_factory.h" |
| #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
| #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" |
| @@ -42,6 +43,8 @@ |
| #include "components/password_manager/content/browser/content_password_manager_driver.h" |
| #include "components/prefs/pref_service.h" |
| #include "components/signin/core/browser/profile_identity_provider.h" |
| +#include "components/signin/core/browser/signin_header_helper.h" |
| +#include "components/signin/core/browser/signin_metrics.h" |
| #include "components/user_prefs/user_prefs.h" |
| #include "content/public/browser/navigation_entry.h" |
| #include "content/public/browser/render_frame_host.h" |
| @@ -336,4 +339,32 @@ bool ChromeAutofillClient::IsContextSecure(const GURL& form_origin) { |
| content::SSLStatus::RAN_INSECURE_CONTENT); |
| } |
| +bool ChromeAutofillClient::ShouldShowSigninPromo() { |
| +#if defined(OS_ANDROID) || defined(OS_IOS) |
| + // TODO(crbug.com/626383): Implement sign-in promo for Android and iOS by |
| + // changing the logic of StartSigninFlow() below. |
| + return false; |
| +#else |
| + Profile* profile = |
| + Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| + if (!profile) |
|
Evan Stade
2016/07/08 17:34:58
can this actually be null? many other places in th
Mathieu
2016/07/08 18:10:01
Done.
|
| + return false; |
| + |
| + return signin::ShouldShowPromo(profile); |
| +#endif |
| +} |
| + |
| +void ChromeAutofillClient::StartSigninFlow() { |
| +// See ShouldShowSigninPromo. |
| +#if !defined(OS_ANDROID) && !defined(OS_IOS) |
| + Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); |
|
Evan Stade
2016/07/08 17:34:58
ditto -- can this validly be null? I think it coul
Mathieu
2016/07/08 18:10:01
Good point. I'll check for existence of Browser in
|
| + if (browser) { |
| + browser->window()->ShowAvatarBubbleFromAvatarButton( |
| + BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, |
| + signin::ManageAccountsParams(), |
| + signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN); |
| + } |
| +#endif |
| +} |
| + |
| } // namespace autofill |