OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 | 6 |
7 """Takes the JSON files in components/domain_reliability/baked_in_configs and | 7 """Takes the JSON files in components/domain_reliability/baked_in_configs and |
8 encodes their contents as an array of C strings that gets compiled in to Chrome | 8 encodes their contents as an array of C strings that gets compiled in to Chrome |
9 and loaded at runtime.""" | 9 and loaded at runtime.""" |
10 | 10 |
11 | 11 |
12 import json | 12 import json |
13 import os | 13 import os |
14 import sys | 14 import sys |
15 | 15 |
16 | 16 |
17 # A whitelist of domains that the script will accept when baking configs in to | 17 # A whitelist of domains that the script will accept when baking configs in to |
18 # Chrome, to ensure incorrect ones are not added accidentally. Subdomains of | 18 # Chrome, to ensure incorrect ones are not added accidentally. Subdomains of |
19 # whitelist entries are also allowed (e.g. maps.google.com, ssl.gstatic.com). | 19 # whitelist entries are also allowed (e.g. maps.google.com, ssl.gstatic.com). |
20 DOMAIN_WHITELIST = ('2mdn.net', 'admob.com', 'doubleclick.net', 'ggpht.com', | 20 DOMAIN_WHITELIST = ('2mdn.net', 'admob.com', 'doubleclick.net', 'ggpht.com', |
21 'google.com', 'googleadservices.com', 'googleapis.com', | 21 'google.cn', 'google.co.uk', 'google.com', 'google.com.au', |
22 'googlesyndication.com', 'googleusercontent.com', | 22 'google.de', 'google.fr', 'google.it', 'google.jp', |
23 'googlevideo.com', 'gstatic.com', 'gvt1.com', 'youtube.com') | 23 'google.org', 'google.ru', 'googleadservices.com', |
| 24 'googleapis.com', 'googlesyndication.com', |
| 25 'googleusercontent.com', 'googlevideo.com', 'gstatic.com', |
| 26 'gvt1.com', 'youtube.com', 'ytimg.com') |
24 | 27 |
25 | 28 |
26 CC_HEADER = """// Copyright (C) 2014 The Chromium Authors. All rights reserved. | 29 CC_HEADER = """// Copyright (C) 2014 The Chromium Authors. All rights reserved. |
27 // Use of this source code is governed by a BSD-style license that can be | 30 // Use of this source code is governed by a BSD-style license that can be |
28 // found in the LICENSE file. | 31 // found in the LICENSE file. |
29 | 32 |
30 // AUTOGENERATED FILE. DO NOT EDIT. | 33 // AUTOGENERATED FILE. DO NOT EDIT. |
31 // | 34 // |
32 // (Update configs in components/domain_reliability/baked_in_configs and list | 35 // (Update configs in components/domain_reliability/baked_in_configs and list |
33 // configs in components/domain_reliability.gypi instead.) | 36 // configs in components/domain_reliability.gypi instead.) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 return 1 | 108 return 1 |
106 | 109 |
107 with open(sys.argv[-1], 'wb') as f: | 110 with open(sys.argv[-1], 'wb') as f: |
108 f.write(cpp_code) | 111 f.write(cpp_code) |
109 | 112 |
110 return 0 | 113 return 0 |
111 | 114 |
112 | 115 |
113 if __name__ == '__main__': | 116 if __name__ == '__main__': |
114 sys.exit(main()) | 117 sys.exit(main()) |
OLD | NEW |