Commit 145bd277 authored by Jérémie Boulic's avatar Jérémie Boulic Committed by Chromium LUCI CQ

Files app: Generate JS modules for //u/f/f/cws_widget

In //ui/file_manager/file_manager/cws_widget/:
- app_installer.js
- cws_webview_client.js
- cws_widget_container_error_dialog.js
- cws_widget_container_platform_delegate.js
- cws_widget_container.js

Bug: 1133186
Change-Id: I66563e3ed21c99b168ab8c567f18fedcca26c5e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2619248
Commit-Queue: Jeremie Boulic <jboulic@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842040}
parent 3e023747
...@@ -3,8 +3,29 @@ ...@@ -3,8 +3,29 @@
# found in the LICENSE file. # found in the LICENSE file.
import("//third_party/closure_compiler/compile_js.gni") import("//third_party/closure_compiler/compile_js.gni")
import("//ui/webui/resources/js/cr.gni")
import("//ui/webui/resources/tools/js_modulizer.gni")
js_type_check("closure_compile") { group("closure_compile") {
testonly = true
deps = [
":closure_compile_jsmodules",
":closure_compile_module",
]
}
js_type_check("closure_compile_jsmodules") {
uses_js_modules = true
deps = [
":app_installer.m",
":cws_webview_client.m",
":cws_widget_container.m",
":cws_widget_container_error_dialog.m",
":cws_widget_container_platform_delegate.m",
]
}
js_type_check("closure_compile_module") {
deps = [ deps = [
":app_installer", ":app_installer",
":cws_webview_client", ":cws_webview_client",
...@@ -18,6 +39,15 @@ js_library("app_installer") { ...@@ -18,6 +39,15 @@ js_library("app_installer") {
deps = [ ":cws_widget_container_platform_delegate" ] deps = [ ":cws_widget_container_platform_delegate" ]
} }
js_library("app_installer.m") {
sources = [
"$root_gen_dir/ui/file_manager/file_manager/cws_widget/app_installer.m.js",
]
deps = [ ":cws_widget_container_platform_delegate.m" ]
extra_deps = [ ":modulize" ]
}
js_library("cws_widget_container") { js_library("cws_widget_container") {
deps = [ deps = [
":app_installer", ":app_installer",
...@@ -26,13 +56,40 @@ js_library("cws_widget_container") { ...@@ -26,13 +56,40 @@ js_library("cws_widget_container") {
] ]
} }
js_library("cws_widget_container.m") {
sources = [ "$root_gen_dir/ui/file_manager/file_manager/cws_widget/cws_widget_container.m.js" ]
deps = [
":app_installer.m",
":cws_webview_client.m",
":cws_widget_container_error_dialog.m",
":cws_widget_container_platform_delegate.m",
"//ui/webui/resources/js:assert.m",
]
externs_list = [ "$externs_path/webview_tag.js" ]
extra_deps = [ ":modulize" ]
}
js_library("cws_widget_container_error_dialog") { js_library("cws_widget_container_error_dialog") {
deps = [ "//ui/webui/resources/js/cr/ui:dialogs" ] deps = [ "//ui/webui/resources/js/cr/ui:dialogs" ]
} }
js_library("cws_widget_container_error_dialog.m") {
sources = [ "$root_gen_dir/ui/file_manager/file_manager/cws_widget/cws_widget_container_error_dialog.m.js" ]
deps = [ "//ui/webui/resources/js/cr/ui:dialogs.m" ]
extra_deps = [ ":modulize" ]
}
js_library("cws_widget_container_platform_delegate") { js_library("cws_widget_container_platform_delegate") {
} }
js_library("cws_widget_container_platform_delegate.m") {
sources = [ "$root_gen_dir/ui/file_manager/file_manager/cws_widget/cws_widget_container_platform_delegate.m.js" ]
extra_deps = [ ":modulize" ]
}
js_library("cws_webview_client") { js_library("cws_webview_client") {
deps = [ deps = [
":cws_widget_container_platform_delegate", ":cws_widget_container_platform_delegate",
...@@ -44,3 +101,27 @@ js_library("cws_webview_client") { ...@@ -44,3 +101,27 @@ js_library("cws_webview_client") {
"$externs_path/webview_tag.js", "$externs_path/webview_tag.js",
] ]
} }
js_library("cws_webview_client.m") {
sources = [ "$root_gen_dir/ui/file_manager/file_manager/cws_widget/cws_webview_client.m.js" ]
deps = [
":cws_widget_container_platform_delegate.m",
"//ui/webui/resources/js:cr.m",
"//ui/webui/resources/js/cr:event_target.m",
]
externs_list = [ "$externs_path/webview_tag.js" ]
extra_deps = [ ":modulize" ]
}
js_modulizer("modulize") {
input_files = [
"cws_widget_container_error_dialog.js",
"cws_widget_container.js",
"cws_webview_client.js",
"app_installer.js",
"cws_widget_container_platform_delegate.js",
]
namespace_rewrites = cr_namespace_rewrites
}
...@@ -2,10 +2,14 @@ ...@@ -2,10 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// clang-format off
// #import {CWSWidgetContainerPlatformDelegate} from './cws_widget_container_platform_delegate.m.js';
// clang-format on
/** /**
* Manage the installation of apps. * Manage the installation of apps.
*/ */
class AppInstaller { /* #export */ class AppInstaller {
/** /**
* @param {string} itemId Item id to be installed. * @param {string} itemId Item id to be installed.
* @param {!CWSWidgetContainerPlatformDelegate} delegate Delegate for * @param {!CWSWidgetContainerPlatformDelegate} delegate Delegate for
......
...@@ -2,7 +2,13 @@ ...@@ -2,7 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
class CWSContainerClient extends cr.EventTarget { // clang-format off
// #import {CWSWidgetContainerPlatformDelegate} from './cws_widget_container_platform_delegate.m.js';
// #import {NativeEventTarget as EventTarget} from 'chrome://resources/js/cr/event_target.m.js';
// #import {dispatchSimpleEvent} from 'chrome://resources/js/cr.m.js';
// clang-format on
/* #export */ class CWSContainerClient extends cr.EventTarget {
/** /**
* @param {WebView} webView Web View tag. * @param {WebView} webView Web View tag.
* @param {number} width Width of the CWS widget. * @param {number} width Width of the CWS widget.
......
...@@ -3,14 +3,21 @@ ...@@ -3,14 +3,21 @@
// found in the LICENSE file. // found in the LICENSE file.
/** /**
* CWSWidgetContainer contains a Chrome Web Store widget that displays list of * @fileoverview CWSWidgetContainer contains a Chrome Web Store widget that
* apps that satisfy certain constraints (e.g. fileHandler apps that can handle * displays list of apps that satisfy certain constraints (e.g. fileHandler apps
* files with specific file extension or MIME type) and enables the user to * that can handle files with specific file extension or MIME type) and enables
* install apps directly from it. * the user to install apps directly from it. CWSWidgetContainer implements
* CWSWidgetContainer implements client side of the widget, which handles * client side of the widget, which handles widget loading and app installation.
* widget loading and app installation.
*/ */
// clang-format off
// #import {CWSWidgetContainerMetricsImpl, CWSWidgetContainerPlatformDelegate} from './cws_widget_container_platform_delegate.m.js';
// #import {AppInstaller} from './app_installer.m.js';
// #import {CWSContainerClient} from './cws_webview_client.m.js';
// #import {CWSWidgetContainerErrorDialog} from './cws_widget_container_error_dialog.m.js';
// #import {assert} from 'chrome://resources/js/assert.m.js';
// clang-format on
/** /**
* The width of the widget (in pixels) * The width of the widget (in pixels)
* @type {number} * @type {number}
...@@ -43,7 +50,7 @@ const CWS_WIDGET_ORIGIN = 'https://clients5.google.com'; ...@@ -43,7 +50,7 @@ const CWS_WIDGET_ORIGIN = 'https://clients5.google.com';
/** /**
* Creates the widget container element in DOM tree. * Creates the widget container element in DOM tree.
*/ */
class CWSWidgetContainer { /* #export */ class CWSWidgetContainer {
/** /**
* *
* @param {!HTMLDocument} document The document to contain this container. * @param {!HTMLDocument} document The document to contain this container.
......
...@@ -2,17 +2,18 @@ ...@@ -2,17 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
class CWSWidgetContainerErrorDialog extends cr.ui.dialogs.BaseDialog { // #import {BaseDialog} from 'chrome://resources/js/cr/ui/dialogs.m.js';
/* #export */ class CWSWidgetContainerErrorDialog extends
cr.ui.dialogs.BaseDialog {
/** /**
* @param {HTMLElement} parentNode Node to be parent for this dialog. * @param {HTMLElement} parentNode Node to be parent for this dialog.
*/ */
constructor(parentNode) { constructor(parentNode) {
super(parentNode); super(parentNode);
if (util.isFilesNg()) {
this.container.classList.add('files-ng'); this.container.classList.add('files-ng');
} }
}
/** /**
* Whether the dialog is showm. * Whether the dialog is showm.
......
...@@ -23,7 +23,7 @@ let CWSWidgetContainerStrings; ...@@ -23,7 +23,7 @@ let CWSWidgetContainerStrings;
* recordInterval: function(string) * recordInterval: function(string)
* }} * }}
*/ */
let CWSWidgetContainerMetricsImpl; /* #export */ let CWSWidgetContainerMetricsImpl;
/** /**
* Type for delegate used by CWSWidgetContainer component to access Chrome * Type for delegate used by CWSWidgetContainer component to access Chrome
...@@ -36,4 +36,4 @@ let CWSWidgetContainerMetricsImpl; ...@@ -36,4 +36,4 @@ let CWSWidgetContainerMetricsImpl;
* requestWebstoreAccessToken: function(function(?string)) * requestWebstoreAccessToken: function(function(?string))
* }} * }}
*/ */
let CWSWidgetContainerPlatformDelegate; /* #export */ let CWSWidgetContainerPlatformDelegate;
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