Commit 000b7760 authored by dpapad's avatar dpapad Committed by Chromium LUCI CQ

WebUI cleanup: Move cr.ui.CardSlider/TouchHandler in c/b/r/ntp4.

CardSlider and TouchHandler are not used anywhere else, therefore
there is no need to reside in shared WebUI code.

Moreover, since those files are inlined with flattenhtml=true, there
was no need to include and serve them separately as stand-alone files.

Bug: None
Change-Id: I482b4ef71a1f80025c16568e62e5681085d2e981
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2616971
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Auto-Submit: dpapad <dpapad@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841689}
parent f482da2b
......@@ -19,7 +19,6 @@ js_library("apps_page") {
"//ui/webui/resources/js/cr/event_target.js",
"//ui/webui/resources/js/cr/ui.js",
"//ui/webui/resources/js/cr/ui/bubble.js",
"//ui/webui/resources/js/cr/ui/card_slider.js",
"//ui/webui/resources/js/cr/ui/command.js",
"//ui/webui/resources/js/cr/ui/context_menu_handler.js",
"//ui/webui/resources/js/cr/ui/drag_wrapper.js",
......@@ -29,7 +28,6 @@ js_library("apps_page") {
"//ui/webui/resources/js/cr/ui/menu_button.js",
"//ui/webui/resources/js/cr/ui/menu_item.js",
"//ui/webui/resources/js/cr/ui/position_util.js",
"//ui/webui/resources/js/cr/ui/touch_handler.js",
"//ui/webui/resources/js/event_tracker.js",
"//ui/webui/resources/js/icon.js",
"//ui/webui/resources/js/load_time_data.js",
......@@ -37,12 +35,14 @@ js_library("apps_page") {
"//ui/webui/resources/js/promise_resolver.js",
"//ui/webui/resources/js/util.js",
"apps_page.js",
"card_slider.js",
"dot_list.js",
"nav_dot.js",
"new_tab.js",
"page_list_view.js",
"page_switcher.js",
"tile_page.js",
"touch_handler.js",
"trash.js",
]
......
......@@ -23,7 +23,7 @@
// Use an anonymous function to enable strict mode just for this file (which
// will be concatenated with other files when embedded in Chrome
cr.define('cr.ui', function() {
cr.define('ntp', function() {
'use strict';
/**
......@@ -67,10 +67,10 @@ cr.define('cr.ui', function() {
this.cardWidth_ = cardWidth;
/**
* @type {!cr.ui.TouchHandler}
* @type {!ntp.TouchHandler}
* @private
*/
this.touchHandler_ = new cr.ui.TouchHandler(this.container_);
this.touchHandler_ = new ntp.TouchHandler(this.container_);
}
......@@ -146,7 +146,7 @@ cr.define('cr.ui', function() {
// available. Note that this has minimal impact in the common case of
// no touch events (eg. we're mainly just adding listeners for events that
// will never trigger).
const TouchHandler = cr.ui.TouchHandler;
const TouchHandler = ntp.TouchHandler;
this.container_.addEventListener(
TouchHandler.EventType.TOUCH_START, this.onTouchStart_.bind(this));
this.container_.addEventListener(
......@@ -611,7 +611,7 @@ cr.define('cr.ui', function() {
* @private
*/
onTouchStart_(e) {
e = /** @type {!cr.ui.TouchHandler.Event} */ (e);
e = /** @type {!ntp.TouchHandler.Event} */ (e);
this.container_.style.transition = '';
e.enableDrag = true;
},
......@@ -623,7 +623,7 @@ cr.define('cr.ui', function() {
* @private
*/
onDragStart_(e) {
e = /** @type {!cr.ui.TouchHandler.Event} */ (e);
e = /** @type {!ntp.TouchHandler.Event} */ (e);
e.enableDrag =
this.cardCount > 1 && Math.abs(e.dragDeltaX) > Math.abs(e.dragDeltaY);
},
......@@ -635,7 +635,7 @@ cr.define('cr.ui', function() {
* @private
*/
onDragMove_(e) {
e = /** @type {!cr.ui.TouchHandler.Event} */ (e);
e = /** @type {!ntp.TouchHandler.Event} */ (e);
let deltaX = e.dragDeltaX;
// If dragging beyond the first or last card then apply a backoff so the
// dragging feels stickier than usual.
......@@ -653,7 +653,7 @@ cr.define('cr.ui', function() {
* @private
*/
onDragEnd_(e) {
e = /** @type {!cr.ui.TouchHandler.Event} */ (e);
e = /** @type {!ntp.TouchHandler.Event} */ (e);
const deltaX = e.dragDeltaX;
const velocity = this.touchHandler_.getEndVelocity().x;
const newX = this.currentLeft_ + deltaX;
......
......@@ -38,7 +38,6 @@ $('themecss').href = 'chrome://theme/css/new_tab_theme.css?' + Date.now();
<script src="../../../../ui/webui/resources/js/cr/event_target.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui/bubble.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui/card_slider.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui/context_menu_handler.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui/drag_wrapper.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui/focus_manager.js"></script>
......@@ -46,13 +45,14 @@ $('themecss').href = 'chrome://theme/css/new_tab_theme.css?' + Date.now();
<script src="../../../../ui/webui/resources/js/cr/ui/menu.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui/position_util.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui/menu_button.js"></script>
<script src="../../../../ui/webui/resources/js/cr/ui/touch_handler.js"></script>
<script src="../../../../ui/webui/resources/js/icon.js"></script>
<script src="tile_page.js"></script>
<script src="apps_page.js"></script>
<script src="dot_list.js"></script>
<script src="trash.js"></script>
<script src="touch_handler.js"></script>
<script src="card_slider.js"></script>
<script src="page_list_view.js"></script>
<script src="page_switcher.js"></script>
......
......@@ -62,7 +62,7 @@ cr.define('ntp', function() {
PageListView.prototype = {
/**
* The CardSlider object to use for changing app pages.
* @type {cr.ui.CardSlider|undefined}
* @type {ntp.CardSlider|undefined}
*/
cardSlider: undefined,
......@@ -184,7 +184,7 @@ cr.define('ntp', function() {
// Initialize the cardSlider without any cards at the moment.
this.sliderFrame = cardSliderFrame;
this.cardSlider = new cr.ui.CardSlider(
this.cardSlider = new ntp.CardSlider(
this.sliderFrame, this.pageList, this.sliderFrame.offsetWidth);
// Prevent touch events from triggering any sort of native scrolling if
......
......@@ -31,7 +31,7 @@
// Use an anonymous function to enable strict mode just for this file (which
// will be concatenated with other files when embedded in Chrome)
cr.define('cr.ui', function() {
cr.define('ntp', function() {
'use strict';
/**
......
......@@ -39,7 +39,6 @@ preprocess_if_expr("preprocess_src") {
"array_data_model.js",
"bubble_button.js",
"bubble.js",
"card_slider.js",
"command.js",
"context_menu_handler.js",
"dialogs.js",
......@@ -63,7 +62,6 @@ preprocess_if_expr("preprocess_src") {
"store_client.js",
"store.js",
"tabs.js",
"touch_handler.js",
"tree.js",
]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment