• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2016 The Chromium Embedded Framework Authors. Portions copyright
2# 2014 the Chromium Authors. All rights reserved. Use of this source code is
3# governed by a BSD-style license that can be found in the LICENSE file.
4#
5# This file provides the GN configuration for the CEF project. This is not a
6# stand-alone configuration -- it must be built from inside the Chromium source
7# tree. See https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
8# for complete CEF build instructions. See below for links to additional GN
9# documentation.
10#
11# GN Setup:
12#
13#    Optionally configure GN by setting the `GN_DEFINES` and/or `GN_ARGUMENTS`
14#    environment variables.
15#
16#    Example A: Create an official build on Windows:
17#
18#      > set GN_DEFINES=is_official_build=true
19#
20#    Example B: Generate VS2017 project files in addition to the default Ninja
21#               build files on Windows:
22#
23#      > set GN_ARGUMENTS=--ide=vs2017 --sln=cef --filters=//cef/*
24#
25#      After completing the "GN Automated Build" or "GN Manual Build" section
26#      open "out\<build_dir>\cef.sln" for editing and debugging. Building must
27#      still be performed using the Ninja command-line.
28#
29# GN Automated Build:
30#
31#    Run the `automate-git.py` script as described on the BranchesAndBuilding
32#    Wiki page. GN, unlike GYP, supports parallel build configurations. The
33#    following command-line flags have special meaning with GN builds:
34#
35#    --x64-build    Perform an x64 build if specified (requires out/*_GN_x64
36#                   directories), otherwise perform an x86 build (requires
37#                   out/*_GN_x86 directories).
38#
39#    Directories are created subject to your platform and `GN_DEFINES` settings.
40#    See Step 1B in the "GN Manual Build" section below for details.
41#
42# GN Manual Build:
43#
44# 1. Run the `cef_create_projects.[bin|sh]` script. Upon successful completion
45#    proceed to Step 2.
46#
47#    The `cef_create_projects.[bin|sh]` script will automatically do all of the
48#    following:
49#
50#    A. Apply patch files to the Chromium source tree. This includes
51#       `patch/patches/gn_config.patch` which is required for GN integration.
52#
53#    B. Create multiple build output directories appropriate to your platform
54#       and `GN_DEFINES` settings. For example:
55#
56#         x86 debug build   -> out/Debug_GN_x86
57#         x86 release build -> out/Release_GN_x86
58#         x64 debug build   -> out/Debug_GN_x64
59#         x64 release build -> out/Release_GN_x64
60#
61#       Build output directories will be created subject to the following rules
62#       (defined in `tools/gn_args.py` GetAllPlatformConfigs):
63#
64#       - Debug and Release directories will be created on all platforms by
65#         default. Debug directories will not be created when `is_asan=true`.
66#       - x64 directories will always be created on all platforms.
67#       - x86 directories will always be created on Windows.
68#       - x86 directories will be created on Linux when `use_sysroot=true`.
69#
70#    C. Write the `args.gn` file for each build output directory using the
71#       `tools/gn_args.py` script to determine the GN arguments. Some arguments
72#       are required and some are optional. See script output for details in
73#       case of conflicts or recommendations.
74#
75#    D. Run `gn gen` for each build output directory to generate project files.
76#       Ninja files will be generated by default. Additional command-line
77#       arguments (including other project formats) can be specified via the
78#       `GN_ARGUMENTS` environment variable. Run `gn gen --help` for a list of
79#       supported arguments.
80#
81# 2. Run Ninja from the command-line to build. If the build configuration has
82#    changed it will automatically re-run `gn gen` with the same arguments.
83#
84#    > ninja -C out/<build_dir> cefclient cefsimple ceftests
85#
86# GN Manual Packaging:
87#
88#    Run the `make_distrib.[bat|sh]` script as described on the
89#    BranchesAndBuilding Wiki page.
90#
91# Additional GN documentation:
92# http://www.chromium.org/developers/gn-build-configuration
93# https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/language.md
94#
95
96import("//base/allocator/allocator.gni")
97import("//build/config/features.gni")
98import("//build/config/locales.gni")
99import("//build/config/ozone.gni")
100import("//build/config/sanitizers/sanitizers.gni")
101import("//build/config/ui.gni")
102import("//chrome/common/features.gni")
103import("//content/public/app/mac_helpers.gni")
104import("//extensions/buildflags/buildflags.gni")
105import("//media/media_options.gni")
106import("//mojo/public/tools/bindings/mojom.gni")
107import("//ppapi/buildflags/buildflags.gni")
108import("//printing/buildflags/buildflags.gni")
109import("//testing/test.gni")
110import("//third_party/icu/config.gni")
111import("//third_party/widevine/cdm/widevine.gni")
112import("//tools/grit/grit_rule.gni")
113import("//tools/grit/repack.gni")
114import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
115import("//ui/gl/features.gni")
116import("//v8/gni/v8.gni")
117if (is_clang) {
118  import("//build/config/clang/clang.gni")
119}
120if (is_linux) {
121  import("//build/config/linux/pkg_config.gni")
122  import("//third_party/fontconfig/fontconfig.gni")
123}
124if (is_mac) {
125  import("//build/apple/tweak_info_plist.gni")
126  import("//build/config/mac/rules.gni")
127  import("//build/util/version.gni")
128  import("//media/cdm/library_cdm/cdm_paths.gni")
129
130  # Template to compile .xib and .storyboard files.
131  #
132  # Arguments
133  #
134  #     sources:
135  #         list of string, sources to compile
136  #
137  #     ibtool_flags:
138  #         (optional) list of string, additional flags to pass to the ibtool
139  template("compile_ib_files") {
140    action_foreach(target_name) {
141      forward_variables_from(invoker,
142                             [
143                               "testonly",
144                               "visibility",
145                             ])
146      assert(defined(invoker.sources),
147             "sources must be specified for $target_name")
148      assert(defined(invoker.output_extension),
149             "output_extension must be specified for $target_name")
150
151      ibtool_flags = []
152      if (defined(invoker.ibtool_flags)) {
153        ibtool_flags = invoker.ibtool_flags
154      }
155
156      _output_extension = invoker.output_extension
157
158      script = "//cef/tools/compile_ib_files.py"
159      sources = invoker.sources
160      outputs = [
161        "$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension",
162      ]
163      args = [
164        "--input",
165        "{{source}}",
166        "--output",
167        rebase_path(
168            "$target_gen_dir/$target_name/{{source_name_part}}.$_output_extension",
169            root_build_dir),
170      ]
171      if (!use_system_xcode) {
172        args += [
173          "--developer_dir",
174          hermetic_xcode_path,
175        ]
176      }
177      args += ibtool_flags
178    }
179  }
180
181  # Template to compile and package Mac XIB files as bundle data.
182  #
183  # Arguments
184  #
185  #     sources:
186  #         list of string, sources to comiple
187  #
188  #     output_path:
189  #         (optional) string, the path to use for the outputs list in the
190  #         bundle_data step. If unspecified, defaults to bundle_resources_dir.
191  template("mac_xib_bundle_data") {
192    _target_name = target_name
193    _compile_target_name = _target_name + "_compile_ibtool"
194
195    compile_ib_files(_compile_target_name) {
196      forward_variables_from(invoker, [ "testonly" ])
197      visibility = [ ":$_target_name" ]
198      sources = invoker.sources
199      output_extension = "nib"
200      ibtool_flags = [
201        "--minimum-deployment-target",
202        mac_deployment_target,
203
204        # TODO(rsesek): Enable this once all the bots are on Xcode 7+.
205        # "--target-device",
206        # "mac",
207      ]
208    }
209
210    bundle_data(_target_name) {
211      forward_variables_from(invoker,
212                             [
213                               "testonly",
214                               "visibility",
215                             ])
216
217      public_deps = [ ":$_compile_target_name" ]
218      sources = get_target_outputs(":$_compile_target_name")
219
220      _output_path = "{{bundle_resources_dir}}"
221      if (defined(invoker.output_path)) {
222        _output_path = invoker.output_path
223      }
224
225      outputs = [ "$_output_path/{{source_file_part}}" ]
226    }
227  }
228}
229if (is_win) {
230  import("//build/config/win/console_app.gni")
231  import("//build/config/win/manifest.gni")
232}
233
234if (is_linux) {
235  declare_args() {
236    # The cefclient target depends on GTK packages that are not available in the
237    # default sysroot environment. So we should only use them when we are not
238    # using the sysroot. Alternatively, the developer might not want to use the
239    # GTK dependencies at all, in which case they can set `cef_use_gtk=false`.
240    cef_use_gtk = !use_sysroot
241  }
242}
243
244#
245# Verify required global arguments configured via `gn args`.
246# Set by GetRequiredArgs() in //cef/tools/gn_args.py.
247#
248
249# Set ENABLE_PRINTING=1 ENABLE_BASIC_PRINTING=1.
250assert(enable_basic_printing)
251assert(enable_print_preview)
252
253# Enable support for Widevine CDM.
254assert(enable_widevine)
255
256if (is_clang) {
257  # Don't use the chrome style plugin.
258  assert(!clang_use_chrome_plugins)
259}
260
261#
262# Local variables.
263#
264
265if (is_mac) {
266  # The tweak_info_plist.py script requires a version number with 4 parts. CEF
267  # uses a version number with 3 parts so just set the last part to 0.
268  cef_plist_version =
269      exec_script("//cef/tools/cef_version.py", [ "plist" ], "trim string", [])
270
271  # Need to be creative to match dylib version formatting requirements.
272  cef_dylib_version =
273      exec_script("//cef/tools/cef_version.py", [ "dylib" ], "trim string", [])
274}
275
276# Read file lists from gypi files. The gypi_to_gn.py script does not support
277# variable references so all required variables must be explicitly specified in
278# the below configurations.
279gypi_paths = exec_script("//cef/tools/gypi_to_gn.py",
280                         [ rebase_path("cef_paths.gypi") ],
281                         "scope",
282                         [ "cef_paths.gypi" ])
283gypi_paths2 = exec_script("//cef/tools/gypi_to_gn.py",
284                          [ rebase_path("cef_paths2.gypi") ],
285                          "scope",
286                          [ "cef_paths2.gypi" ])
287
288includes_common = gypi_paths2.includes_common + gypi_paths2.includes_common_capi
289includes_mac = gypi_paths2.includes_mac + gypi_paths2.includes_mac_capi
290includes_linux = gypi_paths2.includes_linux + gypi_paths2.includes_linux_capi
291includes_win = gypi_paths2.includes_win + gypi_paths2.includes_win_capi
292
293#
294# Targets that will be built when depending on "//cef".
295#
296
297group("cef") {
298  testonly = true
299  deps = [
300    ":cefsimple",
301    ":ceftests",
302    ":libcef_static_unittests",
303  ]
304
305  if (!is_linux || ozone_platform_x11) {
306    deps += [ ":cefclient" ]
307  }
308}
309
310#
311# libcef static target.
312#
313
314if (is_win) {
315  # Target for building code that accesses chrome_elf internals. Included from
316  # the //chrome_elf:crash target. Defined as a static_library instead of a
317  # source_set because (a) the source files don't export any symbols and (b)
318  # *_switches.cc duplication otherwise causes linker errors.
319  static_library("chrome_elf_set") {
320    sources = [
321      "libcef/common/crash_reporter_client.cc",
322      "libcef/common/crash_reporter_client.h",
323
324      # Required for crash_keys::GetChromeCrashKeys.
325      # Otherwise we need to copy this array into CEF, which would be difficult
326      # to maintain.
327      "//chrome/common/chrome_switches.cc",
328      "//chrome/common/crash_keys.cc",
329      "//components/flags_ui/flags_ui_switches.cc",
330      "//content/public/common/content_switches.cc",
331    ]
332
333    configs += [
334      "libcef/features:config",
335      "//build/config:precompiled_headers",
336    ]
337
338    if (is_component_build) {
339      # Avoid linker errors with content_switches.cc in component build by not
340      # defining CONTENT_EXPORT.
341      defines = [ "COMPILE_CONTENT_STATICALLY" ]
342    }
343
344    deps = [
345      "//components/crash/core/common",  # crash_keys
346
347      # Required by chrome_switches.cc
348      "//chrome/common:buildflags",
349      "//ppapi/buildflags:buildflags",
350      "//printing/buildflags:buildflags",
351      "//ui/base:buildflags",
352
353      # Required by content_switches.cc
354      "//media:media_buildflags",
355
356      # Required by crash_keys.cc (from base/stl_util.h)
357      "//third_party/abseil-cpp:absl",
358    ]
359  }
360}
361
362# libcef_static source files that have unit tests.
363source_set("libcef_static_unittested") {
364  sources = [
365    "libcef/browser/devtools/devtools_util.cc",
366    "libcef/browser/devtools/devtools_util.h",
367  ]
368
369  deps = [ "//base" ]
370
371  configs += [
372    "libcef/features:config",
373    "//build/config:precompiled_headers",
374  ]
375}
376
377# Executable target for libcef_static unit tests.
378test("libcef_static_unittests") {
379  sources = [ "libcef/browser/devtools/devtools_util_unittest.cc" ]
380
381  deps = [
382    ":libcef_static_unittested",
383    "//base/test:run_all_unittests",
384    "//testing/gtest",
385  ]
386
387  configs += [
388    "libcef/features:config",
389    "//build/config:precompiled_headers",
390  ]
391}
392
393static_library("libcef_static") {
394  sources = includes_common + gypi_paths.autogen_cpp_includes + [
395              "libcef/browser/alloy/alloy_browser_context.cc",
396              "libcef/browser/alloy/alloy_browser_context.h",
397              "libcef/browser/alloy/alloy_browser_host_impl.cc",
398              "libcef/browser/alloy/alloy_browser_host_impl.h",
399              "libcef/browser/alloy/alloy_browser_main.cc",
400              "libcef/browser/alloy/alloy_browser_main.h",
401              "libcef/browser/alloy/alloy_content_browser_client.cc",
402              "libcef/browser/alloy/alloy_content_browser_client.h",
403              "libcef/browser/alloy/alloy_dialog_util.cc",
404              "libcef/browser/alloy/alloy_dialog_util.h",
405              "libcef/browser/alloy/alloy_download_util.cc",
406              "libcef/browser/alloy/alloy_download_util.h",
407              "libcef/browser/alloy/browser_platform_delegate_alloy.cc",
408              "libcef/browser/alloy/browser_platform_delegate_alloy.h",
409              "libcef/browser/alloy/chrome_browser_process_alloy.cc",
410              "libcef/browser/alloy/chrome_browser_process_alloy.h",
411              "libcef/browser/alloy/chrome_profile_manager_alloy.cc",
412              "libcef/browser/alloy/chrome_profile_manager_alloy.h",
413              "libcef/browser/alloy/chrome_profile_alloy.cc",
414              "libcef/browser/alloy/chrome_profile_alloy.h",
415              "libcef/browser/audio_capturer.cc",
416              "libcef/browser/audio_capturer.h",
417              "libcef/browser/audio_loopback_stream_creator.cc",
418              "libcef/browser/audio_loopback_stream_creator.h",
419              "libcef/browser/browser_contents_delegate.cc",
420              "libcef/browser/browser_contents_delegate.h",
421              "libcef/browser/browser_context.cc",
422              "libcef/browser/browser_context.h",
423              "libcef/browser/browser_context_keyed_service_factories.cc",
424              "libcef/browser/browser_context_keyed_service_factories.h",
425              "libcef/browser/browser_frame.cc",
426              "libcef/browser/browser_frame.h",
427              "libcef/browser/browser_host_base.cc",
428              "libcef/browser/browser_host_base.h",
429              "libcef/browser/browser_host_create.cc",
430              "libcef/browser/browser_info.cc",
431              "libcef/browser/browser_info.h",
432              "libcef/browser/browser_info_manager.cc",
433              "libcef/browser/browser_info_manager.h",
434              "libcef/browser/browser_manager.cc",
435              "libcef/browser/browser_manager.h",
436              "libcef/browser/browser_message_loop.cc",
437              "libcef/browser/browser_message_loop.h",
438              "libcef/browser/browser_platform_delegate.cc",
439              "libcef/browser/browser_platform_delegate.h",
440              "libcef/browser/browser_platform_delegate_create.cc",
441              "libcef/browser/browser_util.cc",
442              "libcef/browser/browser_util.h",
443              "libcef/browser/chrome/browser_delegate.h",
444              "libcef/browser/chrome/browser_platform_delegate_chrome.cc",
445              "libcef/browser/chrome/browser_platform_delegate_chrome.h",
446              "libcef/browser/chrome/chrome_browser_context.cc",
447              "libcef/browser/chrome/chrome_browser_context.h",
448              "libcef/browser/chrome/chrome_browser_delegate.cc",
449              "libcef/browser/chrome/chrome_browser_delegate.h",
450              "libcef/browser/chrome/chrome_browser_host_impl.cc",
451              "libcef/browser/chrome/chrome_browser_host_impl.h",
452              "libcef/browser/chrome/chrome_browser_main_extra_parts_cef.cc",
453              "libcef/browser/chrome/chrome_browser_main_extra_parts_cef.h",
454              "libcef/browser/chrome/chrome_content_browser_client_cef.cc",
455              "libcef/browser/chrome/chrome_content_browser_client_cef.h",
456              "libcef/browser/chrome/chrome_context_menu_handler.cc",
457              "libcef/browser/chrome/chrome_context_menu_handler.h",
458              "libcef/browser/chrome_crash_reporter_client_stub.cc",
459              "libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.cc",
460              "libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.h",
461              "libcef/browser/context.cc",
462              "libcef/browser/context.h",
463              "libcef/browser/context_menu_params_impl.cc",
464              "libcef/browser/context_menu_params_impl.h",
465              "libcef/browser/devtools/devtools_controller.cc",
466              "libcef/browser/devtools/devtools_controller.h",
467              "libcef/browser/devtools/devtools_file_manager.cc",
468              "libcef/browser/devtools/devtools_file_manager.h",
469              "libcef/browser/devtools/devtools_frontend.cc",
470              "libcef/browser/devtools/devtools_frontend.h",
471              "libcef/browser/devtools/devtools_manager.cc",
472              "libcef/browser/devtools/devtools_manager.h",
473              "libcef/browser/devtools/devtools_manager_delegate.cc",
474              "libcef/browser/devtools/devtools_manager_delegate.h",
475              "libcef/browser/download_item_impl.cc",
476              "libcef/browser/download_item_impl.h",
477              "libcef/browser/download_manager_delegate.cc",
478              "libcef/browser/download_manager_delegate.h",
479              "libcef/browser/extension_impl.cc",
480              "libcef/browser/extension_impl.h",
481              "libcef/browser/extensions/api/file_system/cef_file_system_delegate.cc",
482              "libcef/browser/extensions/api/file_system/cef_file_system_delegate.h",
483              "libcef/browser/extensions/api/storage/sync_value_store_cache.cc",
484              "libcef/browser/extensions/api/storage/sync_value_store_cache.h",
485              "libcef/browser/extensions/api/tabs/tabs_api.cc",
486              "libcef/browser/extensions/api/tabs/tabs_api.h",
487              "libcef/browser/extensions/alloy_extensions_util.cc",
488              "libcef/browser/extensions/alloy_extensions_util.h",
489              "libcef/browser/extensions/browser_extensions_util.cc",
490              "libcef/browser/extensions/browser_extensions_util.h",
491              "libcef/browser/extensions/browser_platform_delegate_background.cc",
492              "libcef/browser/extensions/browser_platform_delegate_background.h",
493              "libcef/browser/extensions/chrome_api_registration.cc",
494              "libcef/browser/extensions/chrome_api_registration.h",
495              "libcef/browser/extensions/component_extension_resource_manager.cc",
496              "libcef/browser/extensions/component_extension_resource_manager.h",
497              "libcef/browser/extensions/extensions_api_client.cc",
498              "libcef/browser/extensions/extensions_api_client.h",
499              "libcef/browser/extensions/extensions_browser_api_provider.cc",
500              "libcef/browser/extensions/extensions_browser_api_provider.h",
501              "libcef/browser/extensions/extensions_browser_client.cc",
502              "libcef/browser/extensions/extensions_browser_client.h",
503              "libcef/browser/extensions/extension_background_host.cc",
504              "libcef/browser/extensions/extension_background_host.h",
505              "libcef/browser/extensions/extension_function_details.cc",
506              "libcef/browser/extensions/extension_function_details.h",
507              "libcef/browser/extensions/extension_host_delegate.cc",
508              "libcef/browser/extensions/extension_host_delegate.h",
509              "libcef/browser/extensions/extension_system.cc",
510              "libcef/browser/extensions/extension_system.h",
511              "libcef/browser/extensions/extension_system_factory.cc",
512              "libcef/browser/extensions/extension_system_factory.h",
513              "libcef/browser/extensions/extension_view_host.cc",
514              "libcef/browser/extensions/extension_view_host.h",
515              "libcef/browser/extensions/extension_web_contents_observer.cc",
516              "libcef/browser/extensions/extension_web_contents_observer.h",
517              "libcef/browser/extensions/mime_handler_view_guest_delegate.cc",
518              "libcef/browser/extensions/mime_handler_view_guest_delegate.h",
519              "libcef/browser/extensions/value_store/cef_value_store.cc",
520              "libcef/browser/extensions/value_store/cef_value_store.h",
521              "libcef/browser/extensions/value_store/cef_value_store_factory.cc",
522              "libcef/browser/extensions/value_store/cef_value_store_factory.h",
523              "libcef/browser/file_dialog_runner.h",
524              "libcef/browser/file_dialog_manager.cc",
525              "libcef/browser/file_dialog_manager.h",
526              "libcef/browser/frame_host_impl.cc",
527              "libcef/browser/frame_host_impl.h",
528              "libcef/browser/frame_service_base.h",
529              "libcef/browser/image_impl.cc",
530              "libcef/browser/image_impl.h",
531              "libcef/browser/iothread_state.cc",
532              "libcef/browser/iothread_state.h",
533              "libcef/browser/javascript_dialog_runner.h",
534              "libcef/browser/javascript_dialog_manager.cc",
535              "libcef/browser/javascript_dialog_manager.h",
536              "libcef/browser/main_runner.cc",
537              "libcef/browser/main_runner.h",
538              "libcef/browser/media_capture_devices_dispatcher.cc",
539              "libcef/browser/media_capture_devices_dispatcher.h",
540              "libcef/browser/media_router/media_route_impl.cc",
541              "libcef/browser/media_router/media_route_impl.h",
542              "libcef/browser/media_router/media_router_impl.cc",
543              "libcef/browser/media_router/media_router_impl.h",
544              "libcef/browser/media_router/media_router_manager.cc",
545              "libcef/browser/media_router/media_router_manager.h",
546              "libcef/browser/media_router/media_sink_impl.cc",
547              "libcef/browser/media_router/media_sink_impl.h",
548              "libcef/browser/media_router/media_source_impl.cc",
549              "libcef/browser/media_router/media_source_impl.h",
550              "libcef/browser/menu_manager.cc",
551              "libcef/browser/menu_manager.h",
552              "libcef/browser/menu_model_impl.cc",
553              "libcef/browser/menu_model_impl.h",
554              "libcef/browser/menu_runner.h",
555              "libcef/browser/native/browser_platform_delegate_native.cc",
556              "libcef/browser/native/browser_platform_delegate_native.h",
557              "libcef/browser/native/cursor_util.h",
558              "libcef/browser/native/cursor_util.cc",
559              "libcef/browser/navigation_entry_impl.cc",
560              "libcef/browser/navigation_entry_impl.h",
561              "libcef/browser/net/chrome_scheme_handler.cc",
562              "libcef/browser/net/chrome_scheme_handler.h",
563              "libcef/browser/net/crlset_file_util_impl.cc",
564              "libcef/browser/net/devtools_scheme_handler.cc",
565              "libcef/browser/net/devtools_scheme_handler.h",
566              "libcef/browser/net/internal_scheme_handler.cc",
567              "libcef/browser/net/internal_scheme_handler.h",
568              "libcef/browser/net/scheme_handler.cc",
569              "libcef/browser/net/scheme_handler.h",
570              "libcef/browser/net/throttle_handler.cc",
571              "libcef/browser/net/throttle_handler.h",
572              "libcef/browser/net_service/browser_urlrequest_impl.cc",
573              "libcef/browser/net_service/browser_urlrequest_impl.h",
574              "libcef/browser/net_service/cookie_helper.cc",
575              "libcef/browser/net_service/cookie_helper.h",
576              "libcef/browser/net_service/cookie_manager_impl.cc",
577              "libcef/browser/net_service/cookie_manager_impl.h",
578              "libcef/browser/net_service/login_delegate.cc",
579              "libcef/browser/net_service/login_delegate.h",
580              "libcef/browser/net_service/proxy_url_loader_factory.cc",
581              "libcef/browser/net_service/proxy_url_loader_factory.h",
582              "libcef/browser/net_service/resource_handler_wrapper.cc",
583              "libcef/browser/net_service/resource_handler_wrapper.h",
584              "libcef/browser/net_service/resource_request_handler_wrapper.cc",
585              "libcef/browser/net_service/resource_request_handler_wrapper.h",
586              "libcef/browser/net_service/response_filter_wrapper.cc",
587              "libcef/browser/net_service/response_filter_wrapper.h",
588              "libcef/browser/net_service/stream_reader_url_loader.cc",
589              "libcef/browser/net_service/stream_reader_url_loader.h",
590              "libcef/browser/net_service/url_loader_factory_getter.cc",
591              "libcef/browser/net_service/url_loader_factory_getter.h",
592              "libcef/browser/origin_whitelist_impl.cc",
593              "libcef/browser/origin_whitelist_impl.h",
594              "libcef/browser/osr/browser_platform_delegate_osr.cc",
595              "libcef/browser/osr/browser_platform_delegate_osr.h",
596              "libcef/browser/osr/host_display_client_osr.cc",
597              "libcef/browser/osr/host_display_client_osr.h",
598              "libcef/browser/osr/motion_event_osr.cc",
599              "libcef/browser/osr/motion_event_osr.h",
600              "libcef/browser/osr/osr_accessibility_util.cc",
601              "libcef/browser/osr/osr_accessibility_util.h",
602              "libcef/browser/osr/osr_util.cc",
603              "libcef/browser/osr/osr_util.h",
604              "libcef/browser/osr/render_widget_host_view_osr.cc",
605              "libcef/browser/osr/render_widget_host_view_osr.h",
606              "libcef/browser/osr/synthetic_gesture_target_osr.cc",
607              "libcef/browser/osr/synthetic_gesture_target_osr.h",
608              "libcef/browser/osr/video_consumer_osr.cc",
609              "libcef/browser/osr/video_consumer_osr.h",
610              "libcef/browser/osr/web_contents_view_osr.cc",
611              "libcef/browser/osr/web_contents_view_osr.h",
612              "libcef/browser/path_util_impl.cc",
613              "libcef/browser/prefs/browser_prefs.cc",
614              "libcef/browser/prefs/browser_prefs.h",
615              "libcef/browser/prefs/pref_store.cc",
616              "libcef/browser/prefs/pref_store.h",
617              "libcef/browser/prefs/renderer_prefs.cc",
618              "libcef/browser/prefs/renderer_prefs.h",
619              "libcef/browser/print_settings_impl.cc",
620              "libcef/browser/print_settings_impl.h",
621              "libcef/browser/printing/constrained_window_views_client.cc",
622              "libcef/browser/printing/constrained_window_views_client.h",
623              "libcef/browser/printing/print_view_manager.cc",
624              "libcef/browser/printing/print_view_manager.h",
625              "libcef/browser/process_util_impl.cc",
626              "libcef/browser/request_context_handler_map.cc",
627              "libcef/browser/request_context_handler_map.h",
628              "libcef/browser/request_context_impl.cc",
629              "libcef/browser/request_context_impl.h",
630              "libcef/browser/scheme_impl.cc",
631              "libcef/browser/server_impl.cc",
632              "libcef/browser/server_impl.h",
633              "libcef/browser/simple_menu_model_impl.cc",
634              "libcef/browser/simple_menu_model_impl.h",
635              "libcef/browser/speech_recognition_manager_delegate.cc",
636              "libcef/browser/speech_recognition_manager_delegate.h",
637              "libcef/browser/ssl_host_state_delegate.cc",
638              "libcef/browser/ssl_host_state_delegate.h",
639              "libcef/browser/ssl_info_impl.cc",
640              "libcef/browser/ssl_info_impl.h",
641              "libcef/browser/ssl_status_impl.cc",
642              "libcef/browser/ssl_status_impl.h",
643              "libcef/browser/stream_impl.cc",
644              "libcef/browser/stream_impl.h",
645              "libcef/browser/trace_impl.cc",
646              "libcef/browser/trace_subscriber.cc",
647              "libcef/browser/trace_subscriber.h",
648              "libcef/browser/thread_util.h",
649              "libcef/browser/web_contents_dialog_helper.cc",
650              "libcef/browser/web_contents_dialog_helper.h",
651              "libcef/browser/web_plugin_impl.cc",
652              "libcef/browser/web_plugin_impl.h",
653              "libcef/browser/x509_certificate_impl.cc",
654              "libcef/browser/x509_certificate_impl.h",
655              "libcef/browser/x509_cert_principal_impl.cc",
656              "libcef/browser/x509_cert_principal_impl.h",
657              "libcef/browser/xml_reader_impl.cc",
658              "libcef/browser/xml_reader_impl.h",
659              "libcef/browser/zip_reader_impl.cc",
660              "libcef/browser/zip_reader_impl.h",
661              "libcef/common/alloy/alloy_content_client.cc",
662              "libcef/common/alloy/alloy_content_client.h",
663              "libcef/common/alloy/alloy_main_delegate.cc",
664              "libcef/common/alloy/alloy_main_delegate.h",
665              "libcef/common/alloy/alloy_main_runner_delegate.cc",
666              "libcef/common/alloy/alloy_main_runner_delegate.h",
667              "libcef/common/app_manager.cc",
668              "libcef/common/app_manager.h",
669              "libcef/common/base_impl.cc",
670              "libcef/common/cef_switches.cc",
671              "libcef/common/cef_switches.h",
672              "libcef/common/chrome/chrome_content_client_cef.cc",
673              "libcef/common/chrome/chrome_content_client_cef.h",
674              "libcef/common/chrome/chrome_main_delegate_cef.cc",
675              "libcef/common/chrome/chrome_main_delegate_cef.h",
676              "libcef/common/chrome/chrome_main_runner_delegate.cc",
677              "libcef/common/chrome/chrome_main_runner_delegate.h",
678              "libcef/common/command_line_impl.cc",
679              "libcef/common/command_line_impl.h",
680              "libcef/common/crash_reporter_client.cc",
681              "libcef/common/crash_reporter_client.h",
682              "libcef/common/crash_reporting.cc",
683              "libcef/common/crash_reporting.h",
684              "libcef/common/drag_data_impl.cc",
685              "libcef/common/drag_data_impl.h",
686              "libcef/common/extensions/chrome_generated_schemas.cc",
687              "libcef/common/extensions/chrome_generated_schemas.h",
688              "libcef/common/extensions/extensions_api_provider.cc",
689              "libcef/common/extensions/extensions_api_provider.h",
690              "libcef/common/extensions/extensions_client.cc",
691              "libcef/common/extensions/extensions_client.h",
692              "libcef/common/extensions/extensions_util.cc",
693              "libcef/common/extensions/extensions_util.h",
694              "libcef/common/file_util_impl.cc",
695              "libcef/common/frame_util.cc",
696              "libcef/common/frame_util.h",
697              "libcef/common/i18n_util_impl.cc",
698              "libcef/common/json_impl.cc",
699              "libcef/common/main_runner_delegate.h",
700              "libcef/common/main_runner_handler.h",
701              "libcef/common/net/http_header_utils.cc",
702              "libcef/common/net/http_header_utils.h",
703              "libcef/common/net/net_resource_provider.cc",
704              "libcef/common/net/net_resource_provider.h",
705              "libcef/common/net/scheme_registration.cc",
706              "libcef/common/net/scheme_registration.h",
707              "libcef/common/net/url_util.cc",
708              "libcef/common/net/url_util.h",
709              "libcef/common/net_service/net_service_util.cc",
710              "libcef/common/net_service/net_service_util.h",
711              "libcef/common/parser_impl.cc",
712              "libcef/common/process_message_impl.cc",
713              "libcef/common/process_message_impl.h",
714              "libcef/common/request_impl.cc",
715              "libcef/common/request_impl.h",
716              "libcef/common/resource_bundle_delegate.cc",
717              "libcef/common/resource_bundle_delegate.h",
718              "libcef/common/resource_bundle_impl.cc",
719              "libcef/common/resource_bundle_impl.h",
720              "libcef/common/resource_util.cc",
721              "libcef/common/resource_util.h",
722              "libcef/common/response_impl.cc",
723              "libcef/common/response_impl.h",
724              "libcef/common/scheme_registrar_impl.cc",
725              "libcef/common/scheme_registrar_impl.h",
726              "libcef/common/string_list_impl.cc",
727              "libcef/common/string_map_impl.cc",
728              "libcef/common/string_multimap_impl.cc",
729              "libcef/common/string_types_impl.cc",
730              "libcef/common/string_util.cc",
731              "libcef/common/string_util.h",
732              "libcef/common/task_impl.cc",
733              "libcef/common/task_runner_impl.cc",
734              "libcef/common/task_runner_impl.h",
735              "libcef/common/task_runner_manager.cc",
736              "libcef/common/task_runner_manager.h",
737              "libcef/common/test/translator_test_impl.cc",
738              "libcef/common/thread_impl.cc",
739              "libcef/common/thread_impl.h",
740              "libcef/common/time_impl.cc",
741              "libcef/common/time_util.h",
742              "libcef/common/tracker.cc",
743              "libcef/common/tracker.h",
744              "libcef/common/urlrequest_impl.cc",
745              "libcef/common/value_base.cc",
746              "libcef/common/value_base.h",
747              "libcef/common/values_impl.cc",
748              "libcef/common/values_impl.h",
749              "libcef/common/waitable_event_impl.cc",
750              "libcef/common/waitable_event_impl.h",
751              "libcef/features/runtime.h",
752              "libcef/features/runtime_checks.h",
753              "libcef/renderer/alloy/alloy_content_renderer_client.cc",
754              "libcef/renderer/alloy/alloy_content_renderer_client.h",
755              "libcef/renderer/alloy/alloy_render_thread_observer.cc",
756              "libcef/renderer/alloy/alloy_render_thread_observer.h",
757              "libcef/renderer/alloy/url_loader_throttle_provider_impl.cc",
758              "libcef/renderer/alloy/url_loader_throttle_provider_impl.h",
759              "libcef/renderer/browser_impl.cc",
760              "libcef/renderer/browser_impl.h",
761              "libcef/renderer/chrome/chrome_content_renderer_client_cef.cc",
762              "libcef/renderer/chrome/chrome_content_renderer_client_cef.h",
763              "libcef/renderer/dom_document_impl.cc",
764              "libcef/renderer/dom_document_impl.h",
765              "libcef/renderer/dom_node_impl.cc",
766              "libcef/renderer/dom_node_impl.h",
767              "libcef/renderer/extensions/extensions_dispatcher_delegate.cc",
768              "libcef/renderer/extensions/extensions_dispatcher_delegate.h",
769              "libcef/renderer/extensions/extensions_renderer_client.cc",
770              "libcef/renderer/extensions/extensions_renderer_client.h",
771              "libcef/renderer/extensions/print_render_frame_helper_delegate.cc",
772              "libcef/renderer/extensions/print_render_frame_helper_delegate.h",
773              "libcef/renderer/frame_impl.cc",
774              "libcef/renderer/frame_impl.h",
775              "libcef/renderer/render_frame_observer.cc",
776              "libcef/renderer/render_frame_observer.h",
777              "libcef/renderer/render_frame_util.cc",
778              "libcef/renderer/render_frame_util.h",
779              "libcef/renderer/render_manager.cc",
780              "libcef/renderer/render_manager.h",
781              "libcef/renderer/render_urlrequest_impl.cc",
782              "libcef/renderer/render_urlrequest_impl.h",
783              "libcef/renderer/thread_util.h",
784              "libcef/renderer/v8_impl.cc",
785              "libcef/renderer/v8_impl.h",
786
787              # For Chrome runtime support.
788              "//chrome/app/chrome_main_delegate.cc",
789              "//chrome/app/chrome_main_delegate.h",
790            ]
791
792  configs += [
793    "libcef/features:config",
794    "//build/config:precompiled_headers",
795  ]
796
797  public_configs = [ "libcef/features:config" ]
798
799  include_dirs = [
800    # Crashpad code uses paths relative to this directory.
801    "//third_party/crashpad/crashpad",
802  ]
803
804  public_deps = [
805    # Bring in feature flag defines.
806    "//cef/libcef/features",
807  ]
808
809  deps = [
810    ":cef_make_headers",
811    ":libcef_static_unittested",
812    "libcef/common/mojom",
813
814    # Generate API bindings for extensions.
815    # TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
816    # libcef/common/extensions/api/README.txt for details.
817    #"libcef/common/extensions/api",
818    #"libcef/common/extensions/api:api_registration",
819    "libcef/common/extensions/api:extensions_features",
820
821    # Normal build dependencies. Should be sorted alphabetically.
822    "//base",
823    "//base:base_static",
824    "//base/third_party/dynamic_annotations",
825    "//cc",
826    "//chrome:browser_dependencies",
827    "//chrome:child_dependencies",
828    "//chrome:packed_resources",
829    "//chrome:resources",
830    "//chrome:strings",
831    "//chrome/common:buildflags",
832    "//chrome/services/printing:lib",
833    "//components/cdm/renderer",
834    "//components/certificate_transparency",
835    "//components/component_updater",
836    "//components/content_settings/core/browser",
837    "//components/content_settings/core/common",
838    "//components/crx_file",
839    "//components/data_use_measurement/core",
840    "//components/google/core/common",
841    "//components/keyed_service/content:content",
842    "//components/keyed_service/core:core",
843    "//components/media_router/common/mojom:media_router",
844    "//components/navigation_interception",
845    "//components/network_session_configurator/common",
846    "//components/pdf/browser",
847    "//components/pdf/renderer",
848    "//components/plugins/renderer",
849    "//components/pref_registry",
850    "//components/printing/browser",
851    "//components/printing/common",
852    "//components/printing/renderer",
853    "//components/proxy_config",
854    "//components/services/print_compositor/public/cpp",
855    "//components/services/print_compositor/public/mojom",
856    "//components/update_client",
857    "//components/url_formatter",
858    "//components/user_prefs",
859    "//components/version_info",
860    "//components/visitedlink/browser",
861    "//components/visitedlink/common",
862    "//components/visitedlink/renderer",
863    "//components/viz/service",
864    "//components/web_cache/renderer",
865    "//content/public/app",
866    "//content/public/browser",
867    "//content/public/child",
868    "//content/public/common",
869    "//content/public/gpu",
870    "//content/public/renderer",
871    "//content/public/utility",
872    "//crypto",
873    "//device/base",
874    "//extensions/browser",
875    "//extensions/browser:core_api_provider",
876    "//extensions/buildflags",
877    "//extensions/common:core_api_provider",
878    "//extensions/common/api",
879    "//extensions/renderer",
880    "//gpu",
881    "//ipc",
882    "//media",
883    "//net",
884    "//pdf",
885    "//ppapi/buildflags",
886    "//printing/buildflags",
887    "//services/network:network_service",
888    "//services/network/public/cpp",
889    "//services/service_manager/public/cpp",
890    "//skia",
891    "//storage/browser",
892    "//third_party/blink/public:blink",
893    "//third_party/brotli:dec",
894    "//third_party/cld_3/src/src:cld_3",
895    "//third_party/hunspell",
896    "//third_party/icu",
897    "//third_party/leveldatabase",
898    "//third_party/libxml:libxml",
899    "//third_party/widevine/cdm",
900    "//third_party/widevine/cdm:headers",
901    "//third_party/zlib:minizip",
902    "//ui/base",
903    "//ui/base/ime",
904    "//ui/events:events_base",
905    "//ui/gfx",
906    "//ui/gfx/geometry",
907    "//ui/gfx/ipc",
908    "//ui/gfx/ipc/geometry",
909    "//ui/gfx/ipc/skia",
910    "//ui/gl",
911    "//url",
912    "//v8",
913  ]
914
915  if (is_win) {
916    sources +=
917        includes_win + [
918          "libcef/browser/alloy/alloy_browser_main_win.cc",
919          "libcef/browser/native/browser_platform_delegate_native_win.cc",
920          "libcef/browser/native/browser_platform_delegate_native_win.h",
921          "libcef/browser/native/cursor_util_win.cc",
922          "libcef/browser/native/file_dialog_runner_win.cc",
923          "libcef/browser/native/file_dialog_runner_win.h",
924          "libcef/browser/native/javascript_dialog_runner_win.cc",
925          "libcef/browser/native/javascript_dialog_runner_win.h",
926          "libcef/browser/native/menu_2.cc",
927          "libcef/browser/native/menu_2.h",
928          "libcef/browser/native/menu_runner_win.cc",
929          "libcef/browser/native/menu_runner_win.h",
930          "libcef/browser/native/menu_wrapper.h",
931          "libcef/browser/native/native_menu_win.cc",
932          "libcef/browser/native/native_menu_win.h",
933          "libcef/browser/osr/browser_platform_delegate_osr_win.cc",
934          "libcef/browser/osr/browser_platform_delegate_osr_win.h",
935        ]
936
937    deps += [
938      "//chrome/chrome_elf",
939      "//chrome/install_static:secondary_module",
940    ]
941
942    if (is_component_build) {
943      deps += [ "//content:sandbox_helper_win" ]
944    }
945
946    libs = [
947      "comctl32.lib",
948
949      # For D3D11_DECODER_PROFILE_H264_VLD_NOFGT.
950      "dxguid.lib",
951    ]
952
953    data_deps = [ "//chrome/elevation_service" ]
954  }
955
956  if (is_linux) {
957    sources +=
958        includes_linux + [
959          "libcef/browser/native/browser_platform_delegate_native_linux.cc",
960          "libcef/browser/native/browser_platform_delegate_native_linux.h",
961          "libcef/browser/native/cursor_util_linux.cc",
962          "libcef/browser/native/menu_runner_linux.cc",
963          "libcef/browser/native/menu_runner_linux.h",
964          "libcef/browser/osr/browser_platform_delegate_osr_linux.cc",
965          "libcef/browser/osr/browser_platform_delegate_osr_linux.h",
966          "libcef/browser/printing/print_dialog_linux.cc",
967          "libcef/browser/printing/print_dialog_linux.h",
968        ]
969
970    if (ozone_platform_x11) {
971      sources += [
972        "libcef/browser/native/window_x11.cc",
973        "libcef/browser/native/window_x11.h",
974      ]
975    }
976
977    deps += [
978      "//build/config/freetype",
979      "//third_party/fontconfig",
980    ]
981
982    if (is_linux && !ozone_platform_x11) {
983      deps += [ "//third_party/angle:libEGL" ]
984    }
985  }
986
987  if (is_mac) {
988    sources +=
989        includes_mac + [
990          "libcef/browser/native/browser_platform_delegate_native_mac.h",
991          "libcef/browser/native/browser_platform_delegate_native_mac.mm",
992          "libcef/browser/native/file_dialog_runner_mac.h",
993          "libcef/browser/native/file_dialog_runner_mac.mm",
994          "libcef/browser/native/javascript_dialog_runner_mac.h",
995          "libcef/browser/native/javascript_dialog_runner_mac.mm",
996          "libcef/browser/native/menu_runner_mac.h",
997          "libcef/browser/native/menu_runner_mac.mm",
998          "libcef/browser/osr/browser_platform_delegate_osr_mac.h",
999          "libcef/browser/osr/browser_platform_delegate_osr_mac.mm",
1000          "libcef/common/util_mac.h",
1001          "libcef/common/util_mac.mm",
1002
1003          # For Chrome runtime support.
1004          "//chrome/app/chrome_main_mac.h",
1005          "//chrome/app/chrome_main_mac.mm",
1006        ]
1007  }
1008
1009  if (is_win || is_mac) {
1010    deps += [ "//third_party/crashpad/crashpad/handler" ]
1011  }
1012
1013  if (ozone_platform_x11) {
1014    deps += [ "//ui/events/devices/x11" ]
1015  }
1016
1017  if (is_posix && !is_mac) {
1018    sources += [
1019      "libcef/common/cef_crash_report_utils.cc",
1020      "libcef/common/cef_crash_report_utils.h",
1021    ]
1022
1023    deps += [
1024      "//components/crash/content/browser",
1025      "//components/crash/core/app",
1026    ]
1027  }
1028
1029  if (v8_use_external_startup_data && use_v8_context_snapshot) {
1030    deps += [ "//tools/v8_context_snapshot" ]
1031  }
1032
1033  if (toolkit_views) {
1034    sources += [
1035      "libcef/browser/chrome/views/browser_platform_delegate_chrome_views.cc",
1036      "libcef/browser/chrome/views/browser_platform_delegate_chrome_views.h",
1037      "libcef/browser/chrome/views/chrome_browser_frame.cc",
1038      "libcef/browser/chrome/views/chrome_browser_frame.h",
1039      "libcef/browser/chrome/views/chrome_browser_view.cc",
1040      "libcef/browser/chrome/views/chrome_browser_view.h",
1041      "libcef/browser/chrome/views/chrome_views_util.cc",
1042      "libcef/browser/chrome/views/chrome_views_util.h",
1043      "libcef/browser/chrome/views/toolbar_view_impl.cc",
1044      "libcef/browser/chrome/views/toolbar_view_impl.h",
1045      "libcef/browser/chrome/views/toolbar_view_view.cc",
1046      "libcef/browser/chrome/views/toolbar_view_view.h",
1047      "libcef/browser/native/window_delegate_view.cc",
1048      "libcef/browser/native/window_delegate_view.h",
1049      "libcef/browser/views/basic_label_button_impl.cc",
1050      "libcef/browser/views/basic_label_button_impl.h",
1051      "libcef/browser/views/basic_label_button_view.cc",
1052      "libcef/browser/views/basic_label_button_view.h",
1053      "libcef/browser/views/basic_panel_impl.cc",
1054      "libcef/browser/views/basic_panel_impl.h",
1055      "libcef/browser/views/basic_panel_view.cc",
1056      "libcef/browser/views/basic_panel_view.h",
1057      "libcef/browser/views/box_layout_impl.cc",
1058      "libcef/browser/views/box_layout_impl.h",
1059      "libcef/browser/views/browser_platform_delegate_views.cc",
1060      "libcef/browser/views/browser_platform_delegate_views.h",
1061      "libcef/browser/views/browser_view_impl.cc",
1062      "libcef/browser/views/browser_view_impl.h",
1063      "libcef/browser/views/browser_view_view.cc",
1064      "libcef/browser/views/browser_view_view.h",
1065      "libcef/browser/views/button_impl.h",
1066      "libcef/browser/views/button_view.h",
1067      "libcef/browser/views/display_impl.cc",
1068      "libcef/browser/views/display_impl.h",
1069      "libcef/browser/views/fill_layout_impl.cc",
1070      "libcef/browser/views/fill_layout_impl.h",
1071      "libcef/browser/views/label_button_impl.h",
1072      "libcef/browser/views/label_button_view.h",
1073      "libcef/browser/views/layout_adapter.cc",
1074      "libcef/browser/views/layout_adapter.h",
1075      "libcef/browser/views/layout_impl.h",
1076      "libcef/browser/views/layout_util.cc",
1077      "libcef/browser/views/layout_util.h",
1078      "libcef/browser/views/menu_button_impl.cc",
1079      "libcef/browser/views/menu_button_impl.h",
1080      "libcef/browser/views/menu_button_view.cc",
1081      "libcef/browser/views/menu_button_view.h",
1082      "libcef/browser/views/menu_runner_views.cc",
1083      "libcef/browser/views/menu_runner_views.h",
1084      "libcef/browser/views/overlay_view_host.cc",
1085      "libcef/browser/views/overlay_view_host.h",
1086      "libcef/browser/views/panel_impl.h",
1087      "libcef/browser/views/panel_view.h",
1088      "libcef/browser/views/scroll_view_impl.cc",
1089      "libcef/browser/views/scroll_view_impl.h",
1090      "libcef/browser/views/scroll_view_view.cc",
1091      "libcef/browser/views/scroll_view_view.h",
1092      "libcef/browser/views/textfield_impl.cc",
1093      "libcef/browser/views/textfield_impl.h",
1094      "libcef/browser/views/textfield_view.cc",
1095      "libcef/browser/views/textfield_view.h",
1096      "libcef/browser/views/view_adapter.cc",
1097      "libcef/browser/views/view_adapter.h",
1098      "libcef/browser/views/view_impl.h",
1099      "libcef/browser/views/view_util.cc",
1100      "libcef/browser/views/view_util.h",
1101      "libcef/browser/views/view_view.h",
1102      "libcef/browser/views/window_impl.cc",
1103      "libcef/browser/views/window_impl.h",
1104      "libcef/browser/views/window_view.cc",
1105      "libcef/browser/views/window_view.h",
1106
1107      # Part of //ui/views:test_support which is testingonly.
1108      "//ui/views/test/desktop_test_views_delegate.h",
1109      "//ui/views/test/test_views_delegate.h",
1110
1111      # Support for UI input events.
1112      # Part of //ui/base:test_support which is testingonly.
1113      "//ui/base/test/ui_controls.h",
1114    ]
1115
1116    deps += [
1117      "//ui/events",
1118      "//ui/strings",
1119      "//ui/views",
1120      "//ui/views/controls/webview",
1121    ]
1122
1123    if (use_aura) {
1124      sources += [
1125        "libcef/browser/native/browser_platform_delegate_native_aura.cc",
1126        "libcef/browser/native/browser_platform_delegate_native_aura.h",
1127        "libcef/browser/views/view_util_aura.cc",
1128
1129        # Part of //ui/views:test_support which is testingonly.
1130        "//ui/views/test/desktop_test_views_delegate_aura.cc",
1131        "//ui/views/test/test_views_delegate_aura.cc",
1132
1133        # Support for UI input events.
1134        # Part of //ui/base:test_support which is testingonly.
1135        "//ui/aura/test/ui_controls_factory_aura.h",
1136        "//ui/base/test/ui_controls_aura.cc",
1137      ]
1138
1139      deps += [
1140        "//ui/aura",
1141        "//ui/wm",
1142        "//ui/wm/public",
1143      ]
1144
1145      if (is_win) {
1146        sources += [
1147          # Support for UI input events.
1148          # Part of //base/test:test_config which is testingonly.
1149          "//base/test/test_switches.cc",
1150          "//base/test/test_switches.h",
1151          "//base/test/test_timeouts.cc",
1152          "//base/test/test_timeouts.h",
1153
1154          # Part of //ui/aura:test_support which is testingonly.
1155          "//ui/aura/test/ui_controls_factory_aurawin.cc",
1156
1157          # Part of //ui/base:test_support which is testingonly.
1158          "//ui/base/test/ui_controls_internal_win.cc",
1159          "//ui/base/test/ui_controls_internal_win.h",
1160        ]
1161      }
1162
1163      if (is_linux) {
1164        sources += [
1165          # Support for UI input events.
1166          # Part of //ui/aura:test_support which is testingonly.
1167          "$root_gen_dir/ui/ozone/test_constructor_list.cc",
1168          "//ui/aura/test/aura_test_utils.cc",
1169          "//ui/aura/test/aura_test_utils.h",
1170
1171          # Part of //ui/events:test_support which is testingonly.
1172          "//ui/events/test/x11_event_waiter.cc",
1173          "//ui/events/test/x11_event_waiter.h",
1174
1175          # Part of //ui/ozone::ui_test_support which is testingonly.
1176          "//ui/ozone/common/test/stub_ozone_ui_controls_test_helper.cc",
1177          "//ui/ozone/common/test/stub_ozone_ui_controls_test_helper.h",
1178          "//ui/ozone/public/ozone_ui_controls_test_helper.cc",
1179          "//ui/ozone/public/ozone_ui_controls_test_helper.h",
1180
1181          # Part of //ui/views:test_support which is testingonly.
1182          "//ui/views/test/test_desktop_screen_ozone.cc",
1183          "//ui/views/test/test_desktop_screen_ozone.h",
1184          "//ui/views/test/ui_controls_factory_desktop_aura_ozone.cc",
1185          "//ui/views/test/ui_controls_factory_desktop_aura_ozone.h",
1186        ]
1187
1188        deps += [ "//ui/ozone:generate_test_support_constructor_list" ]
1189
1190        if (ozone_platform_x11) {
1191          sources += [
1192            # Part of //ui/aura:test_support which is testingonly.
1193            # Support for UI input events.
1194            # Part of //ui/base/x:test_support which is testingonly.
1195            "//ui/aura/test/x11_event_sender.h",
1196            "//ui/base/x/test/x11_ui_controls_test_helper.cc",
1197            "//ui/base/x/test/x11_ui_controls_test_helper.h",
1198
1199            # Part of //ui/ozone/platform/x11:test_support which is testingonly.
1200            "//ui/ozone/platform/x11/x11_ozone_ui_controls_test_helper.cc",
1201            "//ui/ozone/platform/x11/x11_ozone_ui_controls_test_helper.h",
1202          ]
1203        } else {
1204          sources += [
1205            # Support for UI input events.
1206            # Part of //ui/base:test_support which is testingonly.
1207            "//ui/aura/test/ui_controls_factory_ozone.cc",
1208
1209            # Part of //ui//events:test_support which is testingonly.
1210            "//ui/events/test/events_test_utils.cc",
1211          ]
1212        }
1213      }
1214    }
1215
1216    if (is_mac) {
1217      sources += [
1218        "libcef/browser/views/view_util_mac.mm",
1219
1220        # Part of //ui/views:test_support which is testingonly.
1221        "//ui/views/test/desktop_test_views_delegate_mac.mm",
1222        "//ui/views/test/test_views_delegate_mac.mm",
1223
1224        # Support for UI input events.
1225        # Part of //ui/base:test_support which is testingonly.
1226        "//ui/base/test/ui_controls_mac.mm",
1227
1228        # Part of //ui//events:test_support which is testingonly.
1229        "//ui/events/test/cocoa_test_event_utils.mm",
1230      ]
1231    }
1232  } else {
1233    sources += [
1234      # Provides stub implementations for the views static methods.
1235      "libcef_dll/views_stub.cc",
1236    ]
1237  }
1238}
1239
1240#
1241# libcef_dll_wrapper static targets.
1242#
1243
1244# Configuration that will be applied to all targets that build autogen files.
1245config("libcef_autogen_config") {
1246  if (is_clang) {
1247    cflags = [
1248      # Disable clang warnings related to CEF's translation layer templates.
1249      "-Wno-undefined-var-template",
1250    ]
1251  }
1252}
1253
1254# Configuration that will be applied to all targets that depend on
1255# libcef_dll_wrapper.
1256config("libcef_dll_wrapper_config") {
1257  include_dirs = [
1258    # CEF sources use include paths relative to the CEF root directory.
1259    ".",
1260
1261    # CEF generates some header files that also need to be discoverable.
1262    # They will be copied to the include/ directory in the binary distribution.
1263    "$root_out_dir/includes",
1264  ]
1265
1266  configs = [ ":libcef_autogen_config" ]
1267}
1268
1269# libcef_dll_wrapper target.
1270static_library("libcef_dll_wrapper") {
1271  sources = includes_common + gypi_paths.autogen_cpp_includes +
1272            gypi_paths2.includes_capi + gypi_paths.autogen_capi_includes +
1273            gypi_paths2.includes_wrapper +
1274            gypi_paths2.libcef_dll_wrapper_sources_base +
1275            gypi_paths2.libcef_dll_wrapper_sources_common +
1276            gypi_paths.autogen_client_side
1277
1278  if (is_mac) {
1279    sources += gypi_paths2.libcef_dll_wrapper_sources_mac
1280  }
1281
1282  defines = [ "WRAPPING_CEF_SHARED" ]
1283
1284  configs += [ ":libcef_dll_wrapper_config" ]
1285  public_configs = [ ":libcef_dll_wrapper_config" ]
1286
1287  deps = [ ":cef_make_headers" ]
1288}
1289
1290#
1291# cef_sandbox target.
1292#
1293
1294if (is_win) {
1295  static_library("cef_sandbox") {
1296    sources = [ "libcef_dll/sandbox/sandbox_win.cc" ]
1297
1298    # CEF sources use include paths relative to the CEF root directory.
1299    include_dirs = [ "." ]
1300    deps = [
1301      "libcef/features",
1302      "//sandbox",
1303    ]
1304  }
1305}
1306
1307if (is_mac) {
1308  static_library("cef_sandbox") {
1309    sources = [ "libcef_dll/sandbox/sandbox_mac.mm" ]
1310
1311    # CEF sources use include paths relative to the CEF root directory.
1312    include_dirs = [ "." ]
1313    deps = [
1314      "//build/config:executable_deps",
1315      "//sandbox/mac:seatbelt",
1316    ]
1317  }
1318}
1319
1320#
1321# Resource grit/pack targets.
1322#
1323
1324# Included in locales/*.pak via //chrome/chrome_repack_locales.gni.
1325grit("cef_strings") {
1326  source = "libcef/resources/cef_strings.grd"
1327  outputs = [ "grit/cef_strings.h" ]
1328  all_locales = locales + [ "fake-bidi" ]
1329  foreach(locale, all_locales) {
1330    outputs += [ "cef_strings_${locale}.pak" ]
1331  }
1332}
1333
1334# Included in resources.pak via //chrome/chrome_paks.gni.
1335grit("cef_resources") {
1336  source = "libcef/resources/cef_resources.grd"
1337  outputs = [
1338    "grit/cef_resources.h",
1339    "cef_resources.pak",
1340  ]
1341  grit_flags = [
1342    "-E",
1343    "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir),
1344  ]
1345}
1346
1347# Helper for generating pack header files.
1348template("make_pack_header") {
1349  assert(defined(invoker.header))
1350  assert(defined(invoker.inputs))
1351  assert(defined(invoker.deps))
1352
1353  action("make_pack_header_${target_name}") {
1354    script = "tools/make_pack_header.py"
1355
1356    inputs = invoker.inputs
1357    outputs = [ invoker.header ]
1358
1359    args = rebase_path(outputs, root_build_dir) +
1360           rebase_path(inputs, root_build_dir)
1361
1362    deps = invoker.deps
1363  }
1364}
1365
1366# Generate cef_pack_resources.h.
1367make_pack_header("resources") {
1368  header = "$root_out_dir/includes/include/cef_pack_resources.h"
1369  inputs = [
1370    "$root_gen_dir/base/tracing/protos/grit/tracing_proto_resources.h",
1371    "$root_gen_dir/cef/grit/cef_resources.h",
1372    "$root_gen_dir/chrome/grit/browser_resources.h",
1373    "$root_gen_dir/chrome/grit/common_resources.h",
1374    "$root_gen_dir/chrome/grit/component_extension_resources.h",
1375    "$root_gen_dir/chrome/grit/dev_ui_browser_resources.h",
1376    "$root_gen_dir/chrome/grit/pdf_resources.h",
1377    "$root_gen_dir/chrome/grit/renderer_resources.h",
1378    "$root_gen_dir/components/grit/components_resources.h",
1379    "$root_gen_dir/components/grit/dev_ui_components_resources.h",
1380    "$root_gen_dir/content/browser/devtools/grit/devtools_resources.h",
1381    "$root_gen_dir/content/browser/tracing/grit/tracing_resources.h",
1382    "$root_gen_dir/content/browser/webrtc/resources/grit/webrtc_internals_resources.h",
1383    "$root_gen_dir/content/grit/content_resources.h",
1384    "$root_gen_dir/content/grit/dev_ui_content_resources.h",
1385    "$root_gen_dir/extensions/grit/extensions_browser_resources.h",
1386    "$root_gen_dir/extensions/grit/extensions_renderer_resources.h",
1387    "$root_gen_dir/extensions/grit/extensions_resources.h",
1388    "$root_gen_dir/mojo/public/js/grit/mojo_bindings_resources.h",
1389    "$root_gen_dir/net/grit/net_resources.h",
1390    "$root_gen_dir/third_party/blink/public/resources/grit/blink_resources.h",
1391    "$root_gen_dir/ui/resources/grit/ui_resources.h",
1392    "$root_gen_dir/ui/resources/grit/webui_generated_resources.h",
1393    "$root_gen_dir/ui/resources/grit/webui_resources.h",
1394  ]
1395
1396  deps = [
1397    ":cef_resources",
1398    "//base/tracing/protos:chrome_track_event_resources",
1399    "//chrome/browser:dev_ui_browser_resources",
1400    "//chrome/browser:resources",
1401    "//chrome/browser/resources:component_extension_resources",
1402    "//chrome/browser/resources/pdf:resources",
1403    "//chrome/common:resources",
1404    "//chrome/renderer:resources",
1405    "//components/resources:components_resources",
1406    "//components/resources:dev_ui_components_resources",
1407    "//content:content_resources",
1408    "//content:dev_ui_content_resources",
1409    "//content/browser/devtools:devtools_resources",
1410    "//content/browser/tracing:resources",
1411    "//content/browser/webrtc/resources",
1412    "//extensions:extensions_browser_resources",
1413    "//extensions:extensions_renderer_resources",
1414    "//extensions:extensions_resources_grd",
1415    "//mojo/public/js:resources",
1416    "//net:net_resources",
1417    "//third_party/blink/public:resources",
1418    "//ui/resources:ui_resources_grd",
1419    "//ui/resources:webui_generated_resources_grd",
1420    "//ui/resources:webui_resources_grd",
1421  ]
1422
1423  if (toolkit_views) {
1424    inputs += [ "$root_gen_dir/ui/views/resources/grit/views_resources.h" ]
1425    deps += [ "//ui/views/resources:resources_grd" ]
1426  }
1427}
1428
1429# Generate cef_pack_strings.h.
1430make_pack_header("strings") {
1431  header = "$root_out_dir/includes/include/cef_pack_strings.h"
1432  inputs = [
1433    "$root_gen_dir/cef/grit/cef_strings.h",
1434    "$root_gen_dir/chrome/grit/chromium_strings.h",
1435    "$root_gen_dir/chrome/grit/generated_resources.h",
1436    "$root_gen_dir/chrome/grit/locale_settings.h",
1437    "$root_gen_dir/chrome/grit/platform_locale_settings.h",
1438    "$root_gen_dir/components/omnibox/resources/grit/omnibox_resources.h",
1439    "$root_gen_dir/components/strings/grit/components_chromium_strings.h",
1440    "$root_gen_dir/components/strings/grit/components_strings.h",
1441    "$root_gen_dir/extensions/strings/grit/extensions_strings.h",
1442    "$root_gen_dir/services/strings/grit/services_strings.h",
1443    "$root_gen_dir/third_party/blink/public/strings/grit/blink_accessibility_strings.h",
1444    "$root_gen_dir/third_party/blink/public/strings/grit/blink_strings.h",
1445    "$root_gen_dir/ui/strings/grit/ui_strings.h",
1446  ]
1447
1448  deps = [
1449    ":cef_strings",
1450    "//chrome/app:chromium_strings",
1451    "//chrome/app:generated_resources",
1452    "//chrome/app/resources:locale_settings",
1453    "//chrome/app/resources:platform_locale_settings",
1454    "//components/omnibox/resources:omnibox_resources",
1455    "//components/strings:components_chromium_strings",
1456    "//components/strings:components_locale_settings",
1457    "//components/strings:components_strings",
1458    "//extensions/strings",
1459    "//services/strings",
1460    "//third_party/blink/public/strings",
1461    "//third_party/blink/public/strings:accessibility_strings",
1462    "//ui/strings:app_locale_settings",
1463    "//ui/strings:ui_strings",
1464  ]
1465}
1466
1467# Generate cef_api_hash.h.
1468action("make_api_hash_header") {
1469  script = "tools/make_api_hash_header.py"
1470
1471  # List of all C API files that will be checked for changes by cef_api_hash.py.
1472  inputs = gypi_paths2.includes_common_capi + gypi_paths2.includes_linux_capi +
1473           gypi_paths2.includes_mac_capi + gypi_paths2.includes_win_capi +
1474           gypi_paths2.includes_capi + gypi_paths.autogen_capi_includes
1475  include_dir = [ "include" ]
1476  outputs = [ "$root_out_dir/includes/include/cef_api_hash.h" ]
1477
1478  args = rebase_path(outputs + include_dir, root_build_dir)
1479}
1480
1481# Generate cef_config.h.
1482action("make_config_header") {
1483  script = "tools/make_config_header.py"
1484
1485  outputs = [ "$root_out_dir/includes/include/cef_config.h" ]
1486
1487  args = rebase_path(outputs + [ "$root_out_dir/args.gn" ], root_build_dir)
1488}
1489
1490# Generate pack files and associated CEF header files.
1491group("cef_make_headers") {
1492  deps = [
1493    ":make_api_hash_header",
1494    ":make_config_header",
1495    ":make_pack_header_resources",
1496    ":make_pack_header_strings",
1497  ]
1498}
1499
1500#
1501# libcef dll/framework target.
1502#
1503
1504if (is_mac) {
1505  cef_framework_name = "Chromium Embedded Framework"
1506
1507  tweak_info_plist("cef_framework_plist") {
1508    info_plist = "libcef/resources/framework-Info.plist"
1509    args = [
1510      "--breakpad=0",
1511      "--keystone=0",
1512      "--scm=1",
1513      "--version",
1514      cef_plist_version,
1515      "--branding",
1516      cef_framework_name,
1517    ]
1518  }
1519
1520  bundle_data("cef_framework_resources") {
1521    sources = []
1522    public_deps = []
1523
1524    if (icu_use_data_file) {
1525      sources += [ "$root_out_dir/icudtl.dat" ]
1526      public_deps += [ "//third_party/icu:icudata" ]
1527    }
1528
1529    if (v8_use_external_startup_data) {
1530      sources += [ "$root_out_dir/snapshot_blob.bin" ]
1531      public_deps += [ "//v8" ]
1532      if (use_v8_context_snapshot) {
1533        sources += [ "$root_out_dir/$v8_context_snapshot_filename" ]
1534        public_deps += [ "//tools/v8_context_snapshot" ]
1535      }
1536    }
1537
1538    outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
1539  }
1540
1541  if (use_egl) {
1542    # Add the ANGLE .dylibs in the MODULE_DIR of the Framework app bundle.
1543    bundle_data("cef_framework_angle_binaries") {
1544      sources = [
1545        "$root_out_dir/egl_intermediates/libEGL.dylib",
1546        "$root_out_dir/egl_intermediates/libGLESv2.dylib",
1547      ]
1548      outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
1549      public_deps = [ "//ui/gl:angle_library_copy" ]
1550    }
1551
1552    # Add the SwiftShader .dylibs in the MODULE_DIR of the Framework app bundle.
1553    bundle_data("cef_framework_swiftshader_binaries") {
1554      sources = [
1555        "$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib",
1556        "$root_out_dir/egl_intermediates/libswiftshader_libGLESv2.dylib",
1557        "$root_out_dir/vk_intermediates/libvk_swiftshader.dylib",
1558        "$root_out_dir/vk_intermediates/vk_swiftshader_icd.json",
1559      ]
1560      outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
1561      public_deps = [
1562        "//ui/gl:swiftshader_egl_library_copy",
1563        "//ui/gl:swiftshader_vk_library_copy",
1564      ]
1565    }
1566  }
1567
1568  group("cef_framework_angle_library") {
1569    if (use_egl) {
1570      deps = [ ":cef_framework_angle_binaries" ]
1571    }
1572  }
1573
1574  group("cef_framework_swiftshader_library") {
1575    if (use_egl) {
1576      deps = [ ":cef_framework_swiftshader_binaries" ]
1577    }
1578  }
1579
1580  mac_framework_bundle("cef_framework") {
1581    output_name = cef_framework_name
1582
1583    framework_version = "A"
1584    framework_contents = [
1585      "Libraries",
1586      "Resources",
1587    ]
1588
1589    sources =
1590        includes_common + includes_mac + gypi_paths.autogen_cpp_includes +
1591        gypi_paths2.includes_capi + gypi_paths.autogen_capi_includes +
1592        gypi_paths2.libcef_sources_common + gypi_paths.autogen_library_side
1593
1594    deps = [
1595      ":cef_framework_angle_library",
1596      ":cef_framework_resources",
1597      ":cef_framework_swiftshader_library",
1598      ":libcef_static",
1599    ]
1600
1601    configs += [ ":libcef_autogen_config" ]
1602
1603    # We don't link the framework so just use the path from the main executable.
1604    ldflags = [
1605      "-Wl,-install_name,@executable_path/../Frameworks/$output_name.framework/$output_name",
1606      "-compatibility_version",
1607      cef_dylib_version,
1608      "-current_version",
1609      cef_dylib_version,
1610    ]
1611
1612    if (is_component_build) {
1613      # Set up the rpath for the framework so that it can find dylibs in the
1614      # root output directory. The framework is at
1615      # $app_name.app/Contents/Frameworks/$output_name.framework/Versions/A/$output_name
1616      # so use loader_path to go back to the root output directory.
1617      ldflags += [
1618        "-rpath",
1619        "@loader_path/../../../../../..",
1620      ]
1621    }
1622
1623    info_plist_target = ":cef_framework_plist"
1624  }
1625} else {
1626  shared_library("libcef") {
1627    sources =
1628        includes_common + gypi_paths.autogen_cpp_includes +
1629        gypi_paths2.includes_capi + gypi_paths.autogen_capi_includes +
1630        gypi_paths2.libcef_sources_common + gypi_paths.autogen_library_side
1631
1632    deps = [ ":libcef_static" ]
1633
1634    configs += [ ":libcef_autogen_config" ]
1635
1636    if (is_win) {
1637      sources += includes_win + [ "libcef_dll/libcef_dll.rc" ]
1638
1639      deps += [
1640        # Bring in ui_unscaled_resources.rc which contains custom cursors.
1641        # TODO(cef): Remove this once custom cursors can be loaded via
1642        # ResourceBundle. See crbug.com/147663.
1643        "//ui/resources:ui_unscaled_resources_grd",
1644      ]
1645    }
1646
1647    if (is_linux && !is_debug && use_allocator == "none") {
1648      # Only export necessary symbols from libcef.so.
1649      # Don't do this in Debug builds because it causes the resulting
1650      # application to crash.
1651      # Also need to do this for ASAN builds to work around
1652      # https://crbug.com/832808.
1653      ldflags = [ "-Wl,--version-script=" +
1654                  rebase_path("//cef/libcef_dll/libcef.lst") ]
1655    }
1656  }
1657}
1658
1659#
1660# Executable/app targets.
1661#
1662
1663# Source files for TeamCity GTest integration.
1664# See tests/gtest/teamcity/README.cef for details.
1665source_set("gtest_teamcity") {
1666  testonly = true
1667
1668  sources = [
1669    "tests/gtest/teamcity/include/teamcity_gtest.h",
1670    "tests/gtest/teamcity/src/teamcity_gtest.cpp",
1671    "tests/gtest/teamcity/src/teamcity_gtest.h",
1672    "tests/gtest/teamcity/src/teamcity_messages.cpp",
1673    "tests/gtest/teamcity/src/teamcity_messages.h",
1674  ]
1675
1676  deps = [ "//testing/gtest" ]
1677
1678  configs += [
1679    "libcef/features:config",
1680    "//build/config:precompiled_headers",
1681  ]
1682}
1683
1684if (is_mac) {
1685  # Helper for generating the CEF app bundle.
1686  template("cef_app") {
1687    assert(defined(invoker.helper_info_plist))
1688    assert(defined(invoker.helper_sources))
1689    assert(defined(invoker.info_plist))
1690    assert(defined(invoker.sources))
1691
1692    app_name = target_name
1693    app_helper_name = "$app_name Helper"
1694    app_testonly = defined(invoker.testonly) && invoker.testonly
1695
1696    tweak_info_plist("${app_name}_helper_plist") {
1697      testonly = app_testonly
1698      info_plist = invoker.helper_info_plist
1699      args = [
1700        "--breakpad=0",
1701        "--keystone=0",
1702        "--scm=0",
1703        "--version",
1704        cef_plist_version,
1705      ]
1706    }
1707
1708    template("cef_helper_app") {
1709      mac_app_bundle(target_name) {
1710        assert(defined(invoker.helper_sources))
1711        assert(defined(invoker.helper_name_suffix))
1712        assert(defined(invoker.helper_bundle_id_suffix))
1713
1714        testonly = app_testonly
1715        output_name = app_helper_name + invoker.helper_name_suffix
1716
1717        sources = invoker.helper_sources
1718
1719        extra_substitutions =
1720            [ "BUNDLE_ID_SUFFIX=${invoker.helper_bundle_id_suffix}" ]
1721
1722        deps = [
1723          ":cef_make_headers",
1724          ":cef_sandbox",
1725          ":libcef_dll_wrapper",
1726        ]
1727        if (defined(invoker.helper_deps)) {
1728          deps += invoker.helper_deps
1729        }
1730
1731        ldflags = [
1732          # The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/
1733          # so set rpath up to the base.
1734          "-rpath",
1735          "@executable_path/../../../../../..",
1736        ]
1737
1738        info_plist_target = ":${app_name}_helper_plist"
1739
1740        if (defined(invoker.helper_frameworks)) {
1741          frameworks = invoker.helper_frameworks
1742        }
1743
1744        if (defined(invoker.helper_defines)) {
1745          defines = invoker.helper_defines
1746        }
1747      }
1748    }
1749
1750    foreach(helper_params, content_mac_helpers) {
1751      _helper_target = helper_params[0]
1752      _helper_bundle_id = helper_params[1]
1753      _helper_suffix = helper_params[2]
1754      cef_helper_app("${app_name}_helper_app_${_helper_target}") {
1755        helper_sources = invoker.helper_sources
1756        if (defined(invoker.helper_deps)) {
1757          helper_deps = invoker.helper_deps
1758        }
1759        if (defined(invoker.helper_frameworks)) {
1760          helper_frameworks = invoker.helper_frameworks
1761        }
1762        if (defined(invoker.helper_defines)) {
1763          helper_defines = invoker.helper_defines
1764        }
1765
1766        helper_name_suffix = _helper_suffix
1767        helper_bundle_id_suffix = _helper_bundle_id
1768      }
1769    }
1770
1771    bundle_data("${app_name}_framework_bundle_data") {
1772      testonly = app_testonly
1773      sources = [ "$root_out_dir/$cef_framework_name.framework" ]
1774
1775      public_deps = [ ":cef_framework" ]
1776
1777      foreach(helper_params, content_mac_helpers) {
1778        sources += [ "$root_out_dir/${app_helper_name}${helper_params[2]}.app" ]
1779        public_deps += [ ":${app_name}_helper_app_${helper_params[0]}" ]
1780      }
1781
1782      outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
1783    }
1784
1785    tweak_info_plist("${app_name}_plist") {
1786      testonly = app_testonly
1787      info_plist = invoker.info_plist
1788      args = [
1789        "--scm=1",
1790        "--version",
1791        cef_plist_version,
1792      ]
1793    }
1794
1795    mac_app_bundle(app_name) {
1796      testonly = app_testonly
1797      output_name = app_name
1798
1799      sources = invoker.sources
1800
1801      public_deps = [ ":libcef_dll_wrapper" ]
1802      deps = [
1803        ":${app_name}_framework_bundle_data",
1804        ":cef_make_headers",
1805        ":libcef_dll_wrapper",
1806      ]
1807      if (defined(invoker.deps)) {
1808        deps += invoker.deps
1809      }
1810
1811      if (defined(invoker.frameworks)) {
1812        frameworks = invoker.frameworks
1813      }
1814
1815      if (defined(invoker.defines)) {
1816        defines = invoker.defines
1817      }
1818
1819      info_plist_target = ":${app_name}_plist"
1820    }
1821  }
1822
1823  #
1824  # cefclient app targets.
1825  #
1826
1827  bundle_data("cefclient_resources_bundle_data") {
1828    sources = gypi_paths2.shared_sources_resources +
1829              gypi_paths2.cefclient_sources_resources +
1830              [ "tests/cefclient/resources/mac/cefclient.icns" ]
1831
1832    outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
1833  }
1834
1835  bundle_data("cefclient_resources_bundle_data_extensions_set_page_color") {
1836    sources = gypi_paths2.cefclient_sources_resources_extensions_set_page_color
1837    outputs = [
1838      "{{bundle_resources_dir}}/extensions/set_page_color/{{source_file_part}}",
1839    ]
1840  }
1841
1842  bundle_data("cefclient_resources_bundle_data_english") {
1843    sources =
1844        [ "tests/cefclient/resources/mac/English.lproj/InfoPlist.strings" ]
1845
1846    outputs = [ "{{bundle_resources_dir}}/English.lproj/{{source_file_part}}" ]
1847  }
1848
1849  mac_xib_bundle_data("cefclient_xibs") {
1850    sources = [ "tests/cefclient/resources/mac/English.lproj/MainMenu.xib" ]
1851
1852    output_path = "{{bundle_resources_dir}}/English.lproj"
1853  }
1854
1855  cef_app("cefclient") {
1856    helper_info_plist = "tests/cefclient/resources/mac/helper-Info.plist"
1857    helper_sources =
1858        includes_common + includes_mac + gypi_paths2.includes_wrapper +
1859        gypi_paths2.includes_wrapper_mac + gypi_paths2.shared_sources_common +
1860        gypi_paths2.shared_sources_renderer +
1861        gypi_paths2.shared_sources_mac_helper +
1862        gypi_paths2.cefclient_sources_common +
1863        gypi_paths2.cefclient_sources_renderer
1864    helper_defines = [ "CEF_USE_SANDBOX" ]
1865
1866    info_plist = "tests/cefclient/resources/mac/Info.plist"
1867    sources =
1868        includes_common + includes_mac + gypi_paths2.includes_wrapper +
1869        gypi_paths2.includes_wrapper_mac + gypi_paths2.shared_sources_browser +
1870        gypi_paths2.shared_sources_common + gypi_paths2.shared_sources_mac +
1871        gypi_paths2.cefclient_sources_browser +
1872        gypi_paths2.cefclient_sources_common + gypi_paths2.cefclient_sources_mac
1873    deps = [
1874      ":cefclient_resources_bundle_data",
1875      ":cefclient_resources_bundle_data_english",
1876      ":cefclient_resources_bundle_data_extensions_set_page_color",
1877      ":cefclient_xibs",
1878    ]
1879    frameworks = [
1880      "AppKit.framework",
1881      "OpenGL.framework",
1882    ]
1883    defines = [ "CEF_USE_SANDBOX" ]
1884  }
1885
1886  #
1887  # cefsimple app targets.
1888  #
1889
1890  bundle_data("cefsimple_resources_bundle_data") {
1891    sources = [ "tests/cefsimple/mac/cefsimple.icns" ]
1892
1893    outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
1894  }
1895
1896  bundle_data("cefsimple_resources_bundle_data_english") {
1897    sources = [ "tests/cefsimple/mac/English.lproj/InfoPlist.strings" ]
1898
1899    outputs = [ "{{bundle_resources_dir}}/English.lproj/{{source_file_part}}" ]
1900  }
1901
1902  mac_xib_bundle_data("cefsimple_xibs") {
1903    sources = [ "tests/cefsimple/mac/English.lproj/MainMenu.xib" ]
1904    output_path = "{{bundle_resources_dir}}/English.lproj"
1905  }
1906
1907  cef_app("cefsimple") {
1908    helper_info_plist = "tests/cefsimple/mac/helper-Info.plist"
1909    helper_sources =
1910        includes_common + includes_mac + gypi_paths2.includes_wrapper +
1911        gypi_paths2.includes_wrapper_mac +
1912        gypi_paths2.cefsimple_sources_mac_helper
1913    helper_defines = [ "CEF_USE_SANDBOX" ]
1914
1915    info_plist = "tests/cefsimple/mac/Info.plist"
1916    sources =
1917        includes_common + includes_mac + gypi_paths2.includes_wrapper +
1918        gypi_paths2.includes_wrapper_mac +
1919        gypi_paths2.cefsimple_sources_common + gypi_paths2.cefsimple_sources_mac
1920    deps = [
1921      ":cefsimple_resources_bundle_data",
1922      ":cefsimple_resources_bundle_data_english",
1923      ":cefsimple_xibs",
1924    ]
1925    frameworks = [ "AppKit.framework" ]
1926    defines = [ "CEF_USE_SANDBOX" ]
1927  }
1928
1929  #
1930  # ceftests app targets.
1931  #
1932
1933  bundle_data("ceftests_resources_bundle_data") {
1934    sources = gypi_paths2.shared_sources_resources +
1935              [ "tests/ceftests/resources/mac/ceftests.icns" ]
1936
1937    outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
1938  }
1939
1940  bundle_data("ceftests_resources_bundle_data_english") {
1941    sources = [ "tests/ceftests/resources/mac/English.lproj/InfoPlist.strings" ]
1942
1943    outputs = [ "{{bundle_resources_dir}}/English.lproj/{{source_file_part}}" ]
1944  }
1945
1946  mac_xib_bundle_data("ceftests_xibs") {
1947    sources = [ "tests/ceftests/resources/mac/English.lproj/MainMenu.xib" ]
1948    output_path = "{{bundle_resources_dir}}/English.lproj"
1949  }
1950
1951  cef_app("ceftests") {
1952    testonly = true
1953
1954    helper_info_plist = "tests/ceftests/resources/mac/helper-Info.plist"
1955    helper_sources = gypi_paths2.shared_sources_common +
1956                     gypi_paths2.shared_sources_renderer +
1957                     gypi_paths2.shared_sources_mac_helper +
1958                     gypi_paths2.ceftests_sources_mac_helper
1959    helper_deps = [
1960      ":gtest_teamcity",
1961      "//testing/gtest",
1962    ]
1963    helper_frameworks = [ "AppKit.framework" ]
1964    helper_defines = [ "CEF_USE_SANDBOX" ]
1965
1966    info_plist = "tests/ceftests/resources/mac/Info.plist"
1967    sources =
1968        includes_common + includes_mac + gypi_paths2.includes_wrapper +
1969        gypi_paths2.includes_wrapper_mac + gypi_paths2.shared_sources_browser +
1970        gypi_paths2.shared_sources_common + gypi_paths2.shared_sources_mac +
1971        gypi_paths2.ceftests_sources_common + gypi_paths2.ceftests_sources_mac
1972    deps = [
1973      ":ceftests_resources_bundle_data",
1974      ":ceftests_resources_bundle_data_english",
1975      ":ceftests_xibs",
1976      ":gtest_teamcity",
1977      "//testing/gtest",
1978    ]
1979    frameworks = [ "AppKit.framework" ]
1980    defines = [ "CEF_USE_SANDBOX" ]
1981  }
1982} else {
1983  #
1984  # cefclient targets.
1985  #
1986
1987  # The cefclient target depends on packages that are not available in the
1988  # default sysroot environment.
1989  if (is_linux && !use_sysroot) {
1990    pkg_config("glib") {
1991      packages = [ "glib-2.0" ]
1992    }
1993  }
1994
1995  if (is_linux && cef_use_gtk) {
1996    pkg_config("gtk") {
1997      packages = [
1998        "gmodule-2.0",
1999        "gtk+-3.0",
2000        "gthread-2.0",
2001        "gtk+-unix-print-3.0",
2002        "xi",
2003      ]
2004    }
2005  }
2006
2007  if (is_linux) {
2008    copy("copy_cefclient_files") {
2009      sources = gypi_paths2.shared_sources_resources +
2010                gypi_paths2.cefclient_sources_resources
2011      outputs = [ "${root_out_dir}/cefclient_files/{{source_file_part}}" ]
2012    }
2013
2014    copy("copy_cefclient_files_extensions_set_page_color") {
2015      sources =
2016          gypi_paths2.cefclient_sources_resources_extensions_set_page_color
2017      outputs = [ "${root_out_dir}/cefclient_files/extensions/set_page_color/{{source_file_part}}" ]
2018    }
2019  }
2020
2021  executable("cefclient") {
2022    sources =
2023        includes_common + gypi_paths2.includes_wrapper +
2024        gypi_paths2.shared_sources_browser + gypi_paths2.shared_sources_common +
2025        gypi_paths2.shared_sources_renderer +
2026        gypi_paths2.cefclient_sources_browser +
2027        gypi_paths2.cefclient_sources_common +
2028        gypi_paths2.cefclient_sources_renderer
2029
2030    deps = [
2031      ":libcef",
2032      ":libcef_dll_wrapper",
2033    ]
2034
2035    defines = [ "CEF_USE_SANDBOX" ]
2036
2037    if (is_win) {
2038      sources += includes_win + gypi_paths2.shared_sources_win +
2039                 gypi_paths2.cefclient_sources_win
2040
2041      # Set /SUBSYSTEM:WINDOWS.
2042      configs -= [ "//build/config/win:console" ]
2043      configs += [ "//build/config/win:windowed" ]
2044
2045      defines += [ "CEF_USE_ATL" ]
2046
2047      deps += [
2048        ":cef_sandbox",
2049        "//build/win:default_exe_manifest",
2050      ]
2051
2052      libs = [
2053        "comctl32.lib",
2054        "d3d11.lib",
2055        "imm32.lib",
2056        "oleacc.lib",
2057        "rpcrt4.lib",
2058        "shlwapi.lib",
2059      ]
2060
2061      if (target_cpu != "arm64") {
2062        libs += [
2063          "opengl32.lib",
2064          "glu32.lib",
2065        ]
2066      }
2067    }
2068
2069    if (is_linux) {
2070      sources += includes_linux + gypi_paths2.shared_sources_linux +
2071                 gypi_paths2.cefclient_sources_linux
2072
2073      deps += [
2074        ":copy_cefclient_files",
2075        ":copy_cefclient_files_extensions_set_page_color",
2076      ]
2077
2078      libs = [
2079        "GL",
2080        "X11",
2081      ]
2082
2083      if (cef_use_gtk) {
2084        configs += [ ":gtk" ]
2085      }
2086
2087      if (is_component_build) {
2088        if (use_allocator == "tcmalloc") {
2089          # Link to base to initialize tcmalloc allocator shims, otherwise
2090          # base::allocator::IsAllocatorInitialized check fails
2091          deps += [ "//base" ]
2092        }
2093      } else {
2094        # Set rpath to find our own libfreetype even in a non-component build.
2095        configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
2096      }
2097    }
2098  }
2099
2100  #
2101  # cefsimple targets.
2102  #
2103
2104  executable("cefsimple") {
2105    sources = includes_common + gypi_paths2.includes_wrapper +
2106              gypi_paths2.cefsimple_sources_common
2107
2108    deps = [
2109      ":libcef",
2110      ":libcef_dll_wrapper",
2111    ]
2112
2113    defines = [ "CEF_USE_SANDBOX" ]
2114
2115    if (is_win) {
2116      sources += includes_win + gypi_paths2.cefsimple_sources_win
2117
2118      # Set /SUBSYSTEM:WINDOWS.
2119      configs -= [ "//build/config/win:console" ]
2120      configs += [ "//build/config/win:windowed" ]
2121
2122      deps += [
2123        ":cef_sandbox",
2124        "//build/win:default_exe_manifest",
2125      ]
2126
2127      libs = [
2128        "comctl32.lib",
2129        "shlwapi.lib",
2130        "rpcrt4.lib",
2131      ]
2132    }
2133
2134    if (is_linux) {
2135      sources += includes_linux + gypi_paths2.cefsimple_sources_linux
2136
2137      if (ozone_platform_x11) {
2138        libs = [ "X11" ]
2139      }
2140
2141      if (!is_component_build) {
2142        # Set rpath to find our own libfreetype even in a non-component build.
2143        configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
2144      }
2145    }
2146  }
2147
2148  #
2149  # ceftests targets.
2150  #
2151
2152  if (is_linux) {
2153    copy("copy_ceftests_files") {
2154      sources = gypi_paths2.shared_sources_resources
2155      outputs = [ "${root_out_dir}/ceftests_files/{{source_file_part}}" ]
2156    }
2157  }
2158
2159  executable("ceftests") {
2160    testonly = true
2161
2162    sources =
2163        includes_common + gypi_paths2.includes_wrapper +
2164        gypi_paths2.shared_sources_browser + gypi_paths2.shared_sources_common +
2165        gypi_paths2.shared_sources_renderer +
2166        gypi_paths2.ceftests_sources_common
2167
2168    deps = [
2169      ":gtest_teamcity",
2170      ":libcef",
2171      ":libcef_dll_wrapper",
2172      "//testing/gtest",
2173    ]
2174
2175    defines = [ "CEF_USE_SANDBOX" ]
2176
2177    if (is_win) {
2178      sources +=
2179          gypi_paths2.shared_sources_win + gypi_paths2.ceftests_sources_win
2180
2181      deps += [
2182        ":cef_sandbox",
2183        "//build/win:default_exe_manifest",
2184      ]
2185    }
2186
2187    if (is_linux) {
2188      sources +=
2189          gypi_paths2.shared_sources_linux + gypi_paths2.ceftests_sources_linux
2190
2191      if (ozone_platform_x11) {
2192        libs = [ "X11" ]
2193      } else {
2194        if (!use_sysroot) {
2195          configs += [ ":glib" ]
2196        }
2197      }
2198
2199      deps += [ ":copy_ceftests_files" ]
2200    }
2201
2202    if (is_linux && !is_component_build) {
2203      # Set rpath to find our own libfreetype even in a non-component build.
2204      configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
2205    }
2206  }
2207}
2208