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

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

Issue 8461009: Fixing exit on 'X' icon in Photo Editor (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/mock_chrome.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;
11 11
12 const GALLERY_ENABLED = true;
13
14 // If directory files changes too often, don't rescan directory more than once 12 // If directory files changes too often, don't rescan directory more than once
15 // per specified interval 13 // per specified interval
16 const SIMULTANEOUS_RESCAN_INTERVAL = 1000; 14 const SIMULTANEOUS_RESCAN_INTERVAL = 1000;
17 15
18 /** 16 /**
19 * FileManager constructor. 17 * FileManager constructor.
20 * 18 *
21 * FileManager objects encapsulate the functionality of the file selector 19 * FileManager objects encapsulate the functionality of the file selector
22 * dialogs, as well as the full screen file manager application (though the 20 * dialogs, as well as the full screen file manager application (though the
23 * latter is not yet implemented). 21 * latter is not yet implemented).
(...skipping 2238 matching lines...) Expand 10 before | Expand all | Expand 10 after
2262 } 2260 }
2263 2261
2264 galleryFrame.onload = function() { 2262 galleryFrame.onload = function() {
2265 self.document_.title = str('GALLERY'); 2263 self.document_.title = str('GALLERY');
2266 galleryFrame.contentWindow.Gallery.open( 2264 galleryFrame.contentWindow.Gallery.open(
2267 self.currentDirEntry_, 2265 self.currentDirEntry_,
2268 urls, 2266 urls,
2269 selectedUrl, 2267 selectedUrl,
2270 function () { 2268 function () {
2271 // TODO(kaznacheev): keep selection. 2269 // TODO(kaznacheev): keep selection.
2272 self.rescanDirectoryNow_(); // Make sure new files show up.
2273 self.dialogDom_.removeChild(galleryFrame); 2270 self.dialogDom_.removeChild(galleryFrame);
2274 self.document_.title = self.currentDirEntry_.fullPath; 2271 self.document_.title = self.currentDirEntry_.fullPath;
2275 self.refocus(); 2272 self.refocus();
2276 }, 2273 },
2277 self.metadataProvider_, 2274 self.metadataProvider_,
2278 shareActions, 2275 shareActions,
2279 str); 2276 str);
2280 }; 2277 };
2281 2278
2282 galleryFrame.src = 'js/image_editor/gallery.html'; 2279 galleryFrame.src = 'js/image_editor/gallery.html';
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
3057 callbacks[i].onError(); 3054 callbacks[i].onError();
3058 } catch (ex) { 3055 } catch (ex) {
3059 console.error('Caught exception while notifying about error: ' + 3056 console.error('Caught exception while notifying about error: ' +
3060 name, ex); 3057 name, ex);
3061 } 3058 }
3062 } 3059 }
3063 } 3060 }
3064 3061
3065 function onReadSome(entries) { 3062 function onReadSome(entries) {
3066 if (entries.length == 0) { 3063 if (entries.length == 0) {
3064 metrics.recordTime('DirectoryScan');
3065 if (self.currentDirEntry_.fullPath == DOWNLOADS_DIRECTORY) {
3066 metrics.reportCount("DownloadsCount", self.dataModel_.length);
3067 }
3068
3067 if (self.pendingRescanQueue_.length > 0) { 3069 if (self.pendingRescanQueue_.length > 0) {
3068 setTimeout(self.rescanDirectory_.bind(self), 3070 setTimeout(self.rescanDirectory_.bind(self),
3069 SIMULTANEOUS_RESCAN_INTERVAL); 3071 SIMULTANEOUS_RESCAN_INTERVAL);
3070 } 3072 }
3071 3073
3072 self.rescanRunning_ = false; 3074 self.rescanRunning_ = false;
3073 for (var i= 0; i < callbacks.length; i++) { 3075 for (var i= 0; i < callbacks.length; i++) {
3074 if (callbacks[i].onSuccess) 3076 if (callbacks[i].onSuccess)
3075 try { 3077 try {
3076 callbacks[i].onSuccess(); 3078 callbacks[i].onSuccess();
(...skipping 15 matching lines...) Expand all
3092 // commonly hidden patterns might be nice too. 3094 // commonly hidden patterns might be nice too.
3093 if (self.filterFiles_) { 3095 if (self.filterFiles_) {
3094 spliceArgs = spliceArgs.filter(function(e) { 3096 spliceArgs = spliceArgs.filter(function(e) {
3095 return e.name.substr(0, 1) != '.'; 3097 return e.name.substr(0, 1) != '.';
3096 }); 3098 });
3097 } 3099 }
3098 3100
3099 spliceArgs.unshift(0, 0); // index, deleteCount 3101 spliceArgs.unshift(0, 0); // index, deleteCount
3100 self.dataModel_.splice.apply(self.dataModel_, spliceArgs); 3102 self.dataModel_.splice.apply(self.dataModel_, spliceArgs);
3101 3103
3104 metrics.startInterval('DirectoryScan');
3105
3102 // Keep reading until entries.length is 0. 3106 // Keep reading until entries.length is 0.
3103 reader.readEntries(onReadSome, onError); 3107 reader.readEntries(onReadSome, onError);
3104 }; 3108 };
3105 3109
3106 // If not the root directory, just read the contents. 3110 // If not the root directory, just read the contents.
3107 reader = this.currentDirEntry_.createReader(); 3111 reader = this.currentDirEntry_.createReader();
3108 reader.readEntries(onReadSome, onError); 3112 reader.readEntries(onReadSome, onError);
3109 return; 3113 return;
3110 } 3114 }
3111 3115
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
3814 }); 3818 });
3815 }, onError); 3819 }, onError);
3816 3820
3817 function onError(err) { 3821 function onError(err) {
3818 console.log('Error while checking free space: ' + err); 3822 console.log('Error while checking free space: ' + err);
3819 setTimeout(doCheck, 1000 * 60); 3823 setTimeout(doCheck, 1000 * 60);
3820 } 3824 }
3821 } 3825 }
3822 } 3826 }
3823 })(); 3827 })();
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/js/mock_chrome.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698