910e62b5创建于 1月15日历史提交
# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/locales.gni")
import("//ios/build/chrome_build.gni")
import("//ios/chrome/extension_repack.gni")
import("//ios/chrome/tools/strings/generate_localizable_strings.gni")

assert(
    ios_enable_share_extension,
    "ios_enable_share_extension must be true to depend on //ios/chrome/share_extension")

group("resources") {
  deps = [ "//ios/chrome/share_extension/strings" ]
}

repack_locales("packed_resources") {
  input_locales = platform_pak_locales
  output_locales = locales_as_apple_outputs

  source_patterns = [
    "$root_gen_dir/ios/share_extension/ios_share_extension_branded_strings_",
    "$root_gen_dir/ios/share_extension/ios_share_extension_strings_",
  ]

  deps = [ "//ios/chrome/share_extension/strings" ]
}

source_set("share") {
  sources = [
    "ui_util.h",
    "ui_util.mm",
  ]

  deps = [
    ":system_strings",
    "//base",
    "//ios/chrome/common:extension_open_url",
    "//ios/chrome/common/app_group",
    "//ios/chrome/common/app_group:command",
    "//ios/chrome/common/crash_report",
    "//ios/chrome/common/ui/colors",
    "//ios/chrome/common/ui/util",
  ]

  frameworks = [
    "Foundation.framework",
    "CoreGraphics.framework",
    "MobileCoreServices.framework",
    "UIKit.framework",
    "UniformTypeIdentifiers.framework",
  ]
  if (ios_enable_extended_share_extension) {
    sources += [
      "account_info.h",
      "account_info.mm",
      "account_picker_delegate.h",
      "account_picker_table.h",
      "account_picker_table.mm",
      "extended_share_view_controller.h",
      "extended_share_view_controller.mm",
      "share_extension_delegate.h",
      "share_extension_sheet.h",
      "share_extension_sheet.mm",
    ]
    deps += [
      "//build:branding_buildflags",
      "//ios/chrome/common/ui/button_stack",
      "//ios/chrome/common/ui/confirmation_alert",
      "//ios/chrome/common/ui/elements:branded_navigation_item_title_view",
      "//ios/chrome/share_extension/resources",
    ]
  } else {
    sources += [
      "share_extension_view.h",
      "share_extension_view.mm",
      "share_view_controller.h",
      "share_view_controller.mm",
    ]
  }
}

generate_localizable_strings("system_strings") {
  visibility = [ "//ios/chrome/share_extension/*" ]
  _packed_resources_target = ":packed_resources"
  config_file = "share_extension_localize_strings_config.plist"
  datapack_dir = get_label_info(_packed_resources_target, "target_gen_dir")
  packed_locales = locales_as_apple_outputs
  output_filenames = [ "Localizable.strings" ]
  deps = [ _packed_resources_target ]
}