| # Copyright 2024 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//chrome/common/features.gni") |
| import("//components/optimization_guide/features.gni") |
| import("//pdf/features.gni") |
| |
| assert(build_with_model_execution) |
| assert(is_win || is_mac || is_linux || is_chromeos || is_android) |
| |
| source_set("ai") { |
| sources = [ |
| "ai_context_bound_object.h", |
| "ai_context_bound_object_set.h", |
| "ai_create_on_device_session_task.h", |
| "ai_data_keyed_service.h", |
| "ai_data_keyed_service_factory.h", |
| "ai_language_model.h", |
| "ai_manager.h", |
| "ai_on_device_session.h", |
| "ai_proofreader.h", |
| "ai_rewriter.h", |
| "ai_summarizer.h", |
| "ai_writer.h", |
| "built_in_ai_logger.cc", |
| "built_in_ai_logger.h", |
| "features.cc", |
| "features.h", |
| ] |
| |
| configs += [ |
| "//build/config/compiler:wexit_time_destructors", |
| "//build/config/compiler:wglobal_constructors", |
| ] |
| public_deps = [ |
| "//base", |
| "//chrome/browser:browser_process", |
| "//chrome/browser/ai:ai_model_download_progress_manager", |
| "//chrome/browser/ai:ai_utils", |
| "//chrome/browser/optimization_guide", |
| "//chrome/browser/profiles:profile", |
| "//components/component_updater", |
| "//components/optimization_guide/core", |
| "//components/update_client", |
| "//content/public/browser", |
| ] |
| if (enable_glic) { |
| public_deps += [ "//chrome/browser/glic" ] |
| } |
| if (!is_android) { |
| public_deps += [ "//chrome/browser/actor" ] |
| } |
| } |
| |
| source_set("ai_utils") { |
| sources = [ "ai_utils.h" ] |
| |
| deps = [ |
| "//components/optimization_guide/core", |
| "//content/public/browser", |
| ] |
| } |
| |
| source_set("impl") { |
| sources = [ |
| "ai_context_bound_object.cc", |
| "ai_context_bound_object_set.cc", |
| "ai_create_on_device_session_task.cc", |
| "ai_data_keyed_service.cc", |
| "ai_data_keyed_service_factory.cc", |
| "ai_language_model.cc", |
| "ai_manager.cc", |
| "ai_on_device_session.cc", |
| "ai_proofreader.cc", |
| "ai_rewriter.cc", |
| "ai_summarizer.cc", |
| "ai_utils.cc", |
| "ai_writer.cc", |
| ] |
| |
| configs += [ |
| "//build/config/compiler:wexit_time_destructors", |
| "//build/config/compiler:wglobal_constructors", |
| ] |
| |
| public_deps = [ |
| "//chrome/browser:browser_public_dependencies", |
| "//chrome/browser/ui", |
| "//components/content_extraction/content/browser", |
| ] |
| deps = [ |
| ":ai", |
| "//chrome/browser/ui/tabs:tabs_public", |
| "//components/autofill/content/browser", |
| "//components/autofill/core/browser", |
| "//components/history_embeddings", |
| "//components/language/core/common", |
| "//components/optimization_guide/content/browser", |
| "//components/site_engagement/content", |
| "//pdf:buildflags", |
| "//skia", |
| ] |
| if (!is_android) { |
| deps += [ |
| "//chrome/browser/ui/browser_window", |
| "//chrome/browser/ui/tabs:tab_group", |
| "//chrome/browser/ui/tabs:tab_strip", |
| ] |
| } |
| if (enable_pdf) { |
| deps += [ |
| "//components/pdf/browser", |
| "//components/pdf/common:constants", |
| ] |
| } |
| } |
| |
| source_set("ai_model_download_progress_manager") { |
| sources = [ |
| "ai_crx_component.cc", |
| "ai_crx_component.h", |
| "ai_model_download_progress_manager.cc", |
| "ai_model_download_progress_manager.h", |
| "ai_never_load_component.cc", |
| "ai_never_load_component.h", |
| ] |
| public_deps = [ |
| "//base", |
| "//chrome/browser:browser_process", |
| "//chrome/browser/ai:ai_utils", |
| "//components/component_updater", |
| "//components/update_client", |
| "//content/public/browser", |
| "//mojo/public/cpp/bindings", |
| ] |
| } |
| |
| source_set("test_support") { |
| testonly = true |
| sources = [ |
| "ai_test_utils.cc", |
| "ai_test_utils.h", |
| ] |
| public_deps = [ |
| "//chrome/browser/optimization_guide", |
| "//chrome/browser/optimization_guide:test_support", |
| "//chrome/test:test_support", |
| "//components/component_updater:test_support", |
| "//components/optimization_guide/core:test_support", |
| "//testing/gmock", |
| "//testing/gtest", |
| ] |
| deps = [ ":ai" ] |
| } |
| |
| source_set("unit_tests") { |
| testonly = true |
| sources = [ |
| "ai_crx_component_unittest.cc", |
| "ai_language_model_unittest.cc", |
| "ai_manager_unittest.cc", |
| "ai_model_download_progress_manager_unittest.cc", |
| "ai_proofreader_unittest.cc", |
| "ai_rewriter_unittest.cc", |
| "ai_summarizer_unittest.cc", |
| "ai_writer_unittest.cc", |
| ] |
| deps = [ |
| ":ai", |
| ":ai_model_download_progress_manager", |
| ":test_support", |
| "//chrome/browser/optimization_guide:test_support", |
| "//components/optimization_guide/core:test_support", |
| ] |
| } |