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

Side by Side Diff: chrome/browser/resources/file_manager/js/file_operation_manager_wrapper.js

Issue 39123003: [Files.app] Split the JavaScript files into subdirectories: common, background, and foreground (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed test failure. Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 'use strict';
6
7 /**
8 * While FileOperationManager is run in the background page, this class is
9 * used to communicate with it.
10 * @param {DOMWindow} backgroundPage Window object of the background page.
11 * @constructor
12 */
13 function FileOperationManagerWrapper(backgroundPage) {
14 this.fileOperationManager_ =
15 backgroundPage.FileOperationManager.getInstance();
16 }
17
18 /**
19 * Create a new instance or get existing instance of FCMW.
20 * @param {DOMWindow} backgroundPage Window object of the background page.
21 * @return {FileOperationManagerWrapper} FileOperationManagerWrapper instance.
22 */
23 FileOperationManagerWrapper.getInstance = function(backgroundPage) {
24 if (!FileOperationManagerWrapper.instance_)
25 FileOperationManagerWrapper.instance_ =
26 new FileOperationManagerWrapper(backgroundPage);
27
28 return FileOperationManagerWrapper.instance_;
29 };
30
31 /**
32 * @return {boolean} True if there is a running task.
33 */
34 FileOperationManagerWrapper.prototype.isRunning = function() {
35 return this.fileOperationManager_.hasQueuedTasks();
36 };
37
38 /**
39 * Decorates a FileOperationManager method, so it will be executed after
40 * initializing the FileOperationManager instance in background page.
41 * @param {string} method The method name.
42 */
43 FileOperationManagerWrapper.decorateAsyncMethod = function(method) {
44 FileOperationManagerWrapper.prototype[method] = function() {
45 this.fileOperationManager_.willRunNewMethod();
46 this.fileOperationManager_[method].apply(
47 this.fileOperationManager_, arguments);
48 };
49 };
50
51 FileOperationManagerWrapper.decorateAsyncMethod('requestCancel');
52 FileOperationManagerWrapper.decorateAsyncMethod('paste');
53 FileOperationManagerWrapper.decorateAsyncMethod('deleteEntries');
54 FileOperationManagerWrapper.decorateAsyncMethod('forceDeleteTask');
55 FileOperationManagerWrapper.decorateAsyncMethod('cancelDeleteTask');
56 FileOperationManagerWrapper.decorateAsyncMethod('zipSelection');
57 FileOperationManagerWrapper.decorateAsyncMethod('addEventListener');
58 FileOperationManagerWrapper.decorateAsyncMethod('removeEventListener');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698