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

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

Issue 13947035: Fail autocheckout if there is no forms in the page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update comments Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 host->Send( 459 host->Send(
460 new AutofillMsg_WhitelistedForAutocheckout(host->GetRoutingID())); 460 new AutofillMsg_WhitelistedForAutocheckout(host->GetRoutingID()));
461 // If whitelisted URL, fetch all the forms. 461 // If whitelisted URL, fetch all the forms.
462 if (has_more_forms) { 462 if (has_more_forms) {
463 host->Send(new AutofillMsg_GetAllForms(host->GetRoutingID())); 463 host->Send(new AutofillMsg_GetAllForms(host->GetRoutingID()));
464 return; 464 return;
465 } 465 }
466 } 466 }
467 467
468 autocheckout_manager_.OnFormsSeen(); 468 autocheckout_manager_.OnFormsSeen();
469 if (forms.empty()) {
470 // Call OnLoadedPageMetaData with no page metadata immediately if there is
471 // no form in the page. This give |autocheckout_manager| a chance to
472 // terminate Autocheckout and send Autocheckout status.
473 autocheckout_manager_.OnLoadedPageMetaData(
474 scoped_ptr<autofill::AutocheckoutPageMetaData>(NULL));
475 }
476
469 bool enabled = IsAutofillEnabled(); 477 bool enabled = IsAutofillEnabled();
470 if (!has_logged_autofill_enabled_) { 478 if (!has_logged_autofill_enabled_) {
471 metric_logger_->LogIsAutofillEnabledAtPageLoad(enabled); 479 metric_logger_->LogIsAutofillEnabledAtPageLoad(enabled);
472 has_logged_autofill_enabled_ = true; 480 has_logged_autofill_enabled_ = true;
473 } 481 }
474 482
475 if (!enabled) 483 if (!enabled)
476 return; 484 return;
477 485
478 forms_loaded_timestamp_ = timestamp; 486 forms_loaded_timestamp_ = timestamp;
479 ParseForms(forms); 487 ParseForms(forms);
Ilya Sherman 2013/04/10 20:52:18 What if |forms| is nonempty, but only contains for
benquan 2013/04/10 22:08:15 Good catch. I moved the logic into |ParseForms|.
480 } 488 }
481 489
482 void AutofillManager::OnTextFieldDidChange(const FormData& form, 490 void AutofillManager::OnTextFieldDidChange(const FormData& form,
483 const FormFieldData& field, 491 const FormFieldData& field,
484 const TimeTicks& timestamp) { 492 const TimeTicks& timestamp) {
485 FormStructure* form_structure = NULL; 493 FormStructure* form_structure = NULL;
486 AutofillField* autofill_field = NULL; 494 AutofillField* autofill_field = NULL;
487 if (!GetCachedFormAndField(form, field, &form_structure, &autofill_field)) 495 if (!GetCachedFormAndField(form, field, &form_structure, &autofill_field))
488 return; 496 return;
489 497
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/tab_autofill_manager_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698