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

Side by Side Diff: ui/file_manager/gallery/js/entry_list_watcher.js

Issue 2640673002: (WIP) Use generator to generate externs for chrome.fileManagerPrivate API.
Patch Set: Compile passes Created 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 /** 5 /**
6 * Watcher for entry lists. 6 * Watcher for entry lists.
7 * It watches entries and remove the item if the entry is removed from file 7 * It watches entries and remove the item if the entry is removed from file
8 * system. 8 * system.
9 * @param {!cr.ui.ArrayDataModel} list 9 * @param {!cr.ui.ArrayDataModel} list
10 * @constructor 10 * @constructor
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 case 0: 96 case 0:
97 break; 97 break;
98 default: 98 default:
99 assertNotReached(); 99 assertNotReached();
100 break; 100 break;
101 } 101 }
102 } 102 }
103 }; 103 };
104 104
105 /** 105 /**
106 * @param {!FileWatchEvent} event 106 * @param {!chrome.fileManagerPrivate.FileWatchEvent} event
107 * @private 107 * @private
108 */ 108 */
109 EntryListWatcher.prototype.onDirectoryChanged_ = function(event) { 109 EntryListWatcher.prototype.onDirectoryChanged_ = function(event) {
110 // Add '/' to the tail for checking if the each entry's URL is child URL of 110 // Add '/' to the tail for checking if the each entry's URL is child URL of
111 // the URL or not by using entryURL.indexOf(thisUrl) === 0. 111 // the URL or not by using entryURL.indexOf(thisUrl) === 0.
112 var url = event.entry.toURL().replace(/\/?$/, '/'); 112 var url = event.entry.toURL().replace(/\/?$/, '/');
113 var promiseList = []; 113 var promiseList = [];
114 var removedEntryURL = {}; 114 var removedEntryURL = {};
115 for (var i = 0; i < this.list_.length; i++) { 115 for (var i = 0; i < this.list_.length; i++) {
116 var entry = this.getEntry(this.list_.item(i)); 116 var entry = this.getEntry(this.list_.item(i));
(...skipping 14 matching lines...) Expand all
131 while (i < this.list_.length) { 131 while (i < this.list_.length) {
132 var url = this.getEntry(this.list_.item(i)).toURL(); 132 var url = this.getEntry(this.list_.item(i)).toURL();
133 if (removedEntryURL[url]) { 133 if (removedEntryURL[url]) {
134 this.list_.splice(i, 1); 134 this.list_.splice(i, 1);
135 } else { 135 } else {
136 i++; 136 i++;
137 } 137 }
138 } 138 }
139 }.bind(this)); 139 }.bind(this));
140 }; 140 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698