# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/ui.gni")

static_library("browser") {
  sources = [
    "base_bookmark_model_observer.cc",
    "base_bookmark_model_observer.h",
    "bookmark_client.cc",
    "bookmark_client.h",
    "bookmark_codec.cc",
    "bookmark_codec.h",
    "bookmark_expanded_state_tracker.cc",
    "bookmark_expanded_state_tracker.h",
    "bookmark_index.cc",
    "bookmark_index.h",
    "bookmark_match.cc",
    "bookmark_match.h",
    "bookmark_model.cc",
    "bookmark_model.h",
    "bookmark_model_observer.h",
    "bookmark_node.cc",
    "bookmark_node.h",
    "bookmark_node_data.cc",
    "bookmark_node_data.h",
    "bookmark_node_data_ios.cc",
    "bookmark_node_data_mac.cc",
    "bookmark_pasteboard_helper_mac.h",
    "bookmark_pasteboard_helper_mac.mm",
    "bookmark_storage.cc",
    "bookmark_storage.h",
    "bookmark_undo_delegate.h",
    "bookmark_undo_provider.h",
    "bookmark_utils.cc",
    "bookmark_utils.h",
    "scoped_group_bookmark_actions.cc",
    "scoped_group_bookmark_actions.h",
    "startup_task_runner_service.cc",
    "startup_task_runner_service.h",
  ]

  public_deps = [
    "//components/bookmarks/common",
  ]

  deps = [
    "//base",
    "//base:i18n",
    "//components/favicon_base",
    "//components/keyed_service/core",
    "//components/pref_registry",
    "//components/prefs",
    "//components/query_parser",
    "//components/strings",
    "//components/url_formatter",
    "//net",
    "//third_party/icu",
    "//ui/base",
    "//ui/gfx",
    "//url",
  ]

  if (toolkit_views) {
    sources += [ "bookmark_node_data_views.cc" ]
    deps += [ "//ui/views" ]
  }

  if (is_mac) {
    libs = [
      "AppKit.framework",
      "Foundation.framework",
    ]
  }
}

bundle_data("unit_tests_bundle_data") {
  visibility = [ ":unit_tests" ]
  testonly = true
  sources = [
    "//components/test/data/bookmarks/meta_info_as_string.json",
    "//components/test/data/bookmarks/model_without_sync.json",
  ]
  outputs = [
    "{{bundle_resources_dir}}/" +
        "{{source_root_relative_dir}}/{{source_file_part}}",
  ]
}

source_set("unit_tests") {
  testonly = true
  sources = [
    "bookmark_codec_unittest.cc",
    "bookmark_expanded_state_tracker_unittest.cc",
    "bookmark_index_unittest.cc",
    "bookmark_model_unittest.cc",
    "bookmark_utils_unittest.cc",
  ]

  if (toolkit_views) {
    sources += [ "bookmark_node_data_unittest.cc" ]
  }

  configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]

  deps = [
    ":browser",
    ":unit_tests_bundle_data",
    "//components/bookmarks/common",
    "//components/bookmarks/test",
    "//components/favicon_base",
    "//components/pref_registry",
    "//components/prefs",
    "//components/prefs:test_support",
    "//testing/gtest",
    "//ui/base",
    "//url",
  ]
}
