OLD | NEW |
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 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <map> | 10 #include <map> |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 base::Owned(submitted_form.release()), | 305 base::Owned(submitted_form.release()), |
306 forms_loaded_timestamp_, | 306 forms_loaded_timestamp_, |
307 initial_interaction_timestamp_, | 307 initial_interaction_timestamp_, |
308 timestamp)); | 308 timestamp)); |
309 } | 309 } |
310 | 310 |
311 return true; | 311 return true; |
312 } | 312 } |
313 | 313 |
314 void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms, | 314 void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms, |
315 const TimeTicks& timestamp, | 315 const TimeTicks& timestamp) { |
316 autofill::FormsSeenState state) { | |
317 if (!IsValidFormDataVector(forms)) | 316 if (!IsValidFormDataVector(forms)) |
318 return; | 317 return; |
319 | 318 |
320 bool is_post_document_load = state == autofill::DYNAMIC_FORMS_SEEN; | |
321 // If new forms were added dynamically, treat as a new page. | |
322 if (is_post_document_load) | |
323 Reset(); | |
324 | |
325 if (!driver_->RendererIsAvailable()) | 319 if (!driver_->RendererIsAvailable()) |
326 return; | 320 return; |
327 | 321 |
328 bool enabled = IsAutofillEnabled(); | 322 bool enabled = IsAutofillEnabled(); |
329 if (!has_logged_autofill_enabled_) { | 323 if (!has_logged_autofill_enabled_) { |
330 metric_logger_->LogIsAutofillEnabledAtPageLoad(enabled); | 324 metric_logger_->LogIsAutofillEnabledAtPageLoad(enabled); |
331 has_logged_autofill_enabled_ = true; | 325 has_logged_autofill_enabled_ = true; |
332 } | 326 } |
333 | 327 |
334 if (!enabled) | 328 if (!enabled) |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 return false; | 1161 return false; |
1168 | 1162 |
1169 // Disregard forms that we wouldn't ever autofill in the first place. | 1163 // Disregard forms that we wouldn't ever autofill in the first place. |
1170 if (!form.ShouldBeParsed(true)) | 1164 if (!form.ShouldBeParsed(true)) |
1171 return false; | 1165 return false; |
1172 | 1166 |
1173 return true; | 1167 return true; |
1174 } | 1168 } |
1175 | 1169 |
1176 } // namespace autofill | 1170 } // namespace autofill |
OLD | NEW |