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 # Generates the hashed_ad_networks.[h,cc] files. Takes an input the name of a | 6 # Generates the hashed_ad_networks.[h,cc] files. Takes an input the name of a |
7 # file with all ad network host patterns, new-line separated. If given an | 7 # file with all ad network host patterns, new-line separated. If given an |
8 # optional root output file name, generates the files <root_output_name>.h and | 8 # optional root output file name, generates the files <root_output_name>.h and |
9 # <root_output_name>.cc. If no output name is given, the output name is | 9 # <root_output_name>.cc. If no output name is given, the output name is |
10 # 'hashed_ad_networks'. | 10 # 'hashed_ad_networks'. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 ''' | 45 ''' |
46 | 46 |
47 _CC_TEMPLATE = '''\ | 47 _CC_TEMPLATE = '''\ |
48 %(license)s | 48 %(license)s |
49 #include "chrome/browser/extensions/activity_log/hashed_ad_networks.h" | 49 #include "chrome/browser/extensions/activity_log/hashed_ad_networks.h" |
50 | 50 |
51 #include "base/basictypes.h" | 51 #include "base/basictypes.h" |
52 | 52 |
53 namespace extensions { | 53 namespace extensions { |
54 | 54 |
55 const char* kHashedAdNetworks[] = { | 55 const char* const kHashedAdNetworks[] = { |
56 %(ad_networks)s | 56 %(ad_networks)s |
57 }; | 57 }; |
58 | 58 |
59 const int kNumHashedAdNetworks = arraysize(kHashedAdNetworks); | 59 const int kNumHashedAdNetworks = arraysize(kHashedAdNetworks); |
60 | 60 |
61 } // namespace extensions | 61 } // namespace extensions |
62 ''' | 62 ''' |
63 | 63 |
64 | 64 |
65 def Generate(input_filename, output_root_filename): | 65 def Generate(input_filename, output_root_filename): |
(...skipping 27 matching lines...) Expand all Loading... |
93 parser.add_argument( | 93 parser.add_argument( |
94 'input_file', | 94 'input_file', |
95 help='The name of the input file with the hosts to be hashed') | 95 help='The name of the input file with the hosts to be hashed') |
96 parser.add_argument( | 96 parser.add_argument( |
97 '-o', '--out', | 97 '-o', '--out', |
98 help='The root name of the output source file', | 98 help='The root name of the output source file', |
99 default='hashed_ad_networks') | 99 default='hashed_ad_networks') |
100 | 100 |
101 args = parser.parse_args() | 101 args = parser.parse_args() |
102 Generate(args.input_file, args.out) | 102 Generate(args.input_file, args.out) |
OLD | NEW |