Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: ui/file_manager/file_manager/foreground/js/file_manager.js

Issue 792233009: Reflect scanning status in command UI. Only allow import once scanning is complete. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix FM.jstests.cc && Finalize scan results in MediaImportHandlerTest...unbreaking the test. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/file_manager/file_manager/foreground/js/file_manager.js
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager.js b/ui/file_manager/file_manager/foreground/js/file_manager.js
index 1680e15a5a4ffeea8ea7bbd29a29c7a6d7cd0d40..6026d45a949b73425ca4830c98c9deb34e5f7381 100644
--- a/ui/file_manager/file_manager/foreground/js/file_manager.js
+++ b/ui/file_manager/file_manager/foreground/js/file_manager.js
@@ -23,11 +23,7 @@ function FileManager() {
*/
this.volumeManager_ = null;
- /**
- * History loader. Gimme summa 'dat history!
- * @type {importer.HistoryLoader}
- * @private
- */
+ /** @private {importer.HistoryLoader} */
this.historyLoader_ = null;
/**
@@ -48,6 +44,15 @@ function FileManager() {
*/
this.onHistoryChangedBound_ = this.onHistoryChanged_.bind(this);
+ /** @private {importer.MediaScanner} */
+ this.mediaScanner_ = null;
+
+ /** @private {importer.ImportController} */
+ this.importController_ = null;
+
+ /** @private {importer.MediaImportHandler} */
+ this.mediaImportHandler_ = null;
+
/**
* Metadata cache.
* @type {MetadataCache}
@@ -104,11 +109,6 @@ function FileManager() {
this.selectionHandler_ = null;
/**
- * @private {importer.MediaImportHandler}
- */
- this.mediaImportHandler_ = null;
-
- /**
* UI management class of file manager.
* @type {FileManagerUI}
* @private
@@ -319,16 +319,16 @@ FileManager.prototype = /** @struct */ {
return this.volumeManager_;
},
/**
- * @return {importer.HistoryLoader}
+ * @return {importer.ImportController}
*/
- get historyLoader() {
- return this.historyLoader_;
+ get importController() {
+ return this.importController_;
},
/**
- * @return {MetadataCache}
+ * @return {importer.HistoryLoader}
*/
- get metadataCache() {
- return this.metadataCache_;
+ get historyLoader() {
+ return this.historyLoader_;
},
/**
* @return {importer.MediaImportHandler}
@@ -337,6 +337,12 @@ FileManager.prototype = /** @struct */ {
return this.mediaImportHandler_;
},
/**
+ * @return {MetadataCache}
+ */
+ get metadataCache() {
+ return this.metadataCache_;
+ },
+ /**
* @return {FileManagerUI}
*/
get ui() {
@@ -531,6 +537,23 @@ Object.freeze(DialogType);
this.commandHandler = new CommandHandler(this);
+ // Kick the import enabled promise to be sure it is loaded
+ // (and cached) for use by code that requires synchronous
+ // access (e.g. Commands).
+ importer.importEnabled().then(
+ function(enabled) {
+ if (enabled) {
+ this.importController_ = new importer.ImportController(
+ new importer.RuntimeControllerEnvironment(this),
+ /** @type {!importer.MediaScanner} */ (
+ this.mediaScanner_),
+ /** @type {!importer.ImportRunner} */ (
+ this.mediaImportHandler_),
+ this.commandHandler.updateAvailability.bind(
+ this.commandHandler));
+ }
+ }.bind(this));
+
// TODO(hirono): Move the following block to the UI part.
var commandButtons = this.dialogDom_.querySelectorAll('button[command]');
for (var j = 0; j < commandButtons.length; j++)
@@ -639,10 +662,6 @@ Object.freeze(DialogType);
// Initialize the member variables that depend this.launchParams_.
this.dialogType = this.launchParams_.type;
- // Kick the import enabled promise to be sure it is loaded
- // (and cached) for use by code that requires synchronous
- // access (e.g. Commands).
- importer.importEnabled();
callback();
};
@@ -665,6 +684,8 @@ Object.freeze(DialogType);
this.backgroundPage_.background.fileOperationManager;
this.mediaImportHandler_ =
this.backgroundPage_.background.mediaImportHandler;
+ this.mediaScanner_ =
+ this.backgroundPage_.background.mediaScanner;
this.historyLoader_ = this.backgroundPage_.background.historyLoader;
callback();
}.bind(this));

Powered by Google App Engine
This is Rietveld 408576698