OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 document.addEventListener('DOMContentLoaded', function() { | 5 document.addEventListener('DOMContentLoaded', function() { |
6 PhotoImport.load(); | 6 PhotoImport.load(); |
7 }); | 7 }); |
8 | 8 |
9 /** | 9 /** |
10 * The main Photo App object. | 10 * The main Photo App object. |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 PhotoImport.prototype = { __proto__: cr.EventTarget.prototype }; | 31 PhotoImport.prototype = { __proto__: cr.EventTarget.prototype }; |
32 | 32 |
33 /** | 33 /** |
34 * Single item width. | 34 * Single item width. |
35 * Keep in sync with .grid-item rule in photo_import.css. | 35 * Keep in sync with .grid-item rule in photo_import.css. |
36 */ | 36 */ |
37 PhotoImport.ITEM_WIDTH = 164 + 8; | 37 PhotoImport.ITEM_WIDTH = 164 + 8; |
38 | 38 |
39 /** | 39 /** |
40 * Directory name on the GData containing the imported photos. | 40 * Directory name on the Drive containing the imported photos. |
41 * TODO(dgozman): localize | 41 * TODO(dgozman): localize |
42 */ | 42 */ |
43 PhotoImport.GDATA_PHOTOS_DIR = 'My Photos'; | 43 PhotoImport.DRIVE_PHOTOS_DIR = 'My Photos'; |
44 | 44 |
45 /** | 45 /** |
46 * Loads app in the document body. | 46 * Loads app in the document body. |
47 * @param {FileSystem=} opt_filesystem Local file system. | 47 * @param {FileSystem=} opt_filesystem Local file system. |
48 * @param {Object} opt_params Parameters. | 48 * @param {Object} opt_params Parameters. |
49 */ | 49 */ |
50 PhotoImport.load = function(opt_filesystem, opt_params) { | 50 PhotoImport.load = function(opt_filesystem, opt_params) { |
51 ImageUtil.metrics = metrics; | 51 ImageUtil.metrics = metrics; |
52 | 52 |
53 var hash = location.hash ? location.hash.substr(1) : ''; | 53 var hash = location.hash ? location.hash.substr(1) : ''; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 var onError = this.onError_.bind( | 122 var onError = this.onError_.bind( |
123 this, loadTimeData.getString('PHOTO_IMPORT_DRIVE_ERROR')); | 123 this, loadTimeData.getString('PHOTO_IMPORT_DRIVE_ERROR')); |
124 | 124 |
125 var onDirectory = function(dir) { | 125 var onDirectory = function(dir) { |
126 this.destination_ = dir; | 126 this.destination_ = dir; |
127 // This may enable the import button, so check that. | 127 // This may enable the import button, so check that. |
128 this.onSelectionChanged_(); | 128 this.onSelectionChanged_(); |
129 }.bind(this); | 129 }.bind(this); |
130 | 130 |
131 var onMounted = function() { | 131 var onMounted = function() { |
132 var dir = PathUtil.join(RootDirectory.GDATA, PhotoImport.GDATA_PHOTOS_DIR); | 132 var dir = PathUtil.join(RootDirectory.DRIVE, PhotoImport.DRIVE_PHOTOS_DIR); |
133 util.getOrCreateDirectory(this.filesystem_.root, dir, onDirectory, onError); | 133 util.getOrCreateDirectory(this.filesystem_.root, dir, onDirectory, onError); |
134 }.bind(this); | 134 }.bind(this); |
135 | 135 |
136 if (this.volumeManager_.isMounted(RootDirectory.GDATA)) { | 136 if (this.volumeManager_.isMounted(RootDirectory.DRIVE)) { |
137 onMounted(); | 137 onMounted(); |
138 } else { | 138 } else { |
139 this.volumeManager_.mountGData(onMounted, onError); | 139 this.volumeManager_.mountDrive(onMounted, onError); |
140 } | 140 } |
141 }; | 141 }; |
142 | 142 |
143 /** | 143 /** |
144 * Load the source contents. | 144 * Load the source contents. |
145 * @param {string} source Path to source. | 145 * @param {string} source Path to source. |
146 * @private | 146 * @private |
147 */ | 147 */ |
148 PhotoImport.prototype.loadSource_ = function(source) { | 148 PhotoImport.prototype.loadSource_ = function(source) { |
149 var onTraversed = function(results) { | 149 var onTraversed = function(results) { |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 | 482 |
483 /** @override */ | 483 /** @override */ |
484 GridSelectionController.prototype.getLastIndex = function() { | 484 GridSelectionController.prototype.getLastIndex = function() { |
485 var dm = this.grid_.dataModel; | 485 var dm = this.grid_.dataModel; |
486 for (var index = dm.length - 1; index >= 0; index--) { | 486 for (var index = dm.length - 1; index >= 0; index--) { |
487 if (dm.item(index).type == 'entry') | 487 if (dm.item(index).type == 'entry') |
488 return index; | 488 return index; |
489 } | 489 } |
490 return -1; | 490 return -1; |
491 }; | 491 }; |
OLD | NEW |