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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 forms_loaded_timestamp_, | 443 forms_loaded_timestamp_, |
444 initial_interaction_timestamp_, | 444 initial_interaction_timestamp_, |
445 timestamp)); | 445 timestamp)); |
446 } | 446 } |
447 | 447 |
448 return true; | 448 return true; |
449 } | 449 } |
450 | 450 |
451 void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms, | 451 void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms, |
452 const TimeTicks& timestamp, | 452 const TimeTicks& timestamp, |
453 bool has_more_forms) { | 453 autofill::FormsSeenParam param) { |
| 454 bool is_post_document_load = param & autofill::DYNAMIC_FORMS_SEEN; |
| 455 bool has_more_forms = param & autofill::PARTIAL_FORMS_SEEN; |
| 456 // If new forms were added via AJAX or DHML, treat as new page. |
| 457 if (is_post_document_load) |
| 458 Reset(); |
| 459 |
454 RenderViewHost* host = web_contents()->GetRenderViewHost(); | 460 RenderViewHost* host = web_contents()->GetRenderViewHost(); |
455 if (!host) | 461 if (!host) |
456 return; | 462 return; |
457 | 463 |
458 if (!GetAutocheckoutURLPrefix().empty()) { | 464 if (!GetAutocheckoutURLPrefix().empty()) { |
459 host->Send( | 465 if (!is_post_document_load) { |
460 new AutofillMsg_WhitelistedForAutocheckout(host->GetRoutingID())); | 466 host->Send( |
| 467 new AutofillMsg_WhitelistedForAutocheckout(host->GetRoutingID())); |
| 468 } |
461 // If whitelisted URL, fetch all the forms. | 469 // If whitelisted URL, fetch all the forms. |
462 if (has_more_forms) { | 470 if (has_more_forms) { |
463 host->Send(new AutofillMsg_GetAllForms(host->GetRoutingID())); | 471 host->Send(new AutofillMsg_GetAllForms(host->GetRoutingID())); |
464 return; | 472 return; |
465 } | 473 } |
466 } | 474 } |
467 | 475 |
468 autocheckout_manager_.OnFormsSeen(); | 476 autocheckout_manager_.OnFormsSeen(); |
469 bool enabled = IsAutofillEnabled(); | 477 bool enabled = IsAutofillEnabled(); |
470 if (!has_logged_autofill_enabled_) { | 478 if (!has_logged_autofill_enabled_) { |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1337 *profile_guid = IDToGUID(profile_id); | 1345 *profile_guid = IDToGUID(profile_id); |
1338 } | 1346 } |
1339 | 1347 |
1340 void AutofillManager::UpdateInitialInteractionTimestamp( | 1348 void AutofillManager::UpdateInitialInteractionTimestamp( |
1341 const TimeTicks& interaction_timestamp) { | 1349 const TimeTicks& interaction_timestamp) { |
1342 if (initial_interaction_timestamp_.is_null() || | 1350 if (initial_interaction_timestamp_.is_null() || |
1343 interaction_timestamp < initial_interaction_timestamp_) { | 1351 interaction_timestamp < initial_interaction_timestamp_) { |
1344 initial_interaction_timestamp_ = interaction_timestamp; | 1352 initial_interaction_timestamp_ = interaction_timestamp; |
1345 } | 1353 } |
1346 } | 1354 } |
OLD | NEW |