Commit 3c3e5374 authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Commit Bot

Files app: Generate JS modules for some files in //ui/file_manager/file_manager/common/js/

Files:
- util.js
- mock_entry.js
- files_app_entry_types.js

Bug: b/172300267, chromium:1133186
Change-Id: I8819f4ce6fbf1ab4bd137d4edaa6a87ea5955928
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2519331
Auto-Submit: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarJeremie Boulic <jboulic@chromium.org>
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823933}
parent f980ed60
......@@ -5,6 +5,8 @@
import("//third_party/closure_compiler/compile_js.gni")
import("//third_party/closure_compiler/js_unit_tests.gni")
import("//ui/file_manager/base/gn/js_test_gen_html.gni")
import("//ui/webui/resources/js/cr.gni")
import("//ui/webui/resources/tools/js_modulizer.gni")
# TODO(tapted): This entire folder should move to //ui/file_manager/base.
visibility = [ "//ui/file_manager/*" ]
......@@ -12,6 +14,7 @@ visibility = [ "//ui/file_manager/*" ]
group("closure_compile") {
testonly = true
deps = [
":closure_compile_jsmodules",
":closure_compile_module",
":js_test_gen_html_type_check_auto",
":test_support_type_check",
......@@ -34,6 +37,15 @@ js_type_check("closure_compile_module") {
]
}
js_type_check("closure_compile_jsmodules") {
uses_js_modules = true
deps = [
":files_app_entry_types.m",
":mock_entry.m",
":util.m",
]
}
js_type_check("test_support_type_check") {
testonly = true
deps = [
......@@ -62,6 +74,16 @@ js_unittest("files_app_entry_types_unittest") {
]
}
js_library("files_app_entry_types.m") {
sources = [ "$root_gen_dir/ui/file_manager/file_manager/common/js/files_app_entry_types.m.js" ]
deps = [
"//ui/file_manager/base/js:volume_manager_types.m",
"//ui/file_manager/externs:volume_info.m",
]
extra_deps = [ ":modulize" ]
}
js_library("file_type") {
deps = [
":files_app_entry_types",
......@@ -143,6 +165,14 @@ js_library("mock_entry") {
]
}
js_library("mock_entry.m") {
sources =
[ "$root_gen_dir/ui/file_manager/file_manager/common/js/mock_entry.m.js" ]
deps = [ ":util.m" ]
extra_deps = [ ":modulize" ]
}
js_library("progress_center_common") {
}
......@@ -190,6 +220,26 @@ js_unittest("util_unittest") {
]
}
js_library("util.m") {
sources = [ "$root_gen_dir/ui/file_manager/file_manager/common/js/util.m.js" ]
deps = [
":files_app_entry_types.m",
"//ui/file_manager/externs:entry_location.m",
"//ui/file_manager/externs:file_manager_private",
"//ui/file_manager/externs:files_app_entry_interfaces.m",
"//ui/file_manager/externs:volume_manager.m",
"//ui/webui/resources/js:load_time_data.m",
]
externs_list = [
"//ui/file_manager/externs/platform.js",
"//ui/file_manager/externs/app_window_common.js",
]
extra_deps = [ ":modulize" ]
}
js_test_gen_html("js_test_gen_html") {
deps = [
":file_type_unittest",
......@@ -199,3 +249,13 @@ js_test_gen_html("js_test_gen_html") {
":util_unittest",
]
}
js_modulizer("modulize") {
input_files = [
"files_app_entry_types.js",
"mock_entry.js",
"util.js",
]
namespace_rewrites = cr_namespace_rewrites
}
......@@ -21,7 +21,11 @@
* https://developer.mozilla.org/en-US/docs/Web/API/FileSystemDirectoryReader
*/
// clang-format off
// #import * as wrappedVolumeManagerCommon from '../../../base/js/volume_manager_types.m.js'; const {VolumeManagerCommon} = wrappedVolumeManagerCommon;
// #import {FilesAppEntry, FilesAppDirEntry, FakeEntry} from '../../../externs/files_app_entry_interfaces.m.js';
// #import {VolumeInfo} from '../../../externs/volume_info.m.js';
// clang-format on
/**
* A reader compatible with DirectoryEntry.createReader (from Web Standards)
......@@ -31,7 +35,7 @@
* entries.
* @extends {DirectoryReader}
*/
class StaticReader {
/* #export */ class StaticReader {
/**
* @param {!Array<!Entry|!FilesAppEntry>} entries: Array of Entry-like
* instances that will be returned/read by this reader.
......@@ -66,7 +70,7 @@ class StaticReader {
* entries from all readers.
* @extends {DirectoryReader}
*/
class CombinedReaders {
/* #export */ class CombinedReaders {
/**
* @param {!Array<!DirectoryReader>} readers Array of all readers that will
* have their entries combined.
......@@ -124,7 +128,7 @@ class CombinedReaders {
*
* @implements FilesAppDirEntry
*/
class EntryList {
/* #export */ class EntryList {
/**
* @param {string} label: Label to be used when displaying to user, it should
* already translated.
......@@ -321,7 +325,7 @@ class EntryList {
*
* @implements FilesAppDirEntry
*/
class VolumeEntry {
/* #export */ class VolumeEntry {
/**
* @param {!VolumeInfo} volumeInfo: VolumeInfo for this entry.
*/
......@@ -589,7 +593,7 @@ class VolumeEntry {
*
* @implements FakeEntry
*/
class FakeEntryImpl {
/* #export */ class FakeEntryImpl {
/**
* @param {string} label Translated text to be displayed to user.
* @param {!VolumeManagerCommon.RootType} rootType Root type of this entry.
......
......@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// #import * as wrappedUtil from './util.m.js'; const {util} = wrappedUtil;
/**
* Joins paths so that the two paths are connected by only 1 '/'.
* @param {string} a Path.
......@@ -17,7 +19,7 @@ function joinPath(a, b) {
*
* @extends {FileSystem}
*/
class MockFileSystem {
/* #export */ class MockFileSystem {
/**
* @param {string} volumeId Volume ID.
* @param {string=} opt_rootURL URL string of root which is used in
......@@ -105,7 +107,7 @@ class MockFileSystem {
}
/** @interface */
class MockEntryInterface {
/* #export */ class MockEntryInterface {
/**
* Clones the entry with the new fullpath.
*
......@@ -122,7 +124,7 @@ class MockEntryInterface {
* @extends {Entry}
* @implements {MockEntryInterface}
*/
class MockEntry {
/* #export */ class MockEntry {
/**
* @param {FileSystem} filesystem File system where the entry is located.
* @param {string} fullPath Full path of the entry.
......@@ -290,7 +292,7 @@ class MockEntry {
*
* @implements {MockEntryInterface}
*/
class MockFileEntry extends MockEntry {
/* #export */ class MockFileEntry extends MockEntry {
/**
* @param {FileSystem} filesystem File system where the entry is located.
* @param {string} fullPath Full path for the entry.
......@@ -365,7 +367,7 @@ class MockFileEntry extends MockEntry {
* Mock class for FileWriter.
* @extends {FileWriter}
*/
class MockFileWriter {
/* #export */ class MockFileWriter {
/**
* @param {!MockFileEntry} entry
*/
......@@ -390,7 +392,7 @@ class MockFileWriter {
*
* @implements {MockEntryInterface}
*/
class MockDirectoryEntry extends MockEntry {
/* #export */ class MockDirectoryEntry extends MockEntry {
/**
* @param {FileSystem} filesystem File system where the entry is located.
* @param {string} fullPath Full path for the entry.
......@@ -518,7 +520,7 @@ class MockDirectoryEntry extends MockEntry {
* Mock class for DirectoryReader.
* @extends {DirectoryReader}
*/
class MockDirectoryReader {
/* #export */ class MockDirectoryReader {
/**
* @param {!Array<!Entry>} entries
*/
......
......@@ -6,8 +6,22 @@
* @fileoverview This file should contain utility functions used only by the
* files app. Other shared utility functions can be found in base/*_util.js,
* which allows finer-grained control over introducing dependencies.
* @suppress {uselessCode} Temporary suppress because of the line exporting.
*/
// clang-format off
// #import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
// #import {queryRequiredElement} from 'chrome://resources/js/util.m.js';
// #import {assert} from 'chrome://resources/js/assert.m.js';
// #import * as wrappedVolumeManagerCommon from '../../../base/js/volume_manager_types.m.js'; const {VolumeManagerCommon} = wrappedVolumeManagerCommon;
// #import {decorate} from 'chrome://resources/js/cr/ui.m.js';
// #import {FilesAppEntry, FakeEntry} from '../../../externs/files_app_entry_interfaces.m.js';
// #import {EntryList} from './files_app_entry_types.m.js';
// #import {VolumeInfo} from '../../../externs/volume_info.m.js';
// #import {EntryLocation} from '../../../externs/entry_location.m.js';
// #import {VolumeManager} from '../../../externs/volume_manager.m.js';
// clang-format on
/**
* Namespace for utility functions.
*/
......@@ -1755,3 +1769,6 @@ util.isHoldingSpaceEnabled = () => {
return loadTimeData.valueExists('HOLDING_SPACE_ENABLED') &&
loadTimeData.getBoolean('HOLDING_SPACE_ENABLED');
};
// eslint-disable-next-line semi,no-extra-semi
/* #export */ {util};
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