1# Copyright 2016 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
5import("//third_party/protobuf/proto_library.gni")
6
7static_library("features") {
8  sources = [
9    "features.cc",
10    "features.h",
11  ]
12
13  deps = [
14    "//base:base",
15    "//components/safe_browsing:buildflags",
16  ]
17}
18
19# Because csd.proto is included from a proto file outside its own directory,
20# proto_in_dir is required so that import can follow the Chromium style guide
21# that all imports start from the source root.
22#
23# However, due to the way that protoc generates C++ code, this directive is
24# also required in all build targets for protos that import csd.proto, including
25# the protos in the same directory.  Those protos also need to import csd.proto
26# using a path from the source root, otherwise they won't compile.
27
28proto_library("csd_proto") {
29  proto_in_dir = "//"
30  sources = [ "proto/csd.proto" ]
31}
32
33proto_library("webui_proto") {
34  sources = [ "proto/webui.proto" ]
35}
36
37proto_library("realtimeapi_proto") {
38  proto_in_dir = "//"
39  sources = [ "proto/realtimeapi.proto" ]
40  deps = [ ":csd_proto" ]
41}
42
43proto_library("client_model_proto") {
44  proto_in_dir = "//"
45  sources = [ "proto/client_model.proto" ]
46  deps = [ ":csd_proto" ]
47}
48
49static_library("ping_manager") {
50  sources = [
51    "ping_manager.cc",
52    "ping_manager.h",
53  ]
54
55  public_deps = [ "//google_apis:google_apis" ]
56
57  deps = [
58    "//base:base",
59    "//components/safe_browsing/core/db:hit_report",
60    "//components/safe_browsing/core/db:util",
61    "//net:net",
62    "//services/network/public/cpp",
63  ]
64}
65
66source_set("ping_manager_unittest") {
67  testonly = true
68  sources = [ "ping_manager_unittest.cc" ]
69
70  deps = [
71    ":ping_manager",
72    "//base:base",
73    "//components/safe_browsing/core/db:v4_test_util",
74    "//net:net",
75    "//net:test_support",
76    "//testing/gtest",
77  ]
78}
79
80source_set("verdict_cache_manager") {
81  sources = [
82    "verdict_cache_manager.cc",
83    "verdict_cache_manager.h",
84  ]
85
86  deps = [
87    ":csd_proto",
88    ":realtimeapi_proto",
89    "//base",
90    "//components/content_settings/core/browser",
91    "//components/history/core/browser",
92    "//components/keyed_service/core:core",
93    "//components/password_manager/core/browser:browser",
94    "//components/safe_browsing/core/common:thread_utils",
95    "//components/safe_browsing/core/db:v4_protocol_manager_util",
96    "//url",
97  ]
98}
99
100source_set("verdict_cache_manager_unittest") {
101  testonly = true
102  sources = [ "verdict_cache_manager_unittest.cc" ]
103
104  deps = [
105    ":csd_proto",
106    ":realtimeapi_proto",
107    ":verdict_cache_manager",
108    "//base",
109    "//base/test:test_support",
110    "//components/content_settings/core/browser",
111    "//components/safe_browsing/core/common:test_support",
112    "//components/sync_preferences:test_support",
113    "//testing/gtest",
114  ]
115}
116
117# safe_browsing/ pulls in content/, which doesn't work on iOS.
118# TODO(thakis): This should be `safe_browsing_mode != 0`, but chromecast builds
119# set safe_browsing_mode to 0 and build chrome/, and chrome/ currently
120# unconditionally depends on things in this build file. Make these dependencies
121# conditional on safe_browsing_mode != 0 and then change the conditional here.
122if (!is_ios) {
123  assert(!is_ios, "safe_browsing/ pulls in content/ which doesn't work on iOS")
124
125  source_set("public") {
126    sources = [
127      "safe_browsing_service_interface.cc",
128      "safe_browsing_service_interface.h",
129    ]
130
131    deps = [
132      "//base:base",
133      "//content/public/browser",
134    ]
135  }
136}
137
138# These files have no content/ dependency, but we still aren't building them on
139# on iOS since we don't ship download protection on that platform.
140# TODO(crbug/1056278): Enable this on Fuchsia
141if (!is_ios && !is_fuchsia) {
142  proto_library("download_file_types_proto") {
143    sources = [ "proto/download_file_types.proto" ]
144  }
145
146  source_set("file_type_policies") {
147    sources = [
148      "file_type_policies.cc",
149      "file_type_policies.h",
150    ]
151
152    public_deps = [ ":download_file_types_proto" ]
153
154    deps = [
155      "//base",
156      "//components/resources:components_resources",
157      "//ui/base",
158    ]
159  }
160
161  source_set("file_type_policies_test_support") {
162    testonly = true
163    sources = [
164      "file_type_policies_test_util.cc",
165      "file_type_policies_test_util.h",
166    ]
167
168    deps = [ ":file_type_policies" ]
169  }
170
171  source_set("file_type_policies_unittest") {
172    testonly = true
173    sources = [ "file_type_policies_unittest.cc" ]
174
175    deps = [
176      ":file_type_policies",
177      "//base:base",
178      "//testing/gmock:gmock",
179      "//testing/gtest:gtest",
180    ]
181  }
182}
183