Skip to content

Commit

Permalink
[journeys] Move history clusters components to cr_components
Browse files Browse the repository at this point in the history
Move history clusters components including shared styles to
cr_components. Additionally moved history shared styles and updated
build files.

Bug: 1310280
Change-Id: I5a67a5bd25cdad452a7885d256af1df86477e8d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3621566
Reviewed-by: Alex Gough <ajgo@chromium.org>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Marlon Facey <mfacey@chromium.org>
Reviewed-by: Tommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1001192}
  • Loading branch information
Marlon Facey authored and Chromium LUCI CQ committed May 9, 2022
1 parent 485dfc6 commit 18a7d7d
Show file tree
Hide file tree
Showing 45 changed files with 203 additions and 85 deletions.
2 changes: 1 addition & 1 deletion chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2013,7 +2013,6 @@ static_library("browser") {
"//chrome/browser/ui/webui/download_shelf:mojo_bindings",
"//chrome/browser/ui/webui/downloads:mojo_bindings",
"//chrome/browser/ui/webui/feed:mojo_bindings",
"//chrome/browser/ui/webui/history_clusters:mojo_bindings",
"//chrome/browser/ui/webui/internals/user_education:mojo_bindings",
"//chrome/browser/ui/webui/omnibox:mojo_bindings",
"//chrome/browser/ui/webui/realbox:mojo_bindings",
Expand Down Expand Up @@ -4554,6 +4553,7 @@ static_library("browser") {
"//third_party/sqlite",
"//third_party/zxcvbn-cpp",
"//ui/webui/resources/cr_components/app_management:mojo_bindings",
"//ui/webui/resources/cr_components/history_clusters:mojo_bindings",
]
public_deps += [
"//chrome/common:buildflags",
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/chrome_browser_interface_binders.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
#include "chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals_ui.h"
#include "chrome/browser/ui/webui/browsing_topics/browsing_topics_internals_ui.h"
#include "chrome/browser/ui/webui/engagement/site_engagement_ui.h"
#include "chrome/browser/ui/webui/history/history_ui.h"
#include "chrome/browser/ui/webui/history_clusters/history_clusters.mojom.h"
#include "chrome/browser/ui/webui/internals/internals_ui.h"
#include "chrome/browser/ui/webui/media/media_engagement_ui.h"
#include "chrome/browser/ui/webui/media/media_history_ui.h"
Expand Down Expand Up @@ -161,6 +159,7 @@
#endif
#include "chrome/browser/ui/webui/download_shelf/download_shelf.mojom.h"
#include "chrome/browser/ui/webui/download_shelf/download_shelf_ui.h"
#include "chrome/browser/ui/webui/history/history_ui.h"
#include "chrome/browser/ui/webui/internals/user_education/user_education_internals.mojom.h"
#include "chrome/browser/ui/webui/new_tab_page/new_tab_page.mojom.h"
#include "chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.h"
Expand All @@ -177,6 +176,7 @@
#include "components/search/ntp_features.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "ui/webui/resources/cr_components/customize_themes/customize_themes.mojom.h"
#include "ui/webui/resources/cr_components/history_clusters/history_clusters.mojom.h"
#include "ui/webui/resources/cr_components/most_visited/most_visited.mojom.h"
#include "ui/webui/resources/js/browser_command/browser_command.mojom.h"
#endif // BUILDFLAG(IS_ANDROID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/webui/history/history_ui.h"
#include "chrome/browser/ui/webui/history_clusters/history_clusters.mojom.h"
#include "chrome/browser/ui/webui/history_clusters/history_clusters_handler.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
Expand All @@ -30,6 +29,7 @@
#include "content/public/test/browser_test_utils.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source.h"
#include "ui/webui/resources/cr_components/history_clusters/history_clusters.mojom.h"

namespace history_clusters {

Expand Down
13 changes: 2 additions & 11 deletions chrome/browser/resources/history/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -113,28 +113,19 @@ ts_library("build_ts") {
out_dir = "$target_gen_dir/tsc"
composite = true
tsconfig_base = "tsconfig_base.json"
in_files = ts_files + css_wrapper_files + html_wrapper_files +
[ "history_clusters/history_clusters.mojom-webui.js" ]
in_files = ts_files + css_wrapper_files + html_wrapper_files
deps = [
"//third_party/polymer/v3_0:library",
"//ui/webui/resources:library",
"//ui/webui/resources/cr_components/history_clusters:build_ts",
"//ui/webui/resources/mojo:library",
]
definitions = [
"//tools/typescript/definitions/chrome_send.d.ts",
"//tools/typescript/definitions/metrics_private.d.ts",
]
extra_deps = [
":copy_history_clusters_mojom",
":preprocess",
":preprocess_generated",
]
}

copy("copy_history_clusters_mojom") {
sources = [ "$root_gen_dir/mojom-webui/chrome/browser/ui/webui/history_clusters/history_clusters.mojom-webui.js" ]
outputs = [
"$target_gen_dir/$preprocess_folder/history_clusters/{{source_file_part}}",
]
deps = [ "//chrome/browser/ui/webui/history_clusters:mojo_bindings_webui_js" ]
}
2 changes: 1 addition & 1 deletion chrome/browser/resources/history/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'chrome://resources/cr_components/history_clusters/clusters.js';
import 'chrome://resources/cr_elements/cr_lazy_render/cr_lazy_render.m.js';
import 'chrome://resources/cr_elements/shared_style_css.m.js';
import 'chrome://resources/cr_elements/shared_vars_css.m.js';
import 'chrome://resources/cr_elements/cr_tabs/cr_tabs.js';
import 'chrome://resources/polymer/v3_0/iron-media-query/iron-media-query.js';
import 'chrome://resources/polymer/v3_0/iron-pages/iron-pages.js';
import './history_clusters/clusters.js';
import './history_list.js';
import './history_toolbar.js';
import './query_manager.js';
Expand Down
12 changes: 0 additions & 12 deletions chrome/browser/resources/history/history.gni
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
# Files holding a Polymer element definition AND have an equivalent .html file.
web_component_files = [
"app.ts",
"history_clusters/cluster.ts",
"history_clusters/clusters.ts",
"history_clusters/menu_container.ts",
"history_clusters/page_favicon.ts",
"history_clusters/search_query.ts",
"history_clusters/url_visit.ts",
"history_item.ts",
"history_list.ts",
"history_toolbar.ts",
Expand All @@ -36,19 +30,13 @@ ts_files = [
"browser_service.ts",
"constants.ts",
"externs.ts",
"history_clusters/browser_proxy.ts",
"history_clusters/metrics_proxy.ts",
"history_clusters/open_window_proxy.ts",
"history_clusters/utils.ts",
"history.ts",
"lazy_load.ts",
"query_manager.ts",
"searched_label.ts",
] + web_component_files

css_wrapper_files = [
"history_clusters/shared_style.ts",
"history_clusters/shared_vars.ts",
"shared_icons.ts",
"shared_style.ts",
"shared_vars.ts",
Expand Down
7 changes: 3 additions & 4 deletions chrome/browser/resources/history/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@

import './app.js';

export {BrowserProxyImpl} from 'chrome://resources/cr_components/history_clusters/browser_proxy.js';
export {PageCallbackRouter, PageHandlerRemote} from 'chrome://resources/cr_components/history_clusters/history_clusters.mojom-webui.js';
export {ClusterAction, MetricsProxy, MetricsProxyImpl, RelatedSearchAction, VisitAction, VisitType} from 'chrome://resources/cr_components/history_clusters/metrics_proxy.js';
export {CrActionMenuElement} from 'chrome://resources/cr_elements/cr_action_menu/cr_action_menu.js';
export {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js';
export {ensureLazyLoaded, HistoryAppElement, listenForPrivilegedLinkClicks} from './app.js';
export {BrowserService, BrowserServiceImpl, QueryResult, RemoveVisitsRequest} from './browser_service.js';
export {HistoryPageViewHistogram, SYNCED_TABS_HISTOGRAM_NAME, SyncedTabsHistogram} from './constants.js';
export {ForeignSession, ForeignSessionTab, ForeignSessionWindow, HistoryEntry, HistoryQuery} from './externs.js';
export {BrowserProxyImpl} from './history_clusters/browser_proxy.js';
export {PageCallbackRouter, PageHandlerRemote} from './history_clusters/history_clusters.mojom-webui.js';
export {ClusterAction, RelatedSearchAction, VisitAction, VisitType} from './history_clusters/metrics_proxy.js';
export {MetricsProxy, MetricsProxyImpl} from './history_clusters/metrics_proxy.js';
export {HistoryItemElement} from './history_item.js';
export {ActionMenuModel, HistoryListElement} from './history_list.js';
export {HistoryToolbarElement} from './history_toolbar.js';
Expand Down
2 changes: 0 additions & 2 deletions chrome/browser/resources/history/history_clusters/OWNERS

This file was deleted.

4 changes: 2 additions & 2 deletions chrome/browser/resources/history/side_bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import './shared_icons.js';
import './shared_style.js';
import './strings.m.js';

import {BrowserProxyImpl} from 'chrome://resources/cr_components/history_clusters/browser_proxy.js';
import {MetricsProxyImpl} from 'chrome://resources/cr_components/history_clusters/metrics_proxy.js';
import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
import {IronSelectorElement} from 'chrome://resources/polymer/v3_0/iron-selector/iron-selector.js';
import {PaperRippleElement} from 'chrome://resources/polymer/v3_0/paper-ripple/paper-ripple.js';
import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';

import {BrowserServiceImpl} from './browser_service.js';
import {BrowserProxyImpl} from './history_clusters/browser_proxy.js';
import {MetricsProxyImpl} from './history_clusters/metrics_proxy.js';
import {Page, TABBED_PAGES} from './router.js';
import {getTemplate} from './side_bar.html.js';

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@ static_library("ui") {
"//chrome/browser/ui/webui/bluetooth_internals",
"//chrome/browser/ui/webui/download_shelf:mojo_bindings",
"//chrome/browser/ui/webui/downloads:mojo_bindings",
"//chrome/browser/ui/webui/history_clusters:mojo_bindings",
"//chrome/browser/ui/webui/omnibox:mojo_bindings",
"//chrome/browser/ui/webui/realbox:mojo_bindings",
"//chrome/browser/ui/webui/segmentation_internals:mojo_bindings",
Expand Down Expand Up @@ -1825,6 +1824,7 @@ static_library("ui") {
"//ui/base/dragdrop/mojom",
"//ui/events",
"//ui/webui/resources/cr_components/app_management:mojo_bindings",
"//ui/webui/resources/cr_components/history_clusters:mojo_bindings",
"//ui/webui/resources/js/browser_command:mojo_bindings",
"//ui/webui/resources/js/metrics_reporter:mojo_bindings",
]
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/webui/history/history_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
#include <memory>

#include "base/gtest_prod_util.h"
#include "chrome/browser/ui/webui/history_clusters/history_clusters.mojom-forward.h"
#include "components/prefs/pref_change_registrar.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "ui/base/layout.h"
#include "ui/webui/mojo_web_ui_controller.h"
#include "ui/webui/resources/cr_components/history_clusters/history_clusters.mojom-forward.h"

namespace base {
class RefCountedMemory;
Expand Down
14 changes: 0 additions & 14 deletions chrome/browser/ui/webui/history_clusters/BUILD.gn

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/webui/history_clusters/history_clusters.mojom.h"
#include "components/history/core/browser/history_types.h"
#include "components/history_clusters/core/config.h"
#include "components/history_clusters/core/features.h"
Expand All @@ -34,6 +33,7 @@
#include "content/public/browser/web_contents.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/l10n/time_format.h"
#include "ui/webui/resources/cr_components/history_clusters/history_clusters.mojom.h"
#include "url/gurl.h"

namespace history_clusters {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
#include "base/memory/weak_ptr.h"
#include "base/scoped_observation.h"
#include "base/task/cancelable_task_tracker.h"
#include "chrome/browser/ui/webui/history_clusters/history_clusters.mojom.h"
#include "components/history/core/browser/history_types.h"
#include "components/history_clusters/core/history_clusters_service.h"
#include "components/history_clusters/core/query_clusters_state.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "ui/webui/resources/cr_components/history_clusters/history_clusters.mojom.h"

class Profile;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/webui/history/history_ui.h"
#include "chrome/browser/ui/webui/history_clusters/history_clusters.mojom.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/history_clusters/core/features.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "ui/webui/resources/cr_components/history_clusters/history_clusters.mojom.h"

namespace history_clusters {

Expand Down
2 changes: 1 addition & 1 deletion chrome/test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,6 @@ if (!is_android) {
"//chrome/browser/sharing/proto",
"//chrome/browser/ui/color:color_headers",
"//chrome/browser/ui/tabs:tab_enums",
"//chrome/browser/ui/webui/history_clusters:mojo_bindings",
"//chrome/browser/web_applications:browser_tests",
"//chrome/browser/web_applications:browser_tests_base",
"//chrome/browser/web_applications:web_applications_test_support",
Expand Down Expand Up @@ -1469,6 +1468,7 @@ if (!is_android) {
"//ui/web_dialogs:test_support",
"//ui/webui",
"//ui/webui:test_support",
"//ui/webui/resources/cr_components/history_clusters:mojo_bindings",
"//v8",
]

Expand Down
2 changes: 1 addition & 1 deletion tools/gritsettings/resource_ids.spec
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@
"structures": [4880],
},
"<(SHARED_INTERMEDIATE_DIR)/ui/webui/resources/webui_generated_resources.grd": {
"META": {"sizes": {"includes": [800]}},
"META": {"sizes": {"includes": [1000]}},
"includes": [4900],
},
"weblayer/weblayer_resources.grd": {
Expand Down
1 change: 1 addition & 0 deletions ui/webui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ static_library("webui") {
public_deps += [
"//ui/webui/resources/cr_components/color_change_listener:mojom",
"//ui/webui/resources/cr_components/customize_themes:mojom",
"//ui/webui/resources/cr_components/history_clusters:mojo_bindings",
"//ui/webui/resources/cr_components/most_visited:mojom",
]
}
Expand Down
5 changes: 5 additions & 0 deletions ui/webui/resources/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ generate_grd("build_grd") {
"$root_gen_dir/third_party/polymer/v1_0/polymer_1_0_resources.grdp",
]
}

if (!is_android) {
deps += [ "cr_components/history_clusters:build_grdp" ]
grdp_files += [ "$root_gen_dir/ui/webui/resources/cr_components/history_clusters/resources.grdp" ]
}
}

if (is_chromeos_ash) {
Expand Down
86 changes: 86 additions & 0 deletions ui/webui/resources/cr_components/history_clusters/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Copyright 2022 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("//mojo/public/tools/bindings/mojom.gni")
import("//tools/grit/preprocess_if_expr.gni")
import("//tools/polymer/html_to_js.gni")
import("//tools/polymer/html_to_wrapper.gni")
import("//tools/typescript/ts_library.gni")
import("//ui/webui/resources/tools/generate_grd.gni")
import("history_clusters.gni")

assert(!is_android)

# Output folder used to hold preprocess_if_expr() output.
preprocess_folder_tmp = "$root_gen_dir/ui/webui/resources/preprocessed/cr_components/history_clusters_tmp"

# Output folder used to hold ts_library() output.
preprocess_folder = "$root_gen_dir/ui/webui/resources/preprocessed/cr_components/history_clusters"

mojom("mojo_bindings") {
sources = [ "history_clusters.mojom" ]
public_deps = [
"//mojo/public/mojom/base",
"//url/mojom:url_mojom_gurl",
]
webui_module_path = "chrome://resources/cr_components/history_clusters/"
}

html_to_js("css_wrapper_files") {
js_files = css_wrapper_files
}

html_to_wrapper("html_wrapper_files") {
in_files = html_files
}

copy("copy_history_clusters_mojom") {
sources = [ "$root_gen_dir/mojom-webui/ui/webui/resources/cr_components/history_clusters/history_clusters.mojom-webui.js" ]
outputs = [ "$preprocess_folder_tmp/{{source_file_part}}" ]
deps = [ ":mojo_bindings_webui_js" ]
}

generate_grd("build_grdp") {
grd_prefix = "cr_components_history_clusters"
out_grd = "$target_gen_dir/resources.grdp"
deps = [ ":build_ts" ]
manifest_files = [ "$target_gen_dir/tsconfig.manifest" ]
resource_path_prefix = "cr_components/history_clusters"
}

preprocess_if_expr("preprocess") {
in_folder = "."
out_folder = preprocess_folder_tmp
in_files = ts_files
}

preprocess_if_expr("preprocess_generated") {
deps = [
":css_wrapper_files",
":html_wrapper_files",
]
in_folder = target_gen_dir
out_folder = preprocess_folder_tmp
in_files = html_wrapper_files + css_wrapper_files
}

ts_library("build_ts") {
root_dir = preprocess_folder_tmp
out_dir = preprocess_folder
composite = true
tsconfig_base = "tsconfig_base.json"
in_files = ts_files + css_wrapper_files + html_wrapper_files +
[ "history_clusters.mojom-webui.js" ]
deps = [
"//third_party/polymer/v3_0:library",
"//ui/webui/resources:library",
"//ui/webui/resources/mojo:library",
]
definitions = [ "//tools/typescript/definitions/metrics_private.d.ts" ]
extra_deps = [
":copy_history_clusters_mojom",
":preprocess",
":preprocess_generated",
]
}

0 comments on commit 18a7d7d

Please sign in to comment.