| 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 } | 499 } |
| 500 this.currentMode_ = mode; | 500 this.currentMode_ = mode; |
| 501 this.currentMode_.addEventListener( | 501 this.currentMode_.addEventListener( |
| 502 'sub-mode-change', this.onSubModeChangedBound_); | 502 'sub-mode-change', this.onSubModeChangedBound_); |
| 503 | 503 |
| 504 this.dimmableUIController_.setCurrentMode( | 504 this.dimmableUIController_.setCurrentMode( |
| 505 this.getCurrentMode(), this.getCurrentSubMode()); | 505 this.getCurrentMode(), this.getCurrentSubMode()); |
| 506 | 506 |
| 507 this.container_.setAttribute('mode', this.currentMode_.getName()); | 507 this.container_.setAttribute('mode', this.currentMode_.getName()); |
| 508 this.updateSelectionAndState_(); | 508 this.updateSelectionAndState_(); |
| 509 this.updateModeButtonAttribute_(); |
| 509 }; | 510 }; |
| 510 | 511 |
| 511 /** | 512 /** |
| 512 * Handles sub-mode-change event. | 513 * Handles sub-mode-change event. |
| 513 * @private | 514 * @private |
| 514 */ | 515 */ |
| 515 Gallery.prototype.onSubModeChanged_ = function() { | 516 Gallery.prototype.onSubModeChanged_ = function() { |
| 516 this.dimmableUIController_.setCurrentMode( | 517 this.dimmableUIController_.setCurrentMode( |
| 517 this.getCurrentMode(), this.getCurrentSubMode()); | 518 this.getCurrentMode(), this.getCurrentSubMode()); |
| 518 }; | 519 }; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 531 * @private | 532 * @private |
| 532 */ | 533 */ |
| 533 Gallery.prototype.onChangeToSlideMode_ = function() { | 534 Gallery.prototype.onChangeToSlideMode_ = function() { |
| 534 if (this.modeSwitchButton_.disabled) | 535 if (this.modeSwitchButton_.disabled) |
| 535 return; | 536 return; |
| 536 | 537 |
| 537 this.changeCurrentMode_(this.slideMode_); | 538 this.changeCurrentMode_(this.slideMode_); |
| 538 }; | 539 }; |
| 539 | 540 |
| 540 /** | 541 /** |
| 542 * Update attributes of slide/thumbnail toggle button |
| 543 * @private |
| 544 */ |
| 545 Gallery.prototype.updateModeButtonAttribute_ = function() { |
| 546 if (this.currentMode_ === this.slideMode_) |
| 547 this.modeSwitchButton_.setAttribute("aria-label", str("GALLERY_THUMBNAIL")); |
| 548 else |
| 549 this.modeSwitchButton_.setAttribute("aria-label", str("GALLERY_SLIDE")); |
| 550 }; |
| 551 |
| 552 /** |
| 541 * Change current mode. | 553 * Change current mode. |
| 542 * @param {!(SlideMode|ThumbnailMode)} mode Target mode. | 554 * @param {!(SlideMode|ThumbnailMode)} mode Target mode. |
| 543 * @param {Event=} opt_event Event that caused this call. | 555 * @param {Event=} opt_event Event that caused this call. |
| 544 * @return {!Promise} Resolved when mode has been changed. | 556 * @return {!Promise} Resolved when mode has been changed. |
| 545 * @private | 557 * @private |
| 546 */ | 558 */ |
| 547 Gallery.prototype.changeCurrentMode_ = function(mode, opt_event) { | 559 Gallery.prototype.changeCurrentMode_ = function(mode, opt_event) { |
| 548 return new Promise(function(fulfill, reject) { | 560 return new Promise(function(fulfill, reject) { |
| 549 // Do not re-enter while changing the mode. | 561 // Do not re-enter while changing the mode. |
| 550 if (this.currentMode_ === mode || this.changingMode_) { | 562 if (this.currentMode_ === mode || this.changingMode_) { |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 */ | 1074 */ |
| 1063 var initializePromise = | 1075 var initializePromise = |
| 1064 Promise.all([loadTimeDataPromise, volumeManagerPromise]). | 1076 Promise.all([loadTimeDataPromise, volumeManagerPromise]). |
| 1065 then(function(args) { | 1077 then(function(args) { |
| 1066 var volumeManager = args[1]; | 1078 var volumeManager = args[1]; |
| 1067 gallery = new Gallery(volumeManager); | 1079 gallery = new Gallery(volumeManager); |
| 1068 }); | 1080 }); |
| 1069 | 1081 |
| 1070 // Loads entries. | 1082 // Loads entries. |
| 1071 initializePromise.then(reload); | 1083 initializePromise.then(reload); |
| OLD | NEW |