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

Side by Side Diff: components/policy/tools/generate_policy_source.py

Issue 1323923002: Remove use of JSONReader::DeprecatedRead from components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Error fix Created 5 years, 3 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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 '''python %prog [options] platform chromium_os_flag template 6 '''python %prog [options] platform chromium_os_flag template
7 7
8 platform specifies which platform source is being generated for 8 platform specifies which platform source is being generated for
9 and can be one of (win, mac, linux) 9 and can be one of (win, mac, linux)
10 chromium_os_flag should be 1 if this is a Chromium OS build 10 chromium_os_flag should be 1 if this is a Chromium OS build
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 base::ListValue* list_value = new base::ListValue; 923 base::ListValue* list_value = new base::ListValue;
924 RepeatedPtrField<std::string>::const_iterator entry; 924 RepeatedPtrField<std::string>::const_iterator entry;
925 for (entry = string_list.entries().begin(); 925 for (entry = string_list.entries().begin();
926 entry != string_list.entries().end(); ++entry) { 926 entry != string_list.entries().end(); ++entry) {
927 list_value->AppendString(*entry); 927 list_value->AppendString(*entry);
928 } 928 }
929 return list_value; 929 return list_value;
930 } 930 }
931 931
932 base::Value* DecodeJson(const std::string& json) { 932 base::Value* DecodeJson(const std::string& json) {
933 scoped_ptr<base::Value> root( 933 scoped_ptr<base::Value> root =
934 base::JSONReader::DeprecatedRead(json, base::JSON_ALLOW_TRAILING_COMMAS)); 934 base::JSONReader::Read(json, base::JSON_ALLOW_TRAILING_COMMAS);
935 935
936 if (!root) 936 if (!root)
937 LOG(WARNING) << "Invalid JSON string, ignoring: " << json; 937 LOG(WARNING) << "Invalid JSON string, ignoring: " << json;
938 938
939 // Accept any Value type that parsed as JSON, and leave it to the handler to 939 // Accept any Value type that parsed as JSON, and leave it to the handler to
940 // convert and check the concrete type. 940 // convert and check the concrete type.
941 return root.release(); 941 return root.release();
942 } 942 }
943 943
944 void DecodePolicy(const em::CloudPolicySettings& policy, 944 void DecodePolicy(const em::CloudPolicySettings& policy,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 # _WriteAppRestrictions body 1048 # _WriteAppRestrictions body
1049 f.write('<restrictions xmlns:android="' 1049 f.write('<restrictions xmlns:android="'
1050 'http://schemas.android.com/apk/res/android">\n\n') 1050 'http://schemas.android.com/apk/res/android">\n\n')
1051 for policy in policies: 1051 for policy in policies:
1052 if policy.is_supported and policy.restriction_type != 'invalid': 1052 if policy.is_supported and policy.restriction_type != 'invalid':
1053 WriteAppRestriction(policy) 1053 WriteAppRestriction(policy)
1054 f.write('</restrictions>') 1054 f.write('</restrictions>')
1055 1055
1056 if __name__ == '__main__': 1056 if __name__ == '__main__':
1057 sys.exit(main()) 1057 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698