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

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

Issue 8490014: [filebrowser] Historgram for the file browser's open time. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added comments Created 9 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
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/js/main.js » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Setting the src of an img to an empty string can crash the browser, so we 5 // Setting the src of an img to an empty string can crash the browser, so we
6 // use an empty 1x1 gif instead. 6 // use an empty 1x1 gif instead.
7 const EMPTY_IMAGE_URI = 'data:image/gif;base64,' 7 const EMPTY_IMAGE_URI = 'data:image/gif;base64,'
8 + 'R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D'; 8 + 'R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D';
9 9
10 var g_slideshow_data = null; 10 var g_slideshow_data = null;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 this.currentButter_ = null; 49 this.currentButter_ = null;
50 50
51 // True if we should filter out files that start with a dot. 51 // True if we should filter out files that start with a dot.
52 this.filterFiles_ = true; 52 this.filterFiles_ = true;
53 53
54 this.commands_ = {}; 54 this.commands_ = {};
55 55
56 this.document_ = dialogDom.ownerDocument; 56 this.document_ = dialogDom.ownerDocument;
57 this.dialogType_ = this.params_.type || FileManager.DialogType.FULL_PAGE; 57 this.dialogType_ = this.params_.type || FileManager.DialogType.FULL_PAGE;
58 58
59 metrics.recordAction('Create.' + this.dialogType_);
60
59 this.initDialogs_(); 61 this.initDialogs_();
60 62
61 // TODO(dgozman): This will be changed to LocaleInfo. 63 // TODO(dgozman): This will be changed to LocaleInfo.
62 this.locale_ = new v8Locale(navigator.language); 64 this.locale_ = new v8Locale(navigator.language);
63 65
64 // TODO(rginda): 6/22/11: Remove this test when createDateTimeFormat is 66 // TODO(rginda): 6/22/11: Remove this test when createDateTimeFormat is
65 // available in all chrome trunk builds. 67 // available in all chrome trunk builds.
66 if ('createDateTimeFormat' in this.locale_) { 68 if ('createDateTimeFormat' in this.locale_) {
67 this.shortDateFormatter_ = 69 this.shortDateFormatter_ =
68 this.locale_.createDateTimeFormat({'dateType': 'medium'}); 70 this.locale_.createDateTimeFormat({'dateType': 'medium'});
(...skipping 2859 matching lines...) Expand 10 before | Expand all | Expand 10 after
2928 * Rescans the current directory immediately, refreshing the list. Should NOT 2930 * Rescans the current directory immediately, refreshing the list. Should NOT
2929 * be used in most cases. Instead use rescanDirectory_. 2931 * be used in most cases. Instead use rescanDirectory_.
2930 * 2932 *
2931 * @param {function()} opt_callback Optional function to invoke when the 2933 * @param {function()} opt_callback Optional function to invoke when the
2932 * rescan is complete. 2934 * rescan is complete.
2933 */ 2935 */
2934 FileManager.prototype.rescanDirectoryNow_ = function(opt_callback) { 2936 FileManager.prototype.rescanDirectoryNow_ = function(opt_callback) {
2935 var self = this; 2937 var self = this;
2936 var reader; 2938 var reader;
2937 2939
2940 metrics.startInterval('ScanDirectory');
2941
2938 function onReadSome(entries) { 2942 function onReadSome(entries) {
2939 if (entries.length == 0) { 2943 if (entries.length == 0) {
2944 metrics.recordTime('ScanDirectory');
2940 if (opt_callback) 2945 if (opt_callback)
2941 opt_callback(); 2946 opt_callback();
2942 return; 2947 return;
2943 } 2948 }
2944 2949
2945 // Splice takes the to-be-spliced-in array as individual parameters, 2950 // Splice takes the to-be-spliced-in array as individual parameters,
2946 // rather than as an array, so we need to perform some acrobatics... 2951 // rather than as an array, so we need to perform some acrobatics...
2947 var spliceArgs = [].slice.call(entries); 2952 var spliceArgs = [].slice.call(entries);
2948 2953
2949 // Hide files that start with a dot ('.'). 2954 // Hide files that start with a dot ('.').
(...skipping 30 matching lines...) Expand all
2980 return; 2985 return;
2981 } 2986 }
2982 2987
2983 // Otherwise, use the provided list of root subdirectories, since the 2988 // Otherwise, use the provided list of root subdirectories, since the
2984 // real local filesystem root directory (the one we use outside the 2989 // real local filesystem root directory (the one we use outside the
2985 // harness) can't be enumerated yet. 2990 // harness) can't be enumerated yet.
2986 var spliceArgs = [].slice.call(this.rootEntries_); 2991 var spliceArgs = [].slice.call(this.rootEntries_);
2987 spliceArgs.unshift(0, 0); // index, deleteCount 2992 spliceArgs.unshift(0, 0); // index, deleteCount
2988 self.dataModel_.splice.apply(self.dataModel_, spliceArgs); 2993 self.dataModel_.splice.apply(self.dataModel_, spliceArgs);
2989 2994
2995 metrics.recordTime('ScanDirectory');
2990 if (opt_callback) 2996 if (opt_callback)
2991 opt_callback(); 2997 opt_callback();
2992 }; 2998 };
2993 2999
2994 FileManager.prototype.findListItem_ = function(event) { 3000 FileManager.prototype.findListItem_ = function(event) {
2995 var node = event.srcElement; 3001 var node = event.srcElement;
2996 while (node) { 3002 while (node) {
2997 if (node.tagName == 'LI') 3003 if (node.tagName == 'LI')
2998 break; 3004 break;
2999 node = node.parentNode; 3005 node = node.parentNode;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
3227 } 3233 }
3228 3234
3229 function promptForName(suggestedName) { 3235 function promptForName(suggestedName) {
3230 self.prompt.show(str('NEW_FOLDER_PROMPT'), suggestedName, onNameSelected); 3236 self.prompt.show(str('NEW_FOLDER_PROMPT'), suggestedName, onNameSelected);
3231 } 3237 }
3232 3238
3233 promptForName(str('DEFAULT_NEW_FOLDER_NAME')); 3239 promptForName(str('DEFAULT_NEW_FOLDER_NAME'));
3234 }; 3240 };
3235 3241
3236 FileManager.prototype.createNewFolder = function(name, opt_callback) { 3242 FileManager.prototype.createNewFolder = function(name, opt_callback) {
3243 metrics.recordAction('CreateNewFolder');
3244
3237 var self = this; 3245 var self = this;
3238 3246
3239 function onSuccess(dirEntry) { 3247 function onSuccess(dirEntry) {
3240 self.rescanDirectory_(function() { 3248 self.rescanDirectory_(function() {
3241 self.selectEntry(name); 3249 self.selectEntry(name);
3242 if (opt_callback) 3250 if (opt_callback)
3243 opt_callback(); 3251 opt_callback();
3244 }); 3252 });
3245 } 3253 }
3246 3254
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
3582 3590
3583 if (msg) { 3591 if (msg) {
3584 console.log('no no no'); 3592 console.log('no no no');
3585 this.alert.show(msg, onAccept); 3593 this.alert.show(msg, onAccept);
3586 return false; 3594 return false;
3587 } 3595 }
3588 3596
3589 return true; 3597 return true;
3590 }; 3598 };
3591 })(); 3599 })();
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/js/main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698