| 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 ast | 12 import ast |
| 13 import json | 13 import json |
| 14 import os | 14 import os |
| 15 import sys | 15 import sys |
| 16 | 16 |
| 17 | 17 |
| 18 # A whitelist of domains that the script will accept when baking configs in to | 18 # A whitelist of domains that the script will accept when baking configs in to |
| 19 # Chrome, to ensure incorrect ones are not added accidentally. Subdomains of | 19 # Chrome, to ensure incorrect ones are not added accidentally. Subdomains of |
| 20 # whitelist entries are also allowed (e.g. maps.google.com, ssl.gstatic.com). | 20 # whitelist entries are also allowed (e.g. maps.google.com, ssl.gstatic.com). |
| 21 DOMAIN_WHITELIST = ( | 21 DOMAIN_WHITELIST = ( |
| 22 'admob.biz', |
| 23 'admob.co.in', |
| 24 'admob.co.kr', |
| 25 'admob.co.nz', |
| 26 'admob.co.uk', |
| 27 'admob.co.za', |
| 22 'admob.com', | 28 'admob.com', |
| 29 'admob.com.br', |
| 30 'admob.com.es', |
| 31 'admob.com.fr', |
| 32 'admob.com.mx', |
| 33 'admob.com.pt', |
| 34 'admob.de', |
| 35 'admob.dk', |
| 36 'admob.es', |
| 37 'admob.fi', |
| 38 'admob.fr', |
| 39 'admob.gr', |
| 40 'admob.hk', |
| 41 'admob.ie', |
| 42 'admob.in', |
| 43 'admob.it', |
| 44 'admob.jp', |
| 45 'admob.kr', |
| 46 'admob.mobi', |
| 47 'admob.no', |
| 48 'admob.ph', |
| 49 'admob.pt', |
| 50 'admob.sg', |
| 51 'admob.tw', |
| 52 'admob.us', |
| 53 'admob.vn', |
| 23 'doubleclick.net', | 54 'doubleclick.net', |
| 24 'ggpht.com', | 55 'ggpht.com', |
| 25 'google-analytics.com', | 56 'google-analytics.com', |
| 26 'google-syndication.com', | 57 'google-syndication.com', |
| 27 'google.ac', | 58 'google.ac', |
| 28 'google.ad', | 59 'google.ad', |
| 29 'google.ae', | 60 'google.ae', |
| 30 'google.af', | 61 'google.af', |
| 31 'google.ag', | 62 'google.ag', |
| 32 'google.al', | 63 'google.al', |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 return 1 | 546 return 1 |
| 516 | 547 |
| 517 with open(cpp_file, 'wb') as f: | 548 with open(cpp_file, 'wb') as f: |
| 518 f.write(cpp_code) | 549 f.write(cpp_code) |
| 519 | 550 |
| 520 return 0 | 551 return 0 |
| 521 | 552 |
| 522 | 553 |
| 523 if __name__ == '__main__': | 554 if __name__ == '__main__': |
| 524 sys.exit(main()) | 555 sys.exit(main()) |
| OLD | NEW |