OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/autofill_manager.h" | 5 #include "components/autofill/browser/autofill_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <map> | 10 #include <map> |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 forms_loaded_timestamp_, | 448 forms_loaded_timestamp_, |
449 initial_interaction_timestamp_, | 449 initial_interaction_timestamp_, |
450 timestamp)); | 450 timestamp)); |
451 } | 451 } |
452 | 452 |
453 return true; | 453 return true; |
454 } | 454 } |
455 | 455 |
456 void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms, | 456 void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms, |
457 const TimeTicks& timestamp, | 457 const TimeTicks& timestamp, |
458 bool has_more_forms) { | 458 autofill::FormsSeenState state) { |
| 459 bool is_post_document_load = state & autofill::DYNAMIC_FORMS_SEEN; |
| 460 bool has_more_forms = state & autofill::PARTIAL_FORMS_SEEN; |
| 461 // If new forms were added via AJAX or DHML, treat as new page. |
| 462 if (is_post_document_load) |
| 463 Reset(); |
| 464 |
459 RenderViewHost* host = web_contents()->GetRenderViewHost(); | 465 RenderViewHost* host = web_contents()->GetRenderViewHost(); |
460 if (!host) | 466 if (!host) |
461 return; | 467 return; |
462 | 468 |
463 if (!GetAutocheckoutURLPrefix().empty()) { | 469 if (!GetAutocheckoutURLPrefix().empty()) { |
464 host->Send( | |
465 new AutofillMsg_WhitelistedForAutocheckout(host->GetRoutingID())); | |
466 // If whitelisted URL, fetch all the forms. | 470 // If whitelisted URL, fetch all the forms. |
467 if (has_more_forms) { | 471 if (has_more_forms) |
468 host->Send(new AutofillMsg_GetAllForms(host->GetRoutingID())); | 472 host->Send(new AutofillMsg_GetAllForms(host->GetRoutingID())); |
| 473 if (!is_post_document_load) { |
| 474 host->Send( |
| 475 new AutofillMsg_WhitelistedForAutocheckout(host->GetRoutingID())); |
| 476 } |
| 477 // Now return early, as OnFormsSeen will get called again with all forms. |
| 478 if (has_more_forms) |
469 return; | 479 return; |
470 } | |
471 } | 480 } |
472 | 481 |
473 autocheckout_manager_.OnFormsSeen(); | 482 autocheckout_manager_.OnFormsSeen(); |
474 bool enabled = IsAutofillEnabled(); | 483 bool enabled = IsAutofillEnabled(); |
475 if (!has_logged_autofill_enabled_) { | 484 if (!has_logged_autofill_enabled_) { |
476 metric_logger_->LogIsAutofillEnabledAtPageLoad(enabled); | 485 metric_logger_->LogIsAutofillEnabledAtPageLoad(enabled); |
477 has_logged_autofill_enabled_ = true; | 486 has_logged_autofill_enabled_ = true; |
478 } | 487 } |
479 | 488 |
480 if (!enabled) | 489 if (!enabled) |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 | 1359 |
1351 void AutofillManager::UpdateInitialInteractionTimestamp( | 1360 void AutofillManager::UpdateInitialInteractionTimestamp( |
1352 const TimeTicks& interaction_timestamp) { | 1361 const TimeTicks& interaction_timestamp) { |
1353 if (initial_interaction_timestamp_.is_null() || | 1362 if (initial_interaction_timestamp_.is_null() || |
1354 interaction_timestamp < initial_interaction_timestamp_) { | 1363 interaction_timestamp < initial_interaction_timestamp_) { |
1355 initial_interaction_timestamp_ = interaction_timestamp; | 1364 initial_interaction_timestamp_ = interaction_timestamp; |
1356 } | 1365 } |
1357 } | 1366 } |
1358 | 1367 |
1359 } // namespace autofill | 1368 } // namespace autofill |
OLD | NEW |