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 "chrome/browser/autofill/autofill_manager.h" | 5 #include "chrome/browser/autofill/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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 callback); | 777 callback); |
778 controller->Show(); | 778 controller->Show(); |
779 } | 779 } |
780 | 780 |
781 void AutofillManager::ReturnAutocompleteData(const FormStructure* result) { | 781 void AutofillManager::ReturnAutocompleteData(const FormStructure* result) { |
782 RenderViewHost* host = web_contents()->GetRenderViewHost(); | 782 RenderViewHost* host = web_contents()->GetRenderViewHost(); |
783 if (!host) | 783 if (!host) |
784 return; | 784 return; |
785 | 785 |
786 if (!result) { | 786 if (!result) { |
787 host->Send(new AutofillMsg_RequestAutocompleteFinished( | 787 host->Send(new AutofillMsg_RequestAutocompleteError(host->GetRoutingID())); |
788 host->GetRoutingID(), WebKit::WebFormElement::AutocompleteResultError)); | 788 return; |
789 } else { | |
790 // TODO(estade): implement non-failure case. | |
791 host->Send(new AutofillMsg_RequestAutocompleteFinished( | |
792 host->GetRoutingID(), WebKit::WebFormElement::AutocompleteResultError)); | |
793 } | 789 } |
| 790 |
| 791 scoped_ptr<FormData> form_data(result->ToFormData()); |
| 792 host->Send(new AutofillMsg_RequestAutocompleteSuccess(host->GetRoutingID(), |
| 793 *form_data.get())); |
794 } | 794 } |
795 | 795 |
796 void AutofillManager::OnLoadedServerPredictions( | 796 void AutofillManager::OnLoadedServerPredictions( |
797 const std::string& response_xml) { | 797 const std::string& response_xml) { |
798 // Parse and store the server predictions. | 798 // Parse and store the server predictions. |
799 FormStructure::ParseQueryResponse(response_xml, | 799 FormStructure::ParseQueryResponse(response_xml, |
800 form_structures_.get(), | 800 form_structures_.get(), |
801 *metric_logger_); | 801 *metric_logger_); |
802 | 802 |
803 // If the corresponding flag is set, annotate forms with the predicted types. | 803 // If the corresponding flag is set, annotate forms with the predicted types. |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 *profile_guid = IDToGUID(profile_id); | 1329 *profile_guid = IDToGUID(profile_id); |
1330 } | 1330 } |
1331 | 1331 |
1332 void AutofillManager::UpdateInitialInteractionTimestamp( | 1332 void AutofillManager::UpdateInitialInteractionTimestamp( |
1333 const TimeTicks& interaction_timestamp) { | 1333 const TimeTicks& interaction_timestamp) { |
1334 if (initial_interaction_timestamp_.is_null() || | 1334 if (initial_interaction_timestamp_.is_null() || |
1335 interaction_timestamp < initial_interaction_timestamp_) { | 1335 interaction_timestamp < initial_interaction_timestamp_) { |
1336 initial_interaction_timestamp_ = interaction_timestamp; | 1336 initial_interaction_timestamp_ = interaction_timestamp; |
1337 } | 1337 } |
1338 } | 1338 } |
OLD | NEW |