# Copyright (c) 2025 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build/ohos.gni")

ohos_shared_library("webview_common") {
  if (target_cpu == "arm64") {
    branch_protector_ret = "pac_ret"
  }

  include_dirs = [
     "../../native",
    "../../../ohos_adapter/ohos_resource_adapter/include",
    "../../../ohos_adapter/system_properties_adapter/include",
  ]

  sources = [
    "web_history_list.cpp",
    "web_history_list.h",
    "web_message_port.cpp",
    "web_message_port.h",
    "web_errors.cpp",
    "transfer_referenced_count.h",
    "napi_native_mediaplayer_handler_impl.cpp",
    "napi_native_mediaplayer_handler_impl.h",
    "web_resource_handler.cpp",
    "web_resource_handler.h",
    "web_scheme_handler_request.cpp",
    "web_scheme_handler_request.h",
    "web_scheme_handler_response.cpp",
    "web_scheme_handler_response.h",
    "nweb_user_agent_brand_version_impl.cpp",
    "nweb_user_agent_brand_version_impl.h",
    "nweb_user_agent_metadata_impl.cpp",
    "nweb_user_agent_metadata_impl.h",
  ]

  deps = [
    "../../../ohos_adapter:nweb_ohos_adapter",
    "../../../ohos_nweb:libnweb",
    "../../native:ohweb",
    "../../../ohos_glue:ohos_base_glue_source",
  ]
  use_exceptions = true
  external_deps = [
    "ability_base:extractortool",
    "ability_runtime:app_context",
    "bundle_framework:appexecfwk_base",
    "bundle_framework:appexecfwk_core",
    "c_utils:utils",
    "common_event_service:cesfwk_innerkits",
    "hilog:libhilog",
    "image_framework:image",
    "image_framework:image_native",
    "init:libbegetutil",
    "ipc:ipc_core",
    "protobuf:protobuf_lite",
    "samgr:samgr_proxy",
    "window_manager:libwm",
  ]

  part_name = "webview"
  subsystem_name = "web"
}