| 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 #import "ios/chrome/browser/autofill/autofill_agent.h" | 5 #import "ios/chrome/browser/autofill/autofill_agent.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 return nil; | 844 return nil; |
| 845 } | 845 } |
| 846 | 846 |
| 847 - (void)renderAutofillTypePredictions: | 847 - (void)renderAutofillTypePredictions: |
| 848 (const std::vector<autofill::FormStructure*>&)structure { | 848 (const std::vector<autofill::FormStructure*>&)structure { |
| 849 base::DictionaryValue predictionData; | 849 base::DictionaryValue predictionData; |
| 850 for (autofill::FormStructure* form : structure) { | 850 for (autofill::FormStructure* form : structure) { |
| 851 // |predictionData| will take ownership below. | 851 // |predictionData| will take ownership below. |
| 852 base::DictionaryValue* formJSONData = new base::DictionaryValue; | 852 base::DictionaryValue* formJSONData = new base::DictionaryValue; |
| 853 autofill::FormData formData = form->ToFormData(); | 853 autofill::FormData formData = form->ToFormData(); |
| 854 for (const autofill::AutofillField* field : *form) { | 854 for (const auto& field : *form) { |
| 855 autofill::AutofillType type(field->Type()); | 855 autofill::AutofillType type(field->Type()); |
| 856 if (type.IsUnknown()) | 856 if (type.IsUnknown()) |
| 857 continue; | 857 continue; |
| 858 formJSONData->SetStringWithoutPathExpansion( | 858 formJSONData->SetStringWithoutPathExpansion( |
| 859 base::UTF16ToUTF8(field->name), type.ToString()); | 859 base::UTF16ToUTF8(field->name), type.ToString()); |
| 860 } | 860 } |
| 861 predictionData.SetWithoutPathExpansion(base::UTF16ToUTF8(formData.name), | 861 predictionData.SetWithoutPathExpansion(base::UTF16ToUTF8(formData.name), |
| 862 formJSONData); | 862 formJSONData); |
| 863 } | 863 } |
| 864 std::string dataString; | 864 std::string dataString; |
| 865 base::JSONWriter::Write(predictionData, &dataString); | 865 base::JSONWriter::Write(predictionData, &dataString); |
| 866 [jsAutofillManager_ fillPredictionData:base::SysUTF8ToNSString(dataString)]; | 866 [jsAutofillManager_ fillPredictionData:base::SysUTF8ToNSString(dataString)]; |
| 867 } | 867 } |
| 868 | 868 |
| 869 @end | 869 @end |
| OLD | NEW |