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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 530 * Change to slide mode. | 530 * Change to slide mode. |
| 531 * @private | 531 * @private |
| 532 */ | 532 */ |
| 533 Gallery.prototype.onChangeToSlideMode_ = function() { | 533 Gallery.prototype.onChangeToSlideMode_ = function() { |
| 534 if (this.modeSwitchButton_.disabled) | 534 if (this.modeSwitchButton_.disabled) |
| 535 return; | 535 return; |
| 536 | 536 |
| 537 this.changeCurrentMode_(this.slideMode_); | 537 this.changeCurrentMode_(this.slideMode_); |
| 538 }; | 538 }; |
| 539 | 539 |
| 540 | |
| 541 /** | |
| 542 * Update attributes of slide/thumbnail toggle button | |
| 543 * @param {Event=} event Event that caused this call | |
| 544 * @private | |
| 545 */ | |
|
oka
2017/01/12 01:59:24
Add a space before *.
takise
2017/01/12 04:08:05
Done.
| |
| 546 | |
|
oka
2017/01/12 01:59:24
Remove this empty line.
takise
2017/01/12 04:08:05
Done.
| |
| 547 Gallery.prototype.updateModeButtonAttribute_ = function(event) { | |
| 548 var button = event.currentTarget; | |
|
oka
2017/01/12 01:59:24
Are you sure that event is not undefined? If event
takise
2017/01/12 04:08:05
Done.
| |
| 549 if (this.currentMode_ === this.slideMode_) | |
| 550 button.setAttribute("aria-label", str("GALLERY_SLIDE")); | |
| 551 else | |
| 552 button.setAttribute("aria-label", str("GALLERY_THUMBNAIL")); | |
| 553 } | |
| 554 | |
| 540 /** | 555 /** |
| 541 * Change current mode. | 556 * Change current mode. |
| 542 * @param {!(SlideMode|ThumbnailMode)} mode Target mode. | 557 * @param {!(SlideMode|ThumbnailMode)} mode Target mode. |
| 543 * @param {Event=} opt_event Event that caused this call. | 558 * @param {Event=} opt_event Event that caused this call. |
| 544 * @return {!Promise} Resolved when mode has been changed. | 559 * @return {!Promise} Resolved when mode has been changed. |
| 545 * @private | 560 * @private |
| 546 */ | 561 */ |
| 547 Gallery.prototype.changeCurrentMode_ = function(mode, opt_event) { | 562 Gallery.prototype.changeCurrentMode_ = function(mode, opt_event) { |
| 548 return new Promise(function(fulfill, reject) { | 563 return new Promise(function(fulfill, reject) { |
| 549 // Do not re-enter while changing the mode. | 564 // Do not re-enter while changing the mode. |
| 550 if (this.currentMode_ === mode || this.changingMode_) { | 565 if (this.currentMode_ === mode || this.changingMode_) { |
| 551 fulfill(); | 566 fulfill(); |
| 552 return; | 567 return; |
| 553 } | 568 } |
| 554 | 569 |
| 555 if (opt_event) | 570 if (opt_event) |
| 556 this.onUserAction_(); | 571 this.onUserAction_(); |
| 557 | 572 |
| 558 this.changingMode_ = true; | 573 this.changingMode_ = true; |
| 559 | 574 |
| 560 var onModeChanged = function() { | 575 var onModeChanged = function() { |
| 561 this.changingMode_ = false; | 576 this.changingMode_ = false; |
| 562 fulfill(); | 577 fulfill(); |
| 563 }.bind(this); | 578 }.bind(this); |
| 564 | 579 |
| 565 var thumbnailIndex = Math.max(0, this.selectionModel_.selectedIndex); | 580 var thumbnailIndex = Math.max(0, this.selectionModel_.selectedIndex); |
| 566 var thumbnailRect = ImageRect.createFromBounds( | 581 var thumbnailRect = ImageRect.createFromBounds( |
| 567 this.thumbnailMode_.getThumbnailRect(thumbnailIndex)); | 582 this.thumbnailMode_.getThumbnailRect(thumbnailIndex)); |
| 568 | 583 |
| 584 this.updateModeButtonAttribute_(opt_event); | |
|
oka
2017/01/12 01:59:24
I think this line should be moved to setCurrentMod
takise
2017/01/12 04:08:05
Done.
| |
| 585 | |
| 569 if (mode === this.thumbnailMode_) { | 586 if (mode === this.thumbnailMode_) { |
| 570 this.setCurrentMode_(this.thumbnailMode_); | 587 this.setCurrentMode_(this.thumbnailMode_); |
| 571 this.slideMode_.leave( | 588 this.slideMode_.leave( |
| 572 thumbnailRect, | 589 thumbnailRect, |
| 573 function() { | 590 function() { |
| 574 // Show thumbnail mode and perform animation. | 591 // Show thumbnail mode and perform animation. |
| 575 this.thumbnailMode_.show(); | 592 this.thumbnailMode_.show(); |
| 576 var fromRect = this.slideMode_.getSelectedImageRect(); | 593 var fromRect = this.slideMode_.getSelectedImageRect(); |
| 577 if (fromRect) { | 594 if (fromRect) { |
| 578 this.thumbnailMode_.performEnterAnimation( | 595 this.thumbnailMode_.performEnterAnimation( |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1062 */ | 1079 */ |
| 1063 var initializePromise = | 1080 var initializePromise = |
| 1064 Promise.all([loadTimeDataPromise, volumeManagerPromise]). | 1081 Promise.all([loadTimeDataPromise, volumeManagerPromise]). |
| 1065 then(function(args) { | 1082 then(function(args) { |
| 1066 var volumeManager = args[1]; | 1083 var volumeManager = args[1]; |
| 1067 gallery = new Gallery(volumeManager); | 1084 gallery = new Gallery(volumeManager); |
| 1068 }); | 1085 }); |
| 1069 | 1086 |
| 1070 // Loads entries. | 1087 // Loads entries. |
| 1071 initializePromise.then(reload); | 1088 initializePromise.then(reload); |
| OLD | NEW |