1# Copyright 2014 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5if (is_android) {
6  import("//build/config/android/config.gni")
7  autofill_enable_sync = !is_android_webview_build
8} else {
9  autofill_enable_sync = true
10}
11
12config("autofill_browser_config") {
13  if (autofill_enable_sync) {
14    defines = [ "AUTOFILL_ENABLE_SYNC" ]
15  }
16}
17
18# GYP version: components/autofill.gyp:autofill_regexes
19action("regexes") {
20  visibility = [ "//components/autofill/*" ]
21  script = "//build/escape_unicode.py"
22
23  inputs = [
24    "autofill_regex_constants.cc.utf8",
25  ]
26  outputs = [
27    "$target_gen_dir/autofill_regex_constants.cc",
28  ]
29
30  args = [ "-o", rebase_path(target_gen_dir, root_build_dir) ]
31  args += rebase_path(inputs, root_build_dir)
32}
33
34# GYP version: components/autofill.gyp:autofill_core_browser
35static_library("browser") {
36  sources = [
37    "address.cc",
38    "address.h",
39    "address_field.cc",
40    "address_field.h",
41    "address_i18n.cc",
42    "address_i18n.h",
43    "autocomplete_history_manager.cc",
44    "autocomplete_history_manager.h",
45    "autofill-inl.h",
46    "autofill_country.cc",
47    "autofill_country.h",
48    "autofill_data_model.cc",
49    "autofill_data_model.h",
50    "autofill_download_manager.cc",
51    "autofill_download_manager.h",
52    "autofill_driver.h",
53    "autofill_external_delegate.cc",
54    "autofill_external_delegate.h",
55    "autofill_field.cc",
56    "autofill_field.h",
57    "autofill_ie_toolbar_import_win.cc",
58    "autofill_ie_toolbar_import_win.h",
59    "autofill_manager.cc",
60    "autofill_manager.h",
61    "autofill_client.h",
62    "autofill_manager_test_delegate.h",
63    "autofill_metrics.cc",
64    "autofill_metrics.h",
65    "autofill_popup_delegate.h",
66    "autofill_profile.cc",
67    "autofill_profile.h",
68    "autofill_regex_constants.cc.utf8",
69    "autofill_regex_constants.h",
70    "autofill_regexes.cc",
71    "autofill_regexes.h",
72    "autofill_scanner.cc",
73    "autofill_scanner.h",
74    "autofill_server_field_info.h",
75    "autofill_type.cc",
76    "autofill_type.h",
77    "autofill_xml_parser.cc",
78    "autofill_xml_parser.h",
79    "contact_info.cc",
80    "contact_info.h",
81    "credit_card.cc",
82    "credit_card.h",
83    "credit_card_field.cc",
84    "credit_card_field.h",
85    "email_field.cc",
86    "email_field.h",
87    "field_types.h",
88    "form_field.cc",
89    "form_field.h",
90    "form_group.cc",
91    "form_group.h",
92    "form_structure.cc",
93    "form_structure.h",
94    "name_field.cc",
95    "name_field.h",
96    "password_generator.cc",
97    "password_generator.h",
98    "personal_data_manager.cc",
99    "personal_data_manager.h",
100    "personal_data_manager_mac.mm",
101    "personal_data_manager_observer.h",
102    "phone_field.cc",
103    "phone_field.h",
104    "phone_number.cc",
105    "phone_number.h",
106    "phone_number_i18n.cc",
107    "phone_number_i18n.h",
108    "popup_item_ids.h",
109    "state_names.cc",
110    "state_names.h",
111    "validation.cc",
112    "validation.h",
113    "webdata/autofill_change.cc",
114    "webdata/autofill_change.h",
115    "webdata/autofill_entry.cc",
116    "webdata/autofill_entry.h",
117    "webdata/autofill_profile_syncable_service.cc",
118    "webdata/autofill_profile_syncable_service.h",
119    "webdata/autofill_table.cc",
120    "webdata/autofill_table.h",
121    "webdata/autofill_webdata.h",
122    "webdata/autofill_webdata_backend.h",
123    "webdata/autofill_webdata_backend_impl.cc",
124    "webdata/autofill_webdata_backend_impl.h",
125    "webdata/autofill_webdata_service.cc",
126    "webdata/autofill_webdata_service.h",
127    "webdata/autofill_webdata_service_observer.h",
128  ]
129
130  # Compile the generated regex file.
131  sources += get_target_outputs(":regexes")
132
133  deps = [
134    ":regexes",
135    "//base",
136    "//base:i18n",
137    "//base:prefs",
138    "//components/autofill/core/common",
139    "//components/keyed_service/core",
140    "//components/os_crypt",
141    "//components/pref_registry",
142    "//components/resources",
143    "//components/strings",
144    "//components/webdata/common",
145    "//google_apis",
146    "//skia",
147    "//sql",
148    "//third_party/fips181",
149    "//third_party/icu",
150    "//third_party/libaddressinput:util",
151    "//third_party/libphonenumber",
152    "//third_party/libjingle",
153    "//ui/base",
154    "//ui/gfx",
155    "//ui/gfx/geometry",
156    "//url",
157  ]
158
159  public_configs = [ ":autofill_browser_config" ]
160
161  if (autofill_enable_sync) {
162    deps += [ "//sync" ]
163  } else {
164    sources -= [
165      "webdata/autofill_profile_syncable_service.cc",
166      "webdata/autofill_profile_syncable_service.h",
167    ]
168  }
169
170  if (is_win) {
171    # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
172    cflags = [ "/wd4267" ]
173  }
174}
175
176static_library("test_support") {
177  testonly = true
178  sources = [
179    "autofill_test_utils.cc",
180    "autofill_test_utils.h",
181    "data_driven_test.cc",
182    "data_driven_test.h",
183    "test_autofill_client.cc",
184    "test_autofill_client.h",
185    "test_autofill_driver.cc",
186    "test_autofill_driver.h",
187    "test_autofill_external_delegate.cc",
188    "test_autofill_external_delegate.h",
189    "test_personal_data_manager.cc",
190    "test_personal_data_manager.h",
191  ]
192
193  deps = [
194    ":browser",
195    "//components/autofill/core/browser",
196    "//components/autofill/core/common",
197    "//skia",
198    "//testing/gtest",
199  ]
200}
201
202source_set("unit_tests") {
203  testonly = true
204  sources = [
205    "address_field_unittest.cc",
206    "address_unittest.cc",
207    "autocomplete_history_manager_unittest.cc",
208    "autofill_country_unittest.cc",
209    "autofill_data_model_unittest.cc",
210    "autofill_download_manager_unittest.cc",
211    "autofill_external_delegate_unittest.cc",
212    "autofill_field_unittest.cc",
213    "autofill_ie_toolbar_import_win_unittest.cc",
214    "autofill_manager_unittest.cc",
215    "autofill_merge_unittest.cc",
216    "autofill_metrics_unittest.cc",
217    "autofill_profile_unittest.cc",
218    "autofill_regexes_unittest.cc",
219    "autofill_type_unittest.cc",
220    "autofill_xml_parser_unittest.cc",
221    "contact_info_unittest.cc",
222    "credit_card_field_unittest.cc",
223    "credit_card_unittest.cc",
224    "form_field_unittest.cc",
225    "form_structure_unittest.cc",
226    "name_field_unittest.cc",
227    "password_generator_unittest.cc",
228    "personal_data_manager_unittest.cc",
229    "phone_field_unittest.cc",
230    "phone_number_i18n_unittest.cc",
231    "phone_number_unittest.cc",
232    "validation_unittest.cc",
233    "webdata/autofill_profile_syncable_service_unittest.cc",
234    "webdata/autofill_table_unittest.cc",
235    "webdata/web_data_service_unittest.cc",
236  ]
237
238  deps = [
239    ":browser",
240    ":test_support",
241    "//components/resources",
242    "//components/strings",
243    "//testing/gmock",
244    "//third_party/libphonenumber",
245    "//third_party/libjingle"
246  ]
247}
248