blob: 1dad3243d4e823ac22f3522917f3b8c150f72251 [file] [log] [blame]
[email protected]b4db6d42014-06-07 04:36:581// Copyright 2014 The Chromium Authors. All rights reserved.
[email protected]8d4cc15e2012-08-30 00:33:102// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]b4db6d42014-06-07 04:36:585#include "chrome/browser/ui/autofill/chrome_autofill_client.h"
[email protected]8d4cc15e2012-08-30 00:33:106
dcheng4a9d9822015-12-26 22:35:307#include <utility>
8
jdonnelly8d709542015-04-29 21:58:229#include "base/bind.h"
bondd2ee9bd1d2015-12-11 02:56:0510#include "base/command_line.h"
[email protected]8d4cc15e2012-08-30 00:33:1011#include "base/logging.h"
[email protected]3853a4c2013-02-11 17:15:5712#include "base/prefs/pref_service.h"
avi655876a2015-12-25 07:18:1513#include "build/build_config.h"
[email protected]6f3ccf52013-02-21 03:55:2314#include "chrome/browser/autofill/personal_data_manager_factory.h"
jdonnelly8d709542015-04-29 21:58:2215#include "chrome/browser/autofill/risk_util.h"
mathp94e3f0b2015-03-18 00:16:1616#include "chrome/browser/browser_process.h"
[email protected]4a8adfa02013-03-19 22:37:4617#include "chrome/browser/infobars/infobar_service.h"
[email protected]7d7e0b72014-02-10 18:36:0518#include "chrome/browser/password_manager/chrome_password_manager_client.h"
[email protected]8d4cc15e2012-08-30 00:33:1019#include "chrome/browser/profiles/profile.h"
estade494f8e62015-01-26 23:28:1320#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
21#include "chrome/browser/signin/signin_manager_factory.h"
[email protected]a55c6742013-08-10 07:28:4822#include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
[email protected]bfd4b812013-04-11 02:02:1123#include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h"
jdonnelly982b06f2015-05-19 17:14:2024#include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h"
rouslan497109da2014-11-26 20:30:3425#include "chrome/browser/ui/autofill/credit_card_scanner_controller.h"
bondd052b5f82015-10-28 22:39:3226#include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h"
[email protected]cc5419d2012-08-30 02:29:4627#include "chrome/browser/ui/browser.h"
28#include "chrome/browser/ui/browser_finder.h"
29#include "chrome/browser/ui/browser_window.h"
30#include "chrome/browser/ui/chrome_pages.h"
[email protected]10090d52013-07-25 20:41:3731#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
tfarinabf215a6f2015-06-15 22:24:0532#include "chrome/browser/web_data_service_factory.h"
sievers2f1e8112015-12-04 18:43:5633#include "chrome/common/features.h"
[email protected]cc5419d2012-08-30 02:29:4634#include "chrome/common/url_constants.h"
[email protected]e13549e2014-03-12 20:34:3635#include "components/autofill/content/browser/content_autofill_driver.h"
[email protected]45b53fb2013-12-12 19:28:0636#include "components/autofill/content/common/autofill_messages.h"
pritam.nikam2cd65ab92015-01-13 08:13:0237#include "components/autofill/core/browser/autofill_cc_infobar_delegate.h"
jdonnelly982b06f2015-05-19 17:14:2038#include "components/autofill/core/browser/ui/card_unmask_prompt_view.h"
[email protected]6c7dcb2f22013-06-22 00:57:4839#include "components/autofill/core/common/autofill_pref_names.h"
bondd2ee9bd1d2015-12-11 02:56:0540#include "components/autofill/core/common/autofill_switches.h"
estadeb1bc9bd2014-12-02 22:44:1141#include "components/password_manager/content/browser/content_password_manager_driver.h"
droger7758c112015-07-15 18:02:2642#include "components/signin/core/browser/profile_identity_provider.h"
jdonnelly8d709542015-04-29 21:58:2243#include "components/user_prefs/user_prefs.h"
sigbjorn337de86e2015-07-08 10:11:1244#include "content/public/browser/navigation_entry.h"
estade1dbe1232015-01-06 22:45:0445#include "content/public/browser/render_frame_host.h"
tfarina3b0452d2014-12-31 15:20:0946#include "ui/gfx/geometry/rect.h"
[email protected]8d4cc15e2012-08-30 00:33:1047
sievers2f1e8112015-12-04 18:43:5648#if BUILDFLAG(ANDROID_JAVA_UI)
aurimas87d357eb2015-06-30 17:07:3249#include "chrome/browser/android/chrome_application.h"
[email protected]5b466c42014-02-25 17:56:3650#include "chrome/browser/ui/android/autofill/autofill_logger_android.h"
thestig2c8c41e2014-10-23 02:56:5051#else
estade494f8e62015-01-26 23:28:1352#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
wjmaclean7f63c6b2014-12-09 14:59:5553#include "components/ui/zoom/zoom_controller.h"
[email protected]5b466c42014-02-25 17:56:3654#endif
55
rouslanacfb6cff2016-01-14 20:10:4256#if defined(OS_ANDROID) || defined(OS_IOS)
57#include "components/autofill/core/browser/autofill_save_card_infobar_delegate_mobile.h"
58#include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h"
59#include "components/infobars/core/infobar.h"
60#endif
61
[email protected]b4db6d42014-06-07 04:36:5862DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient);
[email protected]bfb4d67212013-02-14 20:32:2963
64namespace autofill {
[email protected]698bdf742012-10-01 21:13:5065
bondd2ee9bd1d2015-12-11 02:56:0566namespace {
67
68#if !defined(OS_ANDROID)
69bool IsSaveCardBubbleEnabled() {
70#if defined(OS_MACOSX)
71 return base::CommandLine::ForCurrentProcess()->HasSwitch(
72 switches::kEnableSaveCardBubble);
73#else
74 return true;
75#endif
76}
77#endif // !defined(OS_ANDROID)
78
79} // namespace
80
[email protected]b4db6d42014-06-07 04:36:5881ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents)
estade7c369d42014-12-18 01:46:2382 : content::WebContentsObserver(web_contents),
jdonnelly8d709542015-04-29 21:58:2283 unmask_controller_(
jdonnelly8d709542015-04-29 21:58:2284 user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()),
85 Profile::FromBrowserContext(web_contents->GetBrowserContext())
86 ->IsOffTheRecord()),
estade1dbe1232015-01-06 22:45:0487 last_rfh_to_rac_(nullptr) {
[email protected]698bdf742012-10-01 21:13:5088 DCHECK(web_contents);
thestig2c8c41e2014-10-23 02:56:5089
sievers2f1e8112015-12-04 18:43:5690#if !BUILDFLAG(ANDROID_JAVA_UI)
[email protected]76a54502014-07-10 22:59:3491 // Since ZoomController is also a WebContentsObserver, we need to be careful
92 // about disconnecting from it since the relative order of destruction of
93 // WebContentsObservers is not guaranteed. ZoomController silently clears
94 // its ZoomObserver list during WebContentsDestroyed() so there's no need
95 // to explicitly remove ourselves on destruction.
wjmaclean7f63c6b2014-12-09 14:59:5596 ui_zoom::ZoomController* zoom_controller =
97 ui_zoom::ZoomController::FromWebContents(web_contents);
thestig2c8c41e2014-10-23 02:56:5098 // There may not always be a ZoomController, e.g. in tests.
[email protected]76a54502014-07-10 22:59:3499 if (zoom_controller)
100 zoom_controller->AddObserver(this);
thestig2c8c41e2014-10-23 02:56:50101#endif
[email protected]8d4cc15e2012-08-30 00:33:10102}
103
[email protected]b4db6d42014-06-07 04:36:58104ChromeAutofillClient::~ChromeAutofillClient() {
[email protected]9256a9362013-07-04 22:11:48105 // NOTE: It is too late to clean up the autofill popup; that cleanup process
106 // requires that the WebContents instance still be valid and it is not at
107 // this point (in particular, the WebContentsImpl destructor has already
108 // finished running and we are now in the base class destructor).
109 DCHECK(!popup_controller_);
[email protected]8ac8bfd2013-02-27 05:18:08110}
111
[email protected]b4db6d42014-06-07 04:36:58112void ChromeAutofillClient::TabActivated() {
[email protected]10090d52013-07-25 20:41:37113 if (dialog_controller_.get())
114 dialog_controller_->TabActivated();
115}
116
[email protected]b4db6d42014-06-07 04:36:58117PersonalDataManager* ChromeAutofillClient::GetPersonalDataManager() {
[email protected]6f3ccf52013-02-21 03:55:23118 Profile* profile =
estadeecb659d2014-12-11 03:53:16119 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
[email protected]6f3ccf52013-02-21 03:55:23120 return PersonalDataManagerFactory::GetForProfile(
121 profile->GetOriginalProfile());
122}
123
[email protected]b4db6d42014-06-07 04:36:58124scoped_refptr<AutofillWebDataService> ChromeAutofillClient::GetDatabase() {
[email protected]34b59462013-12-03 14:08:32125 Profile* profile =
estadeecb659d2014-12-11 03:53:16126 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
[email protected]34b59462013-12-03 14:08:32127 return WebDataServiceFactory::GetAutofillWebDataForProfile(
sdefresnee9ea3c22015-01-10 10:10:04128 profile, ServiceAccessType::EXPLICIT_ACCESS);
[email protected]29079a272013-11-19 14:51:24129}
130
[email protected]b4db6d42014-06-07 04:36:58131PrefService* ChromeAutofillClient::GetPrefs() {
estadeecb659d2014-12-11 03:53:16132 return Profile::FromBrowserContext(web_contents()->GetBrowserContext())
[email protected]b4db6d42014-06-07 04:36:58133 ->GetPrefs();
[email protected]8d4cc15e2012-08-30 00:33:10134}
135
estade494f8e62015-01-26 23:28:13136IdentityProvider* ChromeAutofillClient::GetIdentityProvider() {
137 if (!identity_provider_) {
138 Profile* profile =
estade1baedb12015-03-23 22:59:29139 Profile::FromBrowserContext(web_contents()->GetBrowserContext())
140 ->GetOriginalProfile();
droger7758c112015-07-15 18:02:26141 base::Closure login_callback;
sievers2f1e8112015-12-04 18:43:56142#if !BUILDFLAG(ANDROID_JAVA_UI)
droger7758c112015-07-15 18:02:26143 login_callback =
144 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile);
estade494f8e62015-01-26 23:28:13145#endif
146 identity_provider_.reset(new ProfileIdentityProvider(
147 SigninManagerFactory::GetForProfile(profile),
148 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
droger7758c112015-07-15 18:02:26149 login_callback));
estade494f8e62015-01-26 23:28:13150 }
151
152 return identity_provider_.get();
153}
154
mathp94e3f0b2015-03-18 00:16:16155rappor::RapporService* ChromeAutofillClient::GetRapporService() {
156 return g_browser_process->rappor_service();
157}
158
[email protected]b4db6d42014-06-07 04:36:58159void ChromeAutofillClient::ShowAutofillSettings() {
sievers2f1e8112015-12-04 18:43:56160#if BUILDFLAG(ANDROID_JAVA_UI)
aurimas87d357eb2015-06-30 17:07:32161 chrome::android::ChromeApplication::ShowAutofillSettings();
[email protected]cc5419d2012-08-30 02:29:46162#else
estadeecb659d2014-12-11 03:53:16163 Browser* browser = chrome::FindBrowserWithWebContents(web_contents());
[email protected]cc5419d2012-08-30 02:29:46164 if (browser)
165 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage);
sievers2f1e8112015-12-04 18:43:56166#endif // #if BUILDFLAG(ANDROID_JAVA_UI)
[email protected]cc5419d2012-08-30 02:29:46167}
168
estade39f60492014-12-30 23:35:19169void ChromeAutofillClient::ShowUnmaskPrompt(
170 const CreditCard& card,
171 base::WeakPtr<CardUnmaskDelegate> delegate) {
jdonnelly982b06f2015-05-19 17:14:20172 unmask_controller_.ShowPrompt(
173 CreateCardUnmaskPromptView(&unmask_controller_, web_contents()),
174 card, delegate);
estadeecb659d2014-12-11 03:53:16175}
176
jdonnelly171e51e2015-11-10 21:45:38177void ChromeAutofillClient::OnUnmaskVerificationResult(
178 PaymentsRpcResult result) {
estadefb1d7742015-03-03 02:57:07179 unmask_controller_.OnVerificationResult(result);
estadeecb659d2014-12-11 03:53:16180}
181
jdonnelly171e51e2015-11-10 21:45:38182void ChromeAutofillClient::ConfirmSaveCreditCardLocally(
rouslanacfb6cff2016-01-14 20:10:42183 const CreditCard& card,
jdonnelly171e51e2015-11-10 21:45:38184 const base::Closure& callback) {
rouslanacfb6cff2016-01-14 20:10:42185#if defined(OS_ANDROID) || defined(OS_IOS)
186 InfoBarService::FromWebContents(web_contents())->AddInfoBar(
187 CreateSaveCardInfoBarMobile(
188 make_scoped_ptr(new AutofillSaveCardInfoBarDelegateMobile(
189 false, card, scoped_ptr<base::DictionaryValue>(nullptr),
190 callback))));
191#else
bondd2ee9bd1d2015-12-11 02:56:05192 if (IsSaveCardBubbleEnabled()) {
193 // Do lazy initialization of SaveCardBubbleControllerImpl.
194 autofill::SaveCardBubbleControllerImpl::CreateForWebContents(
195 web_contents());
196 autofill::SaveCardBubbleControllerImpl* controller =
197 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents());
198 controller->ShowBubbleForLocalSave(callback);
199 return;
200 }
rouslanacfb6cff2016-01-14 20:10:42201
rouslan752b87c2015-12-17 23:08:50202 AutofillCCInfoBarDelegate::CreateForLocalSave(
203 InfoBarService::FromWebContents(web_contents()), callback);
rouslanacfb6cff2016-01-14 20:10:42204#endif
[email protected]90804a502013-03-06 22:07:18205}
206
jdonnelly171e51e2015-11-10 21:45:38207void ChromeAutofillClient::ConfirmSaveCreditCardToCloud(
rouslanacfb6cff2016-01-14 20:10:42208 const CreditCard& card,
209 scoped_ptr<base::DictionaryValue> legal_message,
210 const base::Closure& callback) {
211#if defined(OS_ANDROID) || defined(OS_IOS)
212 InfoBarService::FromWebContents(web_contents())->AddInfoBar(
213 CreateSaveCardInfoBarMobile(
214 make_scoped_ptr(new AutofillSaveCardInfoBarDelegateMobile(
215 true, card, std::move(legal_message), callback))));
rouslan752b87c2015-12-17 23:08:50216#else
jdonnellyb417226c2015-11-18 00:38:23217 // Do lazy initialization of SaveCardBubbleControllerImpl.
218 autofill::SaveCardBubbleControllerImpl::CreateForWebContents(web_contents());
219 autofill::SaveCardBubbleControllerImpl* controller =
220 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents());
dcheng4a9d9822015-12-26 22:35:30221 controller->ShowBubbleForUpload(callback, std::move(legal_message));
jdonnellyb417226c2015-11-18 00:38:23222#endif
jdonnelly171e51e2015-11-10 21:45:38223}
224
225void ChromeAutofillClient::LoadRiskData(
226 const base::Callback<void(const std::string&)>& callback) {
227 ::autofill::LoadRiskData(0, web_contents(), callback);
228}
229
rouslan497109da2014-11-26 20:30:34230bool ChromeAutofillClient::HasCreditCardScanFeature() {
231 return CreditCardScannerController::HasCreditCardScanFeature();
232}
233
234void ChromeAutofillClient::ScanCreditCard(
235 const CreditCardScanCallback& callback) {
236 CreditCardScannerController::ScanCreditCard(web_contents(), callback);
237}
238
[email protected]b4db6d42014-06-07 04:36:58239void ChromeAutofillClient::ShowRequestAutocompleteDialog(
[email protected]4ff32522013-01-26 00:37:58240 const FormData& form,
estade1dbe1232015-01-06 22:45:04241 content::RenderFrameHost* render_frame_host,
[email protected]ce24d872014-04-11 20:45:28242 const ResultCallback& callback) {
[email protected]364481b2013-01-29 01:52:28243 HideRequestAutocompleteDialog();
estade1dbe1232015-01-06 22:45:04244 last_rfh_to_rac_ = render_frame_host;
245 GURL frame_url = render_frame_host->GetLastCommittedURL();
estadeecb659d2014-12-11 03:53:16246 dialog_controller_ = AutofillDialogController::Create(web_contents(), form,
estade1dbe1232015-01-06 22:45:04247 frame_url, callback);
[email protected]a55c6742013-08-10 07:28:48248 if (dialog_controller_) {
249 dialog_controller_->Show();
250 } else {
[email protected]b4db6d42014-06-07 04:36:58251 callback.Run(AutofillClient::AutocompleteResultErrorDisabled,
[email protected]dbdd60272014-04-14 22:48:40252 base::string16(),
[email protected]ce24d872014-04-11 20:45:28253 NULL);
[email protected]a55c6742013-08-10 07:28:48254 NOTIMPLEMENTED();
255 }
[email protected]364481b2013-01-29 01:52:28256}
257
[email protected]b4db6d42014-06-07 04:36:58258void ChromeAutofillClient::ShowAutofillPopup(
[email protected]8ac8bfd2013-02-27 05:18:08259 const gfx::RectF& element_bounds,
[email protected]46cb7e92013-06-12 15:32:31260 base::i18n::TextDirection text_direction,
brettw5f888152014-12-15 23:31:26261 const std::vector<autofill::Suggestion>& suggestions,
[email protected]1f66a3892013-04-22 18:57:14262 base::WeakPtr<AutofillPopupDelegate> delegate) {
[email protected]8ac8bfd2013-02-27 05:18:08263 // Convert element_bounds to be in screen space.
estadeecb659d2014-12-11 03:53:16264 gfx::Rect client_area = web_contents()->GetContainerBounds();
[email protected]8ac8bfd2013-02-27 05:18:08265 gfx::RectF element_bounds_in_screen_space =
266 element_bounds + client_area.OffsetFromOrigin();
267
268 // Will delete or reuse the old |popup_controller_|.
noms9139a6a2015-02-19 19:42:29269 popup_controller_ =
270 AutofillPopupControllerImpl::GetOrCreate(popup_controller_,
271 delegate,
272 web_contents(),
273 web_contents()->GetNativeView(),
274 element_bounds_in_screen_space,
275 text_direction);
[email protected]8ac8bfd2013-02-27 05:18:08276
brettw5f888152014-12-15 23:31:26277 popup_controller_->Show(suggestions);
[email protected]8ac8bfd2013-02-27 05:18:08278}
279
[email protected]b4db6d42014-06-07 04:36:58280void ChromeAutofillClient::UpdateAutofillPopupDataListValues(
[email protected]ead7fb02013-07-18 18:50:12281 const std::vector<base::string16>& values,
282 const std::vector<base::string16>& labels) {
283 if (popup_controller_.get())
284 popup_controller_->UpdateDataListValues(values, labels);
285}
286
[email protected]b4db6d42014-06-07 04:36:58287void ChromeAutofillClient::HideAutofillPopup() {
[email protected]e8dad9b2013-06-04 04:43:45288 if (popup_controller_.get())
[email protected]8ac8bfd2013-02-27 05:18:08289 popup_controller_->Hide();
[email protected]3cbdf9362014-01-31 23:12:23290
291 // Password generation popups behave in the same fashion and should also
292 // be hidden.
[email protected]53e4e6d2014-02-25 14:09:43293 ChromePasswordManagerClient* password_client =
estadeecb659d2014-12-11 03:53:16294 ChromePasswordManagerClient::FromWebContents(web_contents());
[email protected]53e4e6d2014-02-25 14:09:43295 if (password_client)
296 password_client->HidePasswordGenerationPopup();
[email protected]364481b2013-01-29 01:52:28297}
298
[email protected]b4db6d42014-06-07 04:36:58299bool ChromeAutofillClient::IsAutocompleteEnabled() {
[email protected]6c7dcb2f22013-06-22 00:57:48300 // For browser, Autocomplete is always enabled as part of Autofill.
301 return GetPrefs()->GetBoolean(prefs::kAutofillEnabled);
302}
303
[email protected]b4db6d42014-06-07 04:36:58304void ChromeAutofillClient::HideRequestAutocompleteDialog() {
estade1dbe1232015-01-06 22:45:04305 if (dialog_controller_)
[email protected]8ac8bfd2013-02-27 05:18:08306 dialog_controller_->Hide();
[email protected]364481b2013-01-29 01:52:28307}
308
estade1dbe1232015-01-06 22:45:04309void ChromeAutofillClient::RenderFrameDeleted(
310 content::RenderFrameHost* render_frame_host) {
311 if (dialog_controller_ && render_frame_host == last_rfh_to_rac_)
312 HideRequestAutocompleteDialog();
313}
314
315void ChromeAutofillClient::DidNavigateAnyFrame(
316 content::RenderFrameHost* render_frame_host,
317 const content::LoadCommittedDetails& details,
318 const content::FrameNavigateParams& params) {
319 if (dialog_controller_ && render_frame_host == last_rfh_to_rac_)
320 HideRequestAutocompleteDialog();
321}
322
rouslan2f5993f2015-01-29 00:18:31323void ChromeAutofillClient::MainFrameWasResized(bool width_changed) {
sievers2f1e8112015-12-04 18:43:56324#if BUILDFLAG(ANDROID_JAVA_UI)
rouslan2f5993f2015-01-29 00:18:31325 // Ignore virtual keyboard showing and hiding a strip of suggestions.
326 if (!width_changed)
327 return;
328#endif
329
estaded0a0c992015-01-21 14:12:06330 HideAutofillPopup();
331}
332
[email protected]b4db6d42014-06-07 04:36:58333void ChromeAutofillClient::WebContentsDestroyed() {
[email protected]9256a9362013-07-04 22:11:48334 HideAutofillPopup();
335}
336
[email protected]76a54502014-07-10 22:59:34337void ChromeAutofillClient::OnZoomChanged(
wjmaclean7f63c6b2014-12-09 14:59:55338 const ui_zoom::ZoomController::ZoomChangedEventData& data) {
[email protected]76a54502014-07-10 22:59:34339 HideAutofillPopup();
340}
341
dvadym89bccb1e2015-04-01 17:43:59342void ChromeAutofillClient::PropagateAutofillPredictions(
estadeb1bc9bd2014-12-02 22:44:11343 content::RenderFrameHost* rfh,
[email protected]375564a2013-09-06 20:36:40344 const std::vector<autofill::FormStructure*>& forms) {
estadecde163512014-12-04 22:14:05345 password_manager::ContentPasswordManagerDriver* driver =
346 password_manager::ContentPasswordManagerDriver::GetForRenderFrameHost(
347 rfh);
dvadym89bccb1e2015-04-01 17:43:59348 if (driver) {
dvadym189e588d2015-12-14 12:57:52349 driver->GetPasswordGenerationManager()->DetectFormsEligibleForGeneration(
350 forms);
dvadym89bccb1e2015-04-01 17:43:59351 driver->GetPasswordManager()->ProcessAutofillPredictions(driver, forms);
352 }
[email protected]375564a2013-09-06 20:36:40353}
354
[email protected]b4db6d42014-06-07 04:36:58355void ChromeAutofillClient::DidFillOrPreviewField(
[email protected]5b466c42014-02-25 17:56:36356 const base::string16& autofilled_value,
357 const base::string16& profile_full_name) {
sievers2f1e8112015-12-04 18:43:56358#if BUILDFLAG(ANDROID_JAVA_UI)
[email protected]b4db6d42014-06-07 04:36:58359 AutofillLoggerAndroid::DidFillOrPreviewField(autofilled_value,
360 profile_full_name);
sievers2f1e8112015-12-04 18:43:56361#endif // BUILDFLAG(ANDROID_JAVA_UI)
[email protected]5b466c42014-02-25 17:56:36362}
363
estadeb1bc9bd2014-12-02 22:44:11364void ChromeAutofillClient::OnFirstUserGestureObserved() {
365 web_contents()->SendToAllFrames(
366 new AutofillMsg_FirstUserGestureObservedInTab(routing_id()));
367}
368
sigbjorn337de86e2015-07-08 10:11:12369bool ChromeAutofillClient::IsContextSecure(const GURL& form_origin) {
370 content::SSLStatus ssl_status;
371 content::NavigationEntry* navigation_entry =
372 web_contents()->GetController().GetLastCommittedEntry();
373 if (!navigation_entry)
374 return false;
375
376 ssl_status = navigation_entry->GetSSL();
377 // Note: If changing the implementation below, also change
378 // AwAutofillClient::IsContextSecure. See crbug.com/505388
379 return ssl_status.security_style ==
380 content::SECURITY_STYLE_AUTHENTICATED &&
381 ssl_status.content_status == content::SSLStatus::NORMAL_CONTENT;
382}
383
[email protected]bfb4d67212013-02-14 20:32:29384} // namespace autofill