Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /** | 5 /** |
| 6 * Overrided metadata worker's path. | 6 * Overrided metadata worker's path. |
| 7 * @type {string} | 7 * @type {string} |
| 8 */ | 8 */ |
| 9 ContentMetadataProvider.WORKER_SCRIPT = '/js/metadata_worker.js'; | 9 ContentMetadataProvider.WORKER_SCRIPT = '/js/metadata_worker.js'; |
| 10 | 10 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 chrome.accessibilityFeatures.highContrast.onChange.addListener( | 222 chrome.accessibilityFeatures.highContrast.onChange.addListener( |
| 223 this.onGetOrChangedAccessibilityConfiguration_.bind( | 223 this.onGetOrChangedAccessibilityConfiguration_.bind( |
| 224 this, 'high-contrast')); | 224 this, 'high-contrast')); |
| 225 chrome.accessibilityFeatures.highContrast.get({}, | 225 chrome.accessibilityFeatures.highContrast.get({}, |
| 226 this.onGetOrChangedAccessibilityConfiguration_.bind( | 226 this.onGetOrChangedAccessibilityConfiguration_.bind( |
| 227 this, 'high-contrast')); | 227 this, 'high-contrast')); |
| 228 } | 228 } |
| 229 | 229 |
| 230 /** | 230 /** |
| 231 * First time tools fade-out timeout in milliseconds. | 231 * First time tools fade-out timeout in milliseconds. |
| 232 * @const | 232 * @const {number} |
| 233 * @type {number} | 233 * @private |
|
fukino
2017/02/24 05:06:48
Drop @private (or append _ to the constant name)
| |
| 234 */ | 234 */ |
| 235 Gallery.FIRST_FADE_TIMEOUT = 1000; | 235 Gallery.FIRST_FADE_TIMEOUT = 1000; |
| 236 | 236 |
| 237 /** | 237 /** |
| 238 * Time until mosaic is initialized in the background. Used to make gallery | 238 * Time until mosaic is initialized in the background. Used to make gallery |
| 239 * in the slide mode load faster. In milliseconds. | 239 * in the slide mode load faster. In milliseconds. |
| 240 * @const | 240 * @const {number} |
| 241 * @type {number} | 241 * @private |
|
fukino
2017/02/24 05:06:48
ditto
| |
| 242 */ | 242 */ |
| 243 Gallery.MOSAIC_BACKGROUND_INIT_DELAY = 1000; | 243 Gallery.MOSAIC_BACKGROUND_INIT_DELAY = 1000; |
| 244 | 244 |
| 245 /** | 245 /** |
| 246 * Modes in Gallery. | |
| 247 * @enum {string} | |
| 248 */ | |
| 249 Gallery.Mode = { | |
| 250 SLIDE: 'slide', | |
| 251 THUMBNAIL: 'thumbnail' | |
| 252 }; | |
| 253 | |
| 254 /** | |
| 255 * Sub modes in Gallery. | |
| 256 * @enum {string} | |
| 257 * TODO(yawano): Remove sub modes by extracting them as modes. | |
| 258 */ | |
| 259 Gallery.SubMode = { | |
| 260 BROWSE: 'browse', | |
| 261 EDIT: 'edit', | |
| 262 SLIDESHOW: 'slideshow' | |
| 263 }; | |
| 264 | |
| 265 /** | |
| 266 * Updates attributes of container element when accessibility configuration has | 246 * Updates attributes of container element when accessibility configuration has |
| 267 * been changed. | 247 * been changed. |
| 268 * @param {string} name | 248 * @param {string} name |
| 269 * @param {Object} details | 249 * @param {Object} details |
| 270 * @private | 250 * @private |
| 271 */ | 251 */ |
| 272 Gallery.prototype.onGetOrChangedAccessibilityConfiguration_ = function( | 252 Gallery.prototype.onGetOrChangedAccessibilityConfiguration_ = function( |
| 273 name, details) { | 253 name, details) { |
| 274 if (details.value) { | 254 if (details.value) { |
| 275 this.container_.setAttribute(name, true); | 255 this.container_.setAttribute(name, true); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 * External user action event handler. | 419 * External user action event handler. |
| 440 * @private | 420 * @private |
| 441 */ | 421 */ |
| 442 Gallery.prototype.onUserAction_ = function() { | 422 Gallery.prototype.onUserAction_ = function() { |
| 443 // Show the toolbar and hide it after the default timeout. | 423 // Show the toolbar and hide it after the default timeout. |
| 444 this.dimmableUIController_.kick(); | 424 this.dimmableUIController_.kick(); |
| 445 }; | 425 }; |
| 446 | 426 |
| 447 /** | 427 /** |
| 448 * Returns the current mode. | 428 * Returns the current mode. |
| 449 * @return {Gallery.Mode} | 429 * @return {GalleryMode} |
| 450 */ | 430 */ |
| 451 Gallery.prototype.getCurrentMode = function() { | 431 Gallery.prototype.getCurrentMode = function() { |
| 452 switch (/** @type {(SlideMode|ThumbnailMode)} */ (this.currentMode_)) { | 432 switch (/** @type {(SlideMode|ThumbnailMode)} */ (this.currentMode_)) { |
| 453 case this.slideMode_: | 433 case this.slideMode_: |
| 454 return Gallery.Mode.SLIDE; | 434 return GalleryMode.SLIDE; |
| 455 case this.thumbnailMode_: | 435 case this.thumbnailMode_: |
| 456 return Gallery.Mode.THUMBNAIL; | 436 return GalleryMode.THUMBNAIL; |
| 457 default: | 437 default: |
| 458 assertNotReached(); | 438 assertNotReached(); |
| 459 } | 439 } |
| 460 }; | 440 }; |
| 461 | 441 |
| 462 /** | 442 /** |
| 463 * Returns sub mode of current mode. If current mode is not set yet, null is | 443 * Returns sub mode of current mode. If current mode is not set yet, null is |
| 464 * returned. | 444 * returned. |
| 465 * @return {Gallery.SubMode} | 445 * @return {GallerySubMode} |
| 466 */ | 446 */ |
| 467 Gallery.prototype.getCurrentSubMode = function() { | 447 Gallery.prototype.getCurrentSubMode = function() { |
| 468 assert(this.currentMode_); | 448 assert(this.currentMode_); |
| 469 return this.currentMode_.getSubMode(); | 449 return this.currentMode_.getSubMode(); |
| 470 }; | 450 }; |
| 471 | 451 |
| 472 /** | 452 /** |
| 473 * Sets the current mode, update the UI. | 453 * Sets the current mode, update the UI. |
| 474 * @param {!(SlideMode|ThumbnailMode)} mode Current mode. | 454 * @param {!(SlideMode|ThumbnailMode)} mode Current mode. |
| 475 * @private | 455 * @private |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 928 } | 908 } |
| 929 | 909 |
| 930 ImageUtil.setAttribute(this.filenameSpacer_, 'renaming', false); | 910 ImageUtil.setAttribute(this.filenameSpacer_, 'renaming', false); |
| 931 this.dimmableUIController_.setRenaming(false); | 911 this.dimmableUIController_.setRenaming(false); |
| 932 this.onUserAction_(); | 912 this.onUserAction_(); |
| 933 }; | 913 }; |
| 934 | 914 |
| 935 /** | 915 /** |
| 936 * Minimum width of rename field. | 916 * Minimum width of rename field. |
| 937 * @const {number} | 917 * @const {number} |
| 918 * @private | |
|
fukino
2017/02/24 05:06:48
ditto
| |
| 938 */ | 919 */ |
| 939 Gallery.MIN_WIDTH_RENAME_FIELD = 160; // px | 920 Gallery.MIN_WIDTH_RENAME_FIELD = 160; // px |
| 940 | 921 |
| 941 /** | 922 /** |
| 942 * End padding for rename field. | 923 * End padding for rename field. |
| 943 * @const {number} | 924 * @const {number} |
| 925 * @private | |
|
fukino
2017/02/24 05:06:48
ditto
| |
| 944 */ | 926 */ |
| 945 Gallery.END_PADDING_RENAME_FIELD = 20; // px | 927 Gallery.END_PADDING_RENAME_FIELD = 20; // px |
| 946 | 928 |
| 947 /** | 929 /** |
| 948 * Resize rename field depending on its content. | 930 * Resize rename field depending on its content. |
| 949 * @private | 931 * @private |
| 950 */ | 932 */ |
| 951 Gallery.prototype.resizeRenameField_ = function() { | 933 Gallery.prototype.resizeRenameField_ = function() { |
| 952 var size = this.filenameCanvasContext_.measureText(this.filenameEdit_.value); | 934 var size = this.filenameCanvasContext_.measureText(this.filenameEdit_.value); |
| 953 | 935 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1059 */ | 1041 */ |
| 1060 var initializePromise = | 1042 var initializePromise = |
| 1061 Promise.all([loadTimeDataPromise, volumeManagerPromise]). | 1043 Promise.all([loadTimeDataPromise, volumeManagerPromise]). |
| 1062 then(function(args) { | 1044 then(function(args) { |
| 1063 var volumeManager = args[1]; | 1045 var volumeManager = args[1]; |
| 1064 gallery = new Gallery(volumeManager); | 1046 gallery = new Gallery(volumeManager); |
| 1065 }); | 1047 }); |
| 1066 | 1048 |
| 1067 // Loads entries. | 1049 // Loads entries. |
| 1068 initializePromise.then(reload); | 1050 initializePromise.then(reload); |
| OLD | NEW |