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

Side by Side Diff: components/autofill/core/browser/autofill_manager.cc

Issue 2672623005: Record Autofill form events specially for nonsecure pages (Closed)
Patch Set: fix test added in rebase Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/core/browser/autofill_manager.h" 5 #include "components/autofill/core/browser/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 user_did_edit_autofilled_field_ = true; 527 user_did_edit_autofilled_field_ = true;
528 AutofillMetrics::LogUserHappinessMetric( 528 AutofillMetrics::LogUserHappinessMetric(
529 AutofillMetrics::USER_DID_EDIT_AUTOFILLED_FIELD_ONCE); 529 AutofillMetrics::USER_DID_EDIT_AUTOFILLED_FIELD_ONCE);
530 } 530 }
531 } 531 }
532 532
533 UpdateInitialInteractionTimestamp(timestamp); 533 UpdateInitialInteractionTimestamp(timestamp);
534 } 534 }
535 535
536 bool AutofillManager::IsFormNonSecure(const FormData& form) const { 536 bool AutofillManager::IsFormNonSecure(const FormData& form) const {
537 return !client_->IsContextSecure(form.origin) || 537 return !client_->IsContextSecure() ||
538 (form.action.is_valid() && form.action.SchemeIs("http")); 538 (form.action.is_valid() && form.action.SchemeIs("http"));
539 } 539 }
540 540
541 void AutofillManager::OnQueryFormFieldAutofill(int query_id, 541 void AutofillManager::OnQueryFormFieldAutofill(int query_id,
542 const FormData& form, 542 const FormData& form,
543 const FormFieldData& field, 543 const FormFieldData& field,
544 const gfx::RectF& bounding_box) { 544 const gfx::RectF& bounding_box) {
545 if (!IsValidFormData(form) || !IsValidFormFieldData(field)) 545 if (!IsValidFormData(form) || !IsValidFormFieldData(field))
546 return; 546 return;
547 547
(...skipping 20 matching lines...) Expand all
568 is_filling_credit_card = true; 568 is_filling_credit_card = true;
569 driver_->DidInteractWithCreditCardForm(); 569 driver_->DidInteractWithCreditCardForm();
570 credit_card_form_event_logger_->OnDidInteractWithAutofillableForm(); 570 credit_card_form_event_logger_->OnDidInteractWithAutofillableForm();
571 } else { 571 } else {
572 address_form_event_logger_->OnDidInteractWithAutofillableForm(); 572 address_form_event_logger_->OnDidInteractWithAutofillableForm();
573 } 573 }
574 } 574 }
575 575
576 std::vector<Suggestion> suggestions; 576 std::vector<Suggestion> suggestions;
577 const bool is_context_secure = !IsFormNonSecure(form); 577 const bool is_context_secure = !IsFormNonSecure(form);
578
579 const bool is_http_warning_enabled = 578 const bool is_http_warning_enabled =
580 security_state::IsHttpWarningInFormEnabled(); 579 security_state::IsHttpWarningInFormEnabled();
581 580
582 // TODO(rogerm): Early exit here on !driver_->RendererIsAvailable()? 581 // TODO(rogerm): Early exit here on !driver_->RendererIsAvailable()?
583 // We skip populating autofill data, but might generate warnings and or 582 // We skip populating autofill data, but might generate warnings and or
584 // signin promo to show over the unavailable renderer. That seems a mistake. 583 // signin promo to show over the unavailable renderer. That seems a mistake.
585 584
586 if (is_autofill_possible && 585 if (is_autofill_possible &&
587 driver_->RendererIsAvailable() && 586 driver_->RendererIsAvailable() &&
588 got_autofillable_form) { 587 got_autofillable_form) {
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 for (CreditCard* credit_card : credit_cards) { 1466 for (CreditCard* credit_card : credit_cards) {
1468 if (credit_card->record_type() == CreditCard::LOCAL_CARD) 1467 if (credit_card->record_type() == CreditCard::LOCAL_CARD)
1469 is_local_data_available = true; 1468 is_local_data_available = true;
1470 else 1469 else
1471 is_server_data_available = true; 1470 is_server_data_available = true;
1472 } 1471 }
1473 credit_card_form_event_logger_->set_is_server_data_available( 1472 credit_card_form_event_logger_->set_is_server_data_available(
1474 is_server_data_available); 1473 is_server_data_available);
1475 credit_card_form_event_logger_->set_is_local_data_available( 1474 credit_card_form_event_logger_->set_is_local_data_available(
1476 is_local_data_available); 1475 is_local_data_available);
1476 credit_card_form_event_logger_->set_is_context_secure(
1477 client_->IsContextSecure());
1477 } 1478 }
1478 { 1479 {
1479 bool is_server_data_available = false; 1480 bool is_server_data_available = false;
1480 bool is_local_data_available = false; 1481 bool is_local_data_available = false;
1481 for (AutofillProfile* profile : profiles) { 1482 for (AutofillProfile* profile : profiles) {
1482 if (profile->record_type() == AutofillProfile::LOCAL_PROFILE) 1483 if (profile->record_type() == AutofillProfile::LOCAL_PROFILE)
1483 is_local_data_available = true; 1484 is_local_data_available = true;
1484 else if (profile->record_type() == AutofillProfile::SERVER_PROFILE) 1485 else if (profile->record_type() == AutofillProfile::SERVER_PROFILE)
1485 is_server_data_available = true; 1486 is_server_data_available = true;
1486 } 1487 }
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
2178 if (i > 0) 2179 if (i > 0)
2179 fputs("Next oldest form:\n", file); 2180 fputs("Next oldest form:\n", file);
2180 } 2181 }
2181 fputs("\n", file); 2182 fputs("\n", file);
2182 2183
2183 fclose(file); 2184 fclose(file);
2184 } 2185 }
2185 #endif // ENABLE_FORM_DEBUG_DUMP 2186 #endif // ENABLE_FORM_DEBUG_DUMP
2186 2187
2187 } // namespace autofill 2188 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_client.h ('k') | components/autofill/core/browser/autofill_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698