Commit f37aa1b9 authored by oka's avatar oka Committed by Commit bot

Compile file_manager_commands in gyp v2.

There were circular deps between file_manager_commands and file_manager.
This change removes dependency from file_manager_commands to
file_manager by extracting an interface from FileManager needed for
file_manager_commands to compile.
Also inlined some simple methods in FileManager, which are used
only from file_manager_commands.

BUG=636289
TEST=run_compiler
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2846163002
Cr-Commit-Position: refs/heads/master@{#467917}
parent 6c540a0c
// Copyright 2017 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.
/**
* Interface on which |CommandHandler| depends.
* @interface
*/
function CommandHandlerDeps(){};
/**
* @type {ActionsController}
*/
CommandHandlerDeps.prototype.actionsController;
/**
* @type {BackgroundWindow}
*/
CommandHandlerDeps.prototype.backgroundPage;
/**
* @type {DialogType}
*/
CommandHandlerDeps.prototype.dialogType;
/**
* @type {DirectoryModel}
*/
CommandHandlerDeps.prototype.directoryModel;
/**
* @type {DirectoryTree}
*/
CommandHandlerDeps.prototype.directoryTree;
/**
* @type {DirectoryTreeNamingController}
*/
CommandHandlerDeps.prototype.directoryTreeNamingController;
/**
* @type {Document}
*/
CommandHandlerDeps.prototype.document;
/**
* @type {FileFilter}
*/
CommandHandlerDeps.prototype.fileFilter;
/**
* @type {FileOperationManager}
*/
CommandHandlerDeps.prototype.fileOperationManager;
/**
* @type {FileTransferController}
*/
CommandHandlerDeps.prototype.fileTransferController;
/**
* @type {FileSelectionHandler}
*/
CommandHandlerDeps.prototype.selectionHandler;
/**
* @type {NamingController}
*/
CommandHandlerDeps.prototype.namingController;
/**
* @type {ProvidersModel}
*/
CommandHandlerDeps.prototype.providersModel;
/**
* @type {SpinnerController}
*/
CommandHandlerDeps.prototype.spinnerController;
/**
* @type {TaskController}
*/
CommandHandlerDeps.prototype.taskController;
/**
* @type {FileManagerUI}
*/
CommandHandlerDeps.prototype.ui;
/**
* @type {VolumeManagerWrapper}
*/
CommandHandlerDeps.prototype.volumeManager;
/**
* @return {DirectoryEntry|FakeEntry}
*/
CommandHandlerDeps.prototype.getCurrentDirectoryEntry = function() {};
/**
* @return {FileSelection}
*/
CommandHandlerDeps.prototype.getSelection = function() {};
......@@ -44,6 +44,10 @@
'target_name': 'chrome_webstore_widget_private',
'includes': ['../../../third_party/closure_compiler/include_js.gypi'],
},
{
'target_name': 'command_handler_deps',
'includes': ['../../../third_party/closure_compiler/include_js.gypi'],
},
{
'target_name': 'connection',
'includes': ['../../../third_party/closure_compiler/include_js.gypi'],
......
......@@ -179,6 +179,7 @@
'../../../externs/chrome_echo_private.js',
'../../../externs/chrome_test.js',
'../../../externs/chrome_webstore_widget_private.js',
'../../../externs/command_handler_deps.js',
'../../../externs/connection.js',
'../../../externs/css_rule.js',
'../../../externs/directory_change_event.js',
......
......@@ -148,10 +148,29 @@
# 'target_name': 'file_manager',
# 'includes': ['../../../compile_js2.gypi'],
# },
# {
# 'target_name': 'file_manager_commands',
# 'includes': ['../../../compile_js2.gypi'],
# },
{
'target_name': 'file_manager_commands',
'dependencies': [
'../../../externs/compiled_resources2.gyp:background_window',
'../../../externs/compiled_resources2.gyp:command_handler_deps',
'../../background/js/compiled_resources2.gyp:file_operation_manager',
'actions_controller',
'dialog_type',
'directory_contents',
'directory_model',
'directory_tree_naming_controller',
'file_selection',
'file_transfer_controller',
'naming_controller',
'providers_model',
'spinner_controller',
'task_controller',
'ui/compiled_resources2.gyp:directory_tree',
'ui/compiled_resources2.gyp:file_manager_ui',
'volume_manager_wrapper',
],
'includes': ['../../../compile_js2.gypi'],
},
{
'target_name': 'file_selection',
'dependencies': [
......
......@@ -8,6 +8,7 @@
* FileManager objects encapsulate the functionality of the file selector
* dialogs, as well as the full screen file manager application.
*
* @implements {CommandHandlerDeps}
* @constructor
* @struct
*/
......@@ -335,6 +336,12 @@ FileManager.prototype = /** @struct */ {
get directoryModel() {
return this.directoryModel_;
},
/**
* @return {DirectoryTreeNamingController}
*/
get directoryTreeNamingController() {
return this.directoryTreeNamingController_;
},
/**
* @return {!FileFilter}
*/
......@@ -371,6 +378,12 @@ FileManager.prototype = /** @struct */ {
get metadataModel() {
return this.metadataModel_;
},
/**
* @return {FileSelectionHandler}
*/
get selectionHandler() {
return this.selectionHandler_;
},
/**
* @return {DirectoryTree}
*/
......@@ -1093,13 +1106,6 @@ FileManager.prototype = /** @struct */ {
this.launchParams_);
};
/**
* @return {DirectoryTreeNamingController}
*/
FileManager.prototype.getDirectoryTreeNamingController = function() {
return this.directoryTreeNamingController_;
};
/**
* @private
*/
......@@ -1369,40 +1375,6 @@ FileManager.prototype = /** @struct */ {
}
};
/**
* TODO(mtomasz): Move this to a utility function working on the root type.
* @return {boolean} True if the current directory content is from Google
* Drive.
*/
FileManager.prototype.isOnDrive = function() {
return this.directoryModel_.isOnDrive();
};
/**
* @return {boolean} True if the current directory content is from MTP volume.
*/
FileManager.prototype.isOnMTP = function() {
return this.directoryModel_.isOnMTP();
};
/**
* Check if the drive-related setting items should be shown on currently
* displayed gear menu.
* @return {boolean} True if those setting items should be shown.
*/
FileManager.prototype.shouldShowDriveSettings = function() {
return this.isOnDrive();
};
/**
* Tells whether the current directory is read only.
* TODO(mtomasz): Remove and use EntryLocation directly.
* @return {boolean} True if read only, false otherwise.
*/
FileManager.prototype.isOnReadonlyDirectory = function() {
return this.directoryModel_.isReadOnly();
};
/**
* Return DirectoryEntry of the current directory or null.
* @return {DirectoryEntry|FakeEntry} DirectoryEntry of the current directory.
......
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