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

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

Issue 131403003: Files.app: Show drive sync state in the progress center. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-upload Created 6 years, 11 months 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * Number of runtime errors catched in the background page. 8 * Number of runtime errors catched in the background page.
9 * @type {number} 9 * @type {number}
10 */ 10 */
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 this.fileOperationHandler_ = new FileOperationHandler(this); 62 this.fileOperationHandler_ = new FileOperationHandler(this);
63 63
64 /** 64 /**
65 * Event handler for C++ sides notifications. 65 * Event handler for C++ sides notifications.
66 * @type {DeviceHandler} 66 * @type {DeviceHandler}
67 * @private 67 * @private
68 */ 68 */
69 this.deviceHandler_ = new DeviceHandler(); 69 this.deviceHandler_ = new DeviceHandler();
70 70
71 /** 71 /**
72 * Drive sync handler.
73 * @type {DriveSyncHandler}
74 * @private
75 */
76 this.driveSyncHandler_ = new DriveSyncHandler(this.progressCenter);
77 this.driveSyncHandler_.addEventListener(
78 DriveSyncHandler.COMPLETE_EVENT,
79 function() { this.tryClose(); }.bind(this));
80
81 /**
72 * String assets. 82 * String assets.
73 * @type {Object.<string, string>} 83 * @type {Object.<string, string>}
74 */ 84 */
75 this.stringData = null; 85 this.stringData = null;
76 86
77 /** 87 /**
78 * Callback list to be invoked after initialization. 88 * Callback list to be invoked after initialization.
79 * It turns to null after initialization. 89 * It turns to null after initialization.
80 * 90 *
81 * @type {Array.<function()>} 91 * @type {Array.<function()>}
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 this.initializeCallbacks_.push(callback); 159 this.initializeCallbacks_.push(callback);
150 else 160 else
151 callback(); 161 callback();
152 }; 162 };
153 163
154 /** 164 /**
155 * Checks the current condition of background page and closes it if possible. 165 * Checks the current condition of background page and closes it if possible.
156 */ 166 */
157 Background.prototype.tryClose = function() { 167 Background.prototype.tryClose = function() {
158 // If the file operation is going, the background page cannot close. 168 // If the file operation is going, the background page cannot close.
159 if (this.fileOperationManager.hasQueuedTasks()) { 169 if (this.fileOperationManager.hasQueuedTasks() ||
170 this.driveSyncHandler_.synching) {
160 this.lastTimeCanClose_ = null; 171 this.lastTimeCanClose_ = null;
161 return; 172 return;
162 } 173 }
163 174
164 var views = chrome.extension.getViews(); 175 var views = chrome.extension.getViews();
165 var closing = false; 176 var closing = false;
166 for (var i = 0; i < views.length; i++) { 177 for (var i = 0; i < views.length; i++) {
167 // If the window that is not the background page itself and it is not 178 // If the window that is not the background page itself and it is not
168 // closing, the background page cannot close. 179 // closing, the background page cannot close.
169 if (views[i] !== window && !views[i].closing) { 180 if (views[i] !== window && !views[i].closing) {
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 contexts: ['launcher'], 796 contexts: ['launcher'],
786 title: str('NEW_WINDOW_BUTTON_LABEL') 797 title: str('NEW_WINDOW_BUTTON_LABEL')
787 }); 798 });
788 }; 799 };
789 800
790 /** 801 /**
791 * Singleton instance of Background. 802 * Singleton instance of Background.
792 * @type {Background} 803 * @type {Background}
793 */ 804 */
794 window.background = new Background(); 805 window.background = new Background();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698