Skip to content

Commit

Permalink
Revert "[memories] Removes chrome://memories"
Browse files Browse the repository at this point in the history
This reverts commit 04d8997.

Reason for revert: Closed the tree [1].

[1] https://ci.chromium.org/ui/p/chromium/builders/ci/Win%20x64%20Builder%20(dbg)/132854/overview

Original change's description:
> [memories] Removes chrome://memories
>
> With crrev.com/c/3046546, <history-clusters> previously hosted under
> chrome://memories is now hosted under chrome://history/journeys. This
> change moves the necessary resources from //c/b/r/memories to
> //c/b/r/history/history_clusters and deletes the rest along with the
> code related to chrome://memories
>
> Fixed: 1229397
> Change-Id: I1fa6632e974a4a5108da923f1209518d4423798a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3058392
> Commit-Queue: Moe Ahmadi <mahmadi@chromium.org>
> Reviewed-by: dpapad <dpapad@chromium.org>
> Reviewed-by: Colin Blundell <blundell@chromium.org>
> Reviewed-by: Alex Gough <ajgo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#906553}

Change-Id: I887c029c51321d0b0114e7372e4d1f11028ec9bf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3060581
Auto-Submit: Daniel Hosseinian <dhoss@chromium.org>
Owners-Override: Daniel Hosseinian <dhoss@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/master@{#906823}
  • Loading branch information
Daniel Hosseinian authored and Chromium LUCI CQ committed Jul 29, 2021
1 parent 4f369ec commit b832389
Show file tree
Hide file tree
Showing 43 changed files with 368 additions and 60 deletions.
3 changes: 2 additions & 1 deletion chrome/browser/chrome_browser_interface_binders.cc
Expand Up @@ -136,6 +136,7 @@
#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_clusters/history_clusters.mojom.h"
#include "chrome/browser/ui/webui/history_clusters/memories_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 Down Expand Up @@ -691,7 +692,7 @@ void PopulateChromeWebUIFrameBinders(

if (base::FeatureList::IsEnabled(history_clusters::kMemories)) {
RegisterWebUIControllerInterfaceBinder<history_clusters::mojom::PageHandler,
HistoryUI>(map);
HistoryUI, MemoriesUI>(map);
}

RegisterWebUIControllerInterfaceBinder<
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/flag_descriptions.cc
Expand Up @@ -1588,11 +1588,11 @@ const char kMediaSessionWebRTCDescription[] =
"Adds new actions into Media Session for video conferencing.";

const char kMemoriesName[] = "Memories";
const char kMemoriesDescription[] = "Enables chrome://history/journeys.";
const char kMemoriesDescription[] = "Enables chrome://memories.";

const char kMemoriesDebugName[] = "Memories Debug";
const char kMemoriesDebugDescription[] =
"Shows visit metadata in chrome://history to debug history clustering.";
"Show debug information for chrome://memories.";

const char kMetricsSettingsAndroidName[] = "Metrics Settings on Android";
const char kMetricsSettingsAndroidDescription[] =
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/resources/BUILD.gn
Expand Up @@ -35,6 +35,7 @@ group("resources") {
"gaia_auth_host:resources",
"history:resources",
"management:resources",
"memories:resources",
"new_tab_page:resources",
"new_tab_page_instant:resources",
"new_tab_page_third_party:resources",
Expand Down
55 changes: 29 additions & 26 deletions chrome/browser/resources/history/BUILD.gn
Expand Up @@ -70,7 +70,6 @@ preprocess_if_expr("preprocess") {
"browser_service.ts",
"constants.ts",
"externs.ts",
"history_clusters/browser_proxy.ts",
"history.ts",
"lazy_load.ts",
"query_manager.ts",
Expand All @@ -84,14 +83,6 @@ preprocess_if_expr("preprocess_generated") {
out_folder = "$target_gen_dir/$preprocess_folder"
in_files = [
"app.ts",
"history_clusters/cluster.ts",
"history_clusters/clusters.ts",
"history_clusters/page_favicon.ts",
"history_clusters/search_query.ts",
"history_clusters/shared_style.ts",
"history_clusters/shared_vars.ts",
"history_clusters/top_visit.ts",
"history_clusters/url_visit.ts",
"history_item.ts",
"history_list.ts",
"history_toolbar.ts",
Expand Down Expand Up @@ -121,7 +112,7 @@ grit("resources") {
output_dir = "$root_gen_dir/chrome"
}

html_to_js("web_components_local") {
html_to_js("web_components") {
js_files = [
"app.ts",
"history_item.ts",
Expand All @@ -136,13 +127,6 @@ html_to_js("web_components_local") {
]
}

group("web_components") {
public_deps = [
":web_components_local",
"history_clusters:web_components",
]
}

ts_library("build_ts") {
root_dir = "$target_gen_dir/$preprocess_folder"
out_dir = "$target_gen_dir/tsc"
Expand All @@ -152,16 +136,16 @@ ts_library("build_ts") {
"browser_service.ts",
"constants.ts",
"externs.ts",
"history_clusters/browser_proxy.ts",
"history_clusters/cluster.ts",
"history_clusters/clusters.ts",
"history_clusters/browser_proxy.js",
"history_clusters/cluster.js",
"history_clusters/clusters.js",
"history_clusters/history_clusters.mojom-webui.js",
"history_clusters/page_favicon.ts",
"history_clusters/search_query.ts",
"history_clusters/shared_style.ts",
"history_clusters/shared_vars.ts",
"history_clusters/top_visit.ts",
"history_clusters/url_visit.ts",
"history_clusters/page_favicon.js",
"history_clusters/search_query.js",
"history_clusters/shared_style.js",
"history_clusters/shared_vars.js",
"history_clusters/top_visit.js",
"history_clusters/visit_row.js",
"history_item.ts",
"history_list.ts",
"history_toolbar.ts",
Expand All @@ -182,12 +166,31 @@ ts_library("build_ts") {
]
definitions = [ "//tools/typescript/definitions/chrome_send.d.ts" ]
extra_deps = [
":copy_history_clusters",
":copy_history_clusters_mojom",
":preprocess",
":preprocess_generated",
]
}

copy("copy_history_clusters") {
sources = [
"$target_gen_dir/../memories/tsc/browser_proxy.js",
"$target_gen_dir/../memories/tsc/cluster.js",
"$target_gen_dir/../memories/tsc/clusters.js",
"$target_gen_dir/../memories/tsc/page_favicon.js",
"$target_gen_dir/../memories/tsc/search_query.js",
"$target_gen_dir/../memories/tsc/shared_style.js",
"$target_gen_dir/../memories/tsc/shared_vars.js",
"$target_gen_dir/../memories/tsc/top_visit.js",
"$target_gen_dir/../memories/tsc/visit_row.js",
]
outputs = [
"$target_gen_dir/$preprocess_folder/history_clusters/{{source_file_part}}",
]
deps = [ "//chrome/browser/resources/memories:build_ts" ]
}

copy("copy_history_clusters_mojom") {
sources = [ "$root_gen_dir/mojom-webui/chrome/browser/ui/webui/history_clusters/history_clusters.mojom-webui.js" ]
outputs = [
Expand Down
18 changes: 0 additions & 18 deletions chrome/browser/resources/history/history_clusters/BUILD.gn

This file was deleted.

11 changes: 11 additions & 0 deletions chrome/browser/resources/memories/.eslintrc.js
@@ -0,0 +1,11 @@
// Copyright 2021 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.

module.exports = {
'env': {
'browser': true,
'es6': true,
},
'rules': {'eqeqeq': ['error', 'always', {'null': 'ignore'}]},
};
@@ -1,2 +1 @@
mahmadi@chromium.org
file://components/history_clusters/OWNERS
20 changes: 20 additions & 0 deletions chrome/browser/resources/memories/app.html
@@ -0,0 +1,20 @@
<style>
:host {
display: block;
}

cr-toolbar {
--cr-toolbar-field-width: var(--cluster-width);
}

history-clusters {
height: calc(100% - var(--cr-toolbar-height));
overflow-x: hidden;
}
</style>
<clusters-router query="{{query_}}"></clusters-router>
<cr-toolbar id="toolbar" page-name="History Clusters"
clear-label="$i18n{clearLabel}" search-prompt="$i18n{searchPrompt}"
on-search-changed="onSearchChanged_">
</cr-toolbar>
<history-clusters query="{{query_}}"></history-clusters>
96 changes: 96 additions & 0 deletions chrome/browser/resources/memories/app.ts
@@ -0,0 +1,96 @@
// Copyright 2021 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 './clusters.js';
import './router.js';
import './shared_vars.js';
import 'chrome://resources/cr_elements/cr_toolbar/cr_toolbar.js';

import {CrToolbarElement} from 'chrome://resources/cr_elements/cr_toolbar/cr_toolbar.js';
import {CrToolbarSearchFieldElement} from 'chrome://resources/cr_elements/cr_toolbar/cr_toolbar_search_field.js';
import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';

/**
* @fileoverview This file provides the root custom element for the Clusters
* landing page.
*/

const RESULTS_PER_PAGE: number = 5;

declare global {
interface HTMLElementTagNameMap {
'clusters-app': HistoryClustersAppElement,
}

interface Window {
// https://github.com/microsoft/TypeScript/issues/40807
requestIdleCallback(callback: () => void): void;
}
}

interface HistoryClustersAppElement {
$: {
toolbar: CrToolbarElement,
};
}

class HistoryClustersAppElement extends PolymerElement {
static get is() {
return 'clusters-app';
}

static get template() {
return html`{__html_template__}`;
}

static get properties() {
return {
/**
* The current query for which related Clusters are requested and shown.
*/
query_: {
type: String,
observer: 'onQueryChanged_',
},
};
}

//============================================================================
// Properties
//============================================================================

private query_: string = '';

//============================================================================
// Event handlers
//============================================================================

/**
* Called when the value of the search field changes.
*/
private onSearchChanged_(event: CustomEvent<string>) {
// Update the query based on the value of the search field, if necessary.
if (event.detail !== this.query_) {
this.query_ = event.detail;
}
}

//============================================================================
// Helper methods
//============================================================================

private getSearchField_(): CrToolbarSearchFieldElement {
return this.$.toolbar.getSearchField();
}

private onQueryChanged_() {
// Update the value of the search field based on the query, if necessary.
const searchField = this.getSearchField_();
if (searchField.getValue() !== this.query_) {
searchField.setValue(this.query_);
}
}
}

customElements.define(HistoryClustersAppElement.is, HistoryClustersAppElement);
Expand Up @@ -150,12 +150,12 @@ class HistoryClustersElement extends PolymerElement {
}

/**
* Called when an event is received from a cluster that should be removed or
* Called with `event` received from a cluster that should be removed or
* restructured due to all its visits or its top visit having been removed.
* Contains the id of the Cluster in question.
* @private
*/
private onClusterChangedOrRemoved_() {
private onClusterChangedOrRemoved_(event: CustomEvent<bigint>) {
// Request up to as many of the freshest clusters as currently shown until
// now.
this.onBrowserIdle_().then(() => {
Expand Down
31 changes: 31 additions & 0 deletions chrome/browser/resources/memories/history_clusters.html
@@ -0,0 +1,31 @@
<!doctype html>
<html dir="$i18n{textdirection}" lang="$i18n{language}">
<head>
<meta charset="utf-8">
<meta name="color-scheme" content="light dark">
<title>$i18n{title}</title>
<link rel="stylesheet" href="chrome://resources/css/md_colors.css">
<link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css">
<style>
html {
background: var(--md-background-color);
}

body {
font-size: 16px; /* TODO(crbug.com/1173990): Remove once fixed. */
margin: 0;
}

html,
body,
clusters-app {
height: 100%;
}
</style>
</head>
<body>
<script type="module" src="strings.m.js"></script>
<script type="module" src="history_clusters/history_clusters.js"></script>
<clusters-app></clusters-app>
</body>
</html>
5 changes: 5 additions & 0 deletions chrome/browser/resources/memories/history_clusters.ts
@@ -0,0 +1,5 @@
// Copyright 2021 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 './app.js';
3 changes: 3 additions & 0 deletions chrome/browser/resources/memories/router.html
@@ -0,0 +1,3 @@
<iron-location query="{{queryParamsString_}}" dwell-time="200"></iron-location>
<iron-query-params params-string="{{queryParamsString_}}"
params-object="{{queryParamsObject_}}"></iron-query-params>

0 comments on commit b832389

Please sign in to comment.