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

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

Issue 12683006: Files.app: prevent unlimited recursive directory traversal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 * Updates sub-elements of {@code parentElement} reading {@code DirectoryEntry} 8 * Updates sub-elements of {@code parentElement} reading {@code DirectoryEntry}
9 * with calling {@code iterator}. 9 * with calling {@code iterator}.
10 * 10 *
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 eject.hidden = !PathUtil.isUnmountableByUser(path); 157 eject.hidden = !PathUtil.isUnmountableByUser(path);
158 eject.addEventListener('click', 158 eject.addEventListener('click',
159 function(event) { 159 function(event) {
160 event.stopPropagation(); 160 event.stopPropagation();
161 if (!PathUtil.isUnmountableByUser(path)) 161 if (!PathUtil.isUnmountableByUser(path))
162 return; 162 return;
163 163
164 volumeManager.unmount(path, function() {}, function() {}); 164 volumeManager.unmount(path, function() {}, function() {});
165 }.bind(this)); 165 }.bind(this));
166 166
167 if ('expanded' in parentDirItem || parentDirItem.expanded) 167 if (parentDirItem.expanded)
168 this.updateSubDirectories_(); 168 this.updateSubDirectories_();
169 }; 169 };
170 170
171 /** 171 /**
172 * Invoked when the item is being expanded. 172 * Invoked when the item is being expanded.
173 * @param {!UIEvent} e Event. 173 * @param {!UIEvent} e Event.
174 * @private 174 * @private
175 **/ 175 **/
176 DirectoryItem.prototype.onExpand_ = function(e) { 176 DirectoryItem.prototype.onExpand_ = function(e) {
177 this.updateSubDirectories_(function() { 177 this.updateSubDirectories_(function() {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 * @param {HTMLElement} el Element to be DirectoryTree. 261 * @param {HTMLElement} el Element to be DirectoryTree.
262 * @param {DirectoryModel} directoryModel Current DirectoryModel. 262 * @param {DirectoryModel} directoryModel Current DirectoryModel.
263 */ 263 */
264 DirectoryTree.decorate = function(el, directoryModel) { 264 DirectoryTree.decorate = function(el, directoryModel) {
265 el.__proto__ = DirectoryTree.prototype; 265 el.__proto__ = DirectoryTree.prototype;
266 (/** @type {DirectoryTree} */ el).decorate(directoryModel); 266 (/** @type {DirectoryTree} */ el).decorate(directoryModel);
267 }; 267 };
268 268
269 DirectoryTree.prototype = { 269 DirectoryTree.prototype = {
270 __proto__: cr.ui.Tree.prototype, 270 __proto__: cr.ui.Tree.prototype,
271
272 // DirectoryTree is always expanded.
273 get expanded() { return true; },
274 /**
275 * @param {boolean} value Not used.
276 */
277 set expanded(value) {}
271 }; 278 };
272 279
273 /** 280 /**
274 * Decorates an element. 281 * Decorates an element.
275 * @param {DirectoryModel} directoryModel Current DirectoryModel. 282 * @param {DirectoryModel} directoryModel Current DirectoryModel.
276 */ 283 */
277 DirectoryTree.prototype.decorate = function(directoryModel) { 284 DirectoryTree.prototype.decorate = function(directoryModel) {
278 cr.ui.Tree.prototype.decorate.call(this); 285 cr.ui.Tree.prototype.decorate.call(this);
279 286
280 this.directoryModel_ = directoryModel; 287 this.directoryModel_ = directoryModel;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 this.setContextMenu(this.contextMenu_); 338 this.setContextMenu(this.contextMenu_);
332 }; 339 };
333 340
334 /** 341 /**
335 * Returns the path of the selected item. 342 * Returns the path of the selected item.
336 * @return {string} The current path. 343 * @return {string} The current path.
337 */ 344 */
338 DirectoryTree.prototype.getCurrentPath = function() { 345 DirectoryTree.prototype.getCurrentPath = function() {
339 return this.selectedItem ? this.selectedItem.fullPath : null; 346 return this.selectedItem ? this.selectedItem.fullPath : null;
340 }; 347 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698