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

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

Issue 8491038: Cleanup FileBrowser.Create.* UMA events (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 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/metrics.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_); 59 metrics.recordEnum('Create', this.dialogType_,
60 [FileManager.DialogType.SELECT_FOLDER,
61 FileManager.DialogType.SELECT_SAVEAS_FILE,
62 FileManager.DialogType.SELECT_OPEN_FILE,
63 FileManager.DialogType.SELECT_OPEN_MULTI_FILE,
64 FileManager.DialogType.FULL_PAGE]);
60 65
61 this.initDialogs_(); 66 this.initDialogs_();
62 67
63 // TODO(dgozman): This will be changed to LocaleInfo. 68 // TODO(dgozman): This will be changed to LocaleInfo.
64 this.locale_ = new v8Locale(navigator.language); 69 this.locale_ = new v8Locale(navigator.language);
65 70
66 // TODO(rginda): 6/22/11: Remove this test when createDateTimeFormat is 71 // TODO(rginda): 6/22/11: Remove this test when createDateTimeFormat is
67 // available in all chrome trunk builds. 72 // available in all chrome trunk builds.
68 if ('createDateTimeFormat' in this.locale_) { 73 if ('createDateTimeFormat' in this.locale_) {
69 this.shortDateFormatter_ = 74 this.shortDateFormatter_ =
(...skipping 2850 matching lines...) Expand 10 before | Expand all | Expand 10 after
2920 * Rescans the current directory immediately, refreshing the list. Should NOT 2925 * Rescans the current directory immediately, refreshing the list. Should NOT
2921 * be used in most cases. Instead use rescanDirectory_. 2926 * be used in most cases. Instead use rescanDirectory_.
2922 * 2927 *
2923 * @param {function()} opt_callback Optional function to invoke when the 2928 * @param {function()} opt_callback Optional function to invoke when the
2924 * rescan is complete. 2929 * rescan is complete.
2925 */ 2930 */
2926 FileManager.prototype.rescanDirectoryNow_ = function(opt_callback) { 2931 FileManager.prototype.rescanDirectoryNow_ = function(opt_callback) {
2927 var self = this; 2932 var self = this;
2928 var reader; 2933 var reader;
2929 2934
2935 function rescanDone() {
2936 metrics.recordTime('ScanDirectory');
2937 if (self.currentDirEntry_.fullPath == DOWNLOADS_DIRECTORY)
2938 metrics.reportCount("DownloadsCount", self.dataModel_.length);
2939 if (opt_callback)
2940 opt_callback();
2941 }
2942
2930 metrics.startInterval('ScanDirectory'); 2943 metrics.startInterval('ScanDirectory');
2931 2944
2932 function onReadSome(entries) { 2945 function onReadSome(entries) {
2933 if (entries.length == 0) { 2946 if (entries.length == 0) {
2934 metrics.recordTime('ScanDirectory'); 2947 rescanDone();
2935 if (opt_callback)
2936 opt_callback();
2937 return; 2948 return;
2938 } 2949 }
2939 2950
2940 // Splice takes the to-be-spliced-in array as individual parameters, 2951 // Splice takes the to-be-spliced-in array as individual parameters,
2941 // rather than as an array, so we need to perform some acrobatics... 2952 // rather than as an array, so we need to perform some acrobatics...
2942 var spliceArgs = [].slice.call(entries); 2953 var spliceArgs = [].slice.call(entries);
2943 2954
2944 // Hide files that start with a dot ('.'). 2955 // Hide files that start with a dot ('.').
2945 // TODO(rginda): User should be able to override this. Support for other 2956 // TODO(rginda): User should be able to override this. Support for other
2946 // commonly hidden patterns might be nice too. 2957 // commonly hidden patterns might be nice too.
(...skipping 28 matching lines...) Expand all
2975 return; 2986 return;
2976 } 2987 }
2977 2988
2978 // Otherwise, use the provided list of root subdirectories, since the 2989 // Otherwise, use the provided list of root subdirectories, since the
2979 // real local filesystem root directory (the one we use outside the 2990 // real local filesystem root directory (the one we use outside the
2980 // harness) can't be enumerated yet. 2991 // harness) can't be enumerated yet.
2981 var spliceArgs = [].slice.call(this.rootEntries_); 2992 var spliceArgs = [].slice.call(this.rootEntries_);
2982 spliceArgs.unshift(0, 0); // index, deleteCount 2993 spliceArgs.unshift(0, 0); // index, deleteCount
2983 self.dataModel_.splice.apply(self.dataModel_, spliceArgs); 2994 self.dataModel_.splice.apply(self.dataModel_, spliceArgs);
2984 2995
2985 metrics.recordTime('ScanDirectory'); 2996 rescanDone();
2986 if (opt_callback)
2987 opt_callback();
2988 }; 2997 };
2989 2998
2990 FileManager.prototype.findListItem_ = function(event) { 2999 FileManager.prototype.findListItem_ = function(event) {
2991 var node = event.srcElement; 3000 var node = event.srcElement;
2992 while (node) { 3001 while (node) {
2993 if (node.tagName == 'LI') 3002 if (node.tagName == 'LI')
2994 break; 3003 break;
2995 node = node.parentNode; 3004 node = node.parentNode;
2996 } 3005 }
2997 3006
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
3633 }); 3642 });
3634 }, onError); 3643 }, onError);
3635 3644
3636 function onError(err) { 3645 function onError(err) {
3637 console.log('Error while checking free space: ' + err); 3646 console.log('Error while checking free space: ' + err);
3638 setTimeout(doCheck, 1000 * 60); 3647 setTimeout(doCheck, 1000 * 60);
3639 } 3648 }
3640 } 3649 }
3641 } 3650 }
3642 })(); 3651 })();
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/js/metrics.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698