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

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

Issue 13264002: Requery the autofill server when forms and input fields are dynamically added. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fun with merging Created 7 years, 7 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 (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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 forms_loaded_timestamp_, 374 forms_loaded_timestamp_,
375 initial_interaction_timestamp_, 375 initial_interaction_timestamp_,
376 timestamp)); 376 timestamp));
377 } 377 }
378 378
379 return true; 379 return true;
380 } 380 }
381 381
382 void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms, 382 void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms,
383 const TimeTicks& timestamp, 383 const TimeTicks& timestamp,
384 bool has_more_forms) { 384 autofill::FormsSeenState state) {
385 bool is_post_document_load = state == autofill::DYNAMIC_FORMS_SEEN;
386 bool has_more_forms = state == autofill::PARTIAL_FORMS_SEEN;
387 // If new forms were added via AJAX or DHML, treat as new page.
388 if (is_post_document_load)
389 Reset();
390
385 RenderViewHost* host = web_contents()->GetRenderViewHost(); 391 RenderViewHost* host = web_contents()->GetRenderViewHost();
386 if (!host) 392 if (!host)
387 return; 393 return;
388 394
389 if (!GetAutocheckoutURLPrefix().empty()) { 395 if (!GetAutocheckoutURLPrefix().empty()) {
390 // If whitelisted URL, fetch all the forms. 396 // If whitelisted URL, fetch all the forms.
391 if (has_more_forms) { 397 if (has_more_forms)
392 host->Send(new AutofillMsg_GetAllForms(host->GetRoutingID())); 398 host->Send(new AutofillMsg_GetAllForms(host->GetRoutingID()));
399 if (!is_post_document_load) {
400 host->Send(
401 new AutofillMsg_AutocheckoutSupported(host->GetRoutingID()));
402 }
403 // Now return early, as OnFormsSeen will get called again with all forms.
404 if (has_more_forms)
393 return; 405 return;
394 }
395 } 406 }
396 407
397 autocheckout_manager_.OnFormsSeen(); 408 autocheckout_manager_.OnFormsSeen();
398 bool enabled = IsAutofillEnabled(); 409 bool enabled = IsAutofillEnabled();
399 if (!has_logged_autofill_enabled_) { 410 if (!has_logged_autofill_enabled_) {
400 metric_logger_->LogIsAutofillEnabledAtPageLoad(enabled); 411 metric_logger_->LogIsAutofillEnabledAtPageLoad(enabled);
401 has_logged_autofill_enabled_ = true; 412 has_logged_autofill_enabled_ = true;
402 } 413 }
403 414
404 if (!enabled) 415 if (!enabled)
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 1282
1272 void AutofillManager::UpdateInitialInteractionTimestamp( 1283 void AutofillManager::UpdateInitialInteractionTimestamp(
1273 const TimeTicks& interaction_timestamp) { 1284 const TimeTicks& interaction_timestamp) {
1274 if (initial_interaction_timestamp_.is_null() || 1285 if (initial_interaction_timestamp_.is_null() ||
1275 interaction_timestamp < initial_interaction_timestamp_) { 1286 interaction_timestamp < initial_interaction_timestamp_) {
1276 initial_interaction_timestamp_ = interaction_timestamp; 1287 initial_interaction_timestamp_ = interaction_timestamp;
1277 } 1288 }
1278 } 1289 }
1279 1290
1280 } // namespace autofill 1291 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/browser/autofill_manager.h ('k') | components/autofill/browser/autofill_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698