| # Copyright 2025 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| if (is_android) { |
| import("//build/config/android/rules.gni") |
| import("//third_party/jni_zero/jni_zero.gni") |
| } |
| |
| if (is_android) { |
| generate_jni("jni_headers") { |
| sources = [ "android/java/src/org/chromium/components/contextual_search/InputState.java" ] |
| } |
| |
| java_cpp_enum("java_enum_srcjar") { |
| visibility = [ ":*" ] |
| sources = [ "contextual_search_types.h" ] |
| } |
| |
| android_library("components_contextual_search_java") { |
| sources = [ "android/java/src/org/chromium/components/contextual_search/InputState.java" ] |
| srcjar_deps = [ ":java_enum_srcjar" ] |
| |
| # Important: the generated enum uses the @IntDef annotation provided by |
| # this dependency. |
| deps = [ |
| "//base:log_java", |
| "//third_party/android_deps:protobuf_lite_runtime_java", |
| "//third_party/androidx:androidx_annotation_annotation_java", |
| "//third_party/jni_zero:jni_zero_java", |
| "//third_party/omnibox_proto:omnibox_proto_java", |
| ] |
| } |
| |
| robolectric_library("junit") { |
| sources = [ "android/java/src/org/chromium/components/contextual_search/InputStateTest.java" ] |
| deps = [ |
| ":components_contextual_search_java", |
| "//base:base_java", |
| "//base:base_java_test_support", |
| "//base:base_junit_test_support", |
| "//third_party/android_deps:protobuf_lite_runtime_java", |
| "//third_party/junit", |
| "//third_party/omnibox_proto:omnibox_proto_java", |
| ] |
| } |
| } |
| |
| # Public interface target - contains the public types and abstract service API. |
| source_set("public") { |
| sources = [ |
| "contextual_search_context_controller.h", |
| "contextual_search_metrics_recorder.h", |
| "contextual_search_service.h", |
| "contextual_search_session_handle.h", |
| "input_state_model.h", |
| ] |
| |
| deps = [ |
| "//components/keyed_service/core", |
| "//components/lens/proto/server:proto", |
| "//components/omnibox/common", |
| "//components/omnibox/composebox:mojo_bindings", |
| "//components/prefs", |
| "//components/search_engines", |
| "//components/sessions", |
| "//components/signin/public/identity_manager", |
| "//components/variations", |
| "//components/version_info:channel", |
| "//mojo/public/mojom/base", |
| "//services/network/public/cpp", |
| "//third_party/omnibox_proto", |
| "//url", |
| ] |
| |
| public_deps = [ |
| ":types", |
| "//base", |
| "//components/lens", |
| "//third_party/lens_server_proto:lens_overlay_proto", |
| ] |
| } |
| |
| source_set("types") { |
| sources = [ |
| "contextual_search_types.cc", |
| "contextual_search_types.h", |
| ] |
| |
| public_deps = [ |
| "//base", |
| "//components/lens", |
| "//components/sessions:session_id", |
| "//third_party/lens_server_proto:lens_overlay_proto", |
| "//url", |
| ] |
| } |
| |
| # Public implementation target - contains the service implementation. |
| source_set("impl") { |
| sources = [ |
| "contextual_search_metrics_recorder.cc", |
| "contextual_search_service.cc", |
| "contextual_search_session_entry.cc", |
| "contextual_search_session_entry.h", |
| "contextual_search_session_handle.cc", |
| "input_state_model.cc", |
| ] |
| |
| deps = [ |
| ":prefs", |
| ":public", |
| "//components/contextual_search/internal", |
| "//components/lens", |
| "//components/lens/proto/server:proto", |
| "//components/omnibox/common", |
| "//components/pref_registry", |
| "//components/search_engines", |
| "//components/signin/public/identity_manager", |
| "//components/variations", |
| "//components/version_info:channel", |
| "//services/network/public/cpp", |
| "//url", |
| ] |
| } |
| |
| source_set("test_support") { |
| testonly = true |
| sources = [ |
| "fake_variations_client.cc", |
| "fake_variations_client.h", |
| "mock_contextual_search_context_controller.cc", |
| "mock_contextual_search_context_controller.h", |
| "mock_contextual_search_service.cc", |
| "mock_contextual_search_service.h", |
| "mock_contextual_search_session_handle.cc", |
| "mock_contextual_search_session_handle.h", |
| ] |
| public_deps = [ "//components/variations:variations_mojom" ] |
| deps = [ |
| ":public", |
| "//components/lens/proto/server:proto", |
| "//components/variations", |
| "//testing/gmock", |
| ] |
| } |
| |
| source_set("unit_tests") { |
| testonly = true |
| sources = [ |
| "contextual_search_metrics_recorder_unittest.cc", |
| "contextual_search_service_unittest.cc", |
| "contextual_search_session_entry_unittest.cc", |
| "contextual_search_session_handle_unittest.cc", |
| "input_state_model_unittest.cc", |
| ] |
| |
| deps = [ |
| ":impl", |
| ":prefs", |
| ":public", |
| ":test_support", |
| "//base/test:test_support", |
| "//components/lens", |
| "//components/lens/proto/server:proto", |
| "//components/omnibox/common", |
| "//components/prefs:test_support", |
| "//components/search_engines:test_support", |
| "//components/signin/public/identity_manager:test_support", |
| "//components/variations", |
| "//services/network:test_support", |
| "//services/network/public/cpp", |
| "//testing/gmock", |
| "//testing/gtest", |
| ] |
| |
| if (!is_fuchsia) { |
| sources += [ "search_content_sharing_policy_handler_unittest.cc" ] |
| deps += [ |
| ":policy_handler", |
| ":prefs", |
| ] |
| } |
| } |
| |
| if (!is_fuchsia) { |
| source_set("policy_handler") { |
| sources = [ |
| "search_content_sharing_policy_handler.cc", |
| "search_content_sharing_policy_handler.h", |
| ] |
| |
| deps = [ |
| ":prefs", |
| "//components/policy:generated", |
| "//components/policy/core/browser", |
| "//components/prefs", |
| ] |
| } |
| } |
| |
| source_set("prefs") { |
| sources = [ "pref_names.h" ] |
| } |