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

Side by Side Diff: ios/chrome/browser/autofill/autofill_agent.mm

Issue 2884933002: Remove raw base::DictionaryValue::SetWithoutPathExpansion (Closed)
Patch Set: Include Created 3 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 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 #include <utility>
9 10
10 #include "base/format_macros.h" 11 #include "base/format_macros.h"
11 #include "base/guid.h" 12 #include "base/guid.h"
12 #include "base/json/json_reader.h" 13 #include "base/json/json_reader.h"
13 #include "base/json/json_writer.h" 14 #include "base/json/json_writer.h"
14 #include "base/mac/foundation_util.h" 15 #include "base/mac/foundation_util.h"
15 #include "base/mac/scoped_block.h" 16 #include "base/mac/scoped_block.h"
17 #include "base/memory/ptr_util.h"
16 #include "base/metrics/field_trial.h" 18 #include "base/metrics/field_trial.h"
17 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
18 #include "base/strings/sys_string_conversions.h" 20 #include "base/strings/sys_string_conversions.h"
19 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
20 #include "base/values.h" 22 #include "base/values.h"
21 #include "components/autofill/core/browser/autofill_manager.h" 23 #include "components/autofill/core/browser/autofill_manager.h"
22 #include "components/autofill/core/browser/autofill_metrics.h" 24 #include "components/autofill/core/browser/autofill_metrics.h"
23 #include "components/autofill/core/browser/autofill_profile.h" 25 #include "components/autofill/core/browser/autofill_profile.h"
24 #include "components/autofill/core/browser/credit_card.h" 26 #include "components/autofill/core/browser/credit_card.h"
25 #include "components/autofill/core/browser/keyboard_accessory_metrics_logger.h" 27 #include "components/autofill/core/browser/keyboard_accessory_metrics_logger.h"
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 } 855 }
854 } 856 }
855 857
856 return nil; 858 return nil;
857 } 859 }
858 860
859 - (void)renderAutofillTypePredictions: 861 - (void)renderAutofillTypePredictions:
860 (const std::vector<autofill::FormStructure*>&)structure { 862 (const std::vector<autofill::FormStructure*>&)structure {
861 base::DictionaryValue predictionData; 863 base::DictionaryValue predictionData;
862 for (autofill::FormStructure* form : structure) { 864 for (autofill::FormStructure* form : structure) {
863 // |predictionData| will take ownership below. 865 auto formJSONData = base::MakeUnique<base::DictionaryValue>();
864 base::DictionaryValue* formJSONData = new base::DictionaryValue;
865 autofill::FormData formData = form->ToFormData(); 866 autofill::FormData formData = form->ToFormData();
866 for (const auto& field : *form) { 867 for (const auto& field : *form) {
867 autofill::AutofillType type(field->Type()); 868 autofill::AutofillType type(field->Type());
868 if (type.IsUnknown()) 869 if (type.IsUnknown())
869 continue; 870 continue;
870 formJSONData->SetStringWithoutPathExpansion( 871 formJSONData->SetStringWithoutPathExpansion(
871 base::UTF16ToUTF8(field->name), type.ToString()); 872 base::UTF16ToUTF8(field->name), type.ToString());
872 } 873 }
873 predictionData.SetWithoutPathExpansion(base::UTF16ToUTF8(formData.name), 874 predictionData.SetWithoutPathExpansion(base::UTF16ToUTF8(formData.name),
874 formJSONData); 875 std::move(formJSONData));
875 } 876 }
876 std::string dataString; 877 std::string dataString;
877 base::JSONWriter::Write(predictionData, &dataString); 878 base::JSONWriter::Write(predictionData, &dataString);
878 [jsAutofillManager_ fillPredictionData:base::SysUTF8ToNSString(dataString)]; 879 [jsAutofillManager_ fillPredictionData:base::SysUTF8ToNSString(dataString)];
879 } 880 }
880 881
881 @end 882 @end
OLDNEW
« no previous file with comments | « extensions/browser/api/bluetooth_low_energy/utils.cc ('k') | ios/chrome/browser/browser_state/browser_state_info_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698