| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * Dimmable UI Controller. | 6 * Dimmable UI Controller. |
| 7 * @param {!HTMLElement} container | 7 * @param {!HTMLElement} container |
| 8 * @constructor | 8 * @constructor |
| 9 * @struct | 9 * @struct |
| 10 */ | 10 */ |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * @private {number} | 24 * @private {number} |
| 25 */ | 25 */ |
| 26 this.timeoutId_ = 0; | 26 this.timeoutId_ = 0; |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * @private {boolean} | 29 * @private {boolean} |
| 30 */ | 30 */ |
| 31 this.isCursorInTools_ = false; | 31 this.isCursorInTools_ = false; |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * @private {Gallery.Mode|undefined} | 34 * @private {GalleryMode|undefined} |
| 35 */ | 35 */ |
| 36 this.mode_ = undefined; | 36 this.mode_ = undefined; |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * @private {Gallery.SubMode|undefined} | 39 * @private {GallerySubMode|undefined} |
| 40 */ | 40 */ |
| 41 this.subMode_ = undefined; | 41 this.subMode_ = undefined; |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * @private {boolean} | 44 * @private {boolean} |
| 45 */ | 45 */ |
| 46 this.spokenFeedbackEnabled_ = false; | 46 this.spokenFeedbackEnabled_ = false; |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * @private {boolean} | 49 * @private {boolean} |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 /** | 91 /** |
| 92 * We don't allow user to change visibility of tools shorter than this interval. | 92 * We don't allow user to change visibility of tools shorter than this interval. |
| 93 * This is necessary not to hide tools immediately after they become visible by | 93 * This is necessary not to hide tools immediately after they become visible by |
| 94 * touchstart event when user taps UI to make them visible. | 94 * touchstart event when user taps UI to make them visible. |
| 95 * @const {number} | 95 * @const {number} |
| 96 */ | 96 */ |
| 97 DimmableUIController.MIN_OPERATION_INTERVAL = 500; // ms | 97 DimmableUIController.MIN_OPERATION_INTERVAL = 500; // ms |
| 98 | 98 |
| 99 /** | 99 /** |
| 100 * Returns true if this controller should be disabled. | 100 * Returns true if this controller should be disabled. |
| 101 * @param {Gallery.Mode|undefined} mode | 101 * @param {GalleryMode|undefined} mode |
| 102 * @param {Gallery.SubMode|undefined} subMode | 102 * @param {GallerySubMode|undefined} subMode |
| 103 * @param {boolean} loading | 103 * @param {boolean} loading |
| 104 * @param {boolean} spokenFeedbackEnabled | 104 * @param {boolean} spokenFeedbackEnabled |
| 105 * @param {boolean} renaming | 105 * @param {boolean} renaming |
| 106 * @return {boolean} | 106 * @return {boolean} |
| 107 */ | 107 */ |
| 108 DimmableUIController.shouldBeDisabled = function( | 108 DimmableUIController.shouldBeDisabled = function( |
| 109 mode, subMode, loading, spokenFeedbackEnabled, renaming) { | 109 mode, subMode, loading, spokenFeedbackEnabled, renaming) { |
| 110 return spokenFeedbackEnabled || | 110 return spokenFeedbackEnabled || mode === undefined || subMode === undefined || |
| 111 mode === undefined || | 111 mode === GalleryMode.THUMBNAIL || |
| 112 subMode === undefined || | 112 (mode === GalleryMode.SLIDE && subMode === GallerySubMode.EDIT) || |
| 113 mode === Gallery.Mode.THUMBNAIL || | 113 (mode === GalleryMode.SLIDE && subMode === GallerySubMode.BROWSE && |
| 114 (mode === Gallery.Mode.SLIDE && subMode === Gallery.SubMode.EDIT) || | |
| 115 (mode === Gallery.Mode.SLIDE && subMode === Gallery.SubMode.BROWSE && | |
| 116 (loading || renaming)); | 114 (loading || renaming)); |
| 117 }; | 115 }; |
| 118 | 116 |
| 119 /** | 117 /** |
| 120 * Sets current mode of Gallery. | 118 * Sets current mode of Gallery. |
| 121 * @param {Gallery.Mode} mode | 119 * @param {GalleryMode} mode |
| 122 * @param {Gallery.SubMode} subMode | 120 * @param {GallerySubMode} subMode |
| 123 */ | 121 */ |
| 124 DimmableUIController.prototype.setCurrentMode = function(mode, subMode) { | 122 DimmableUIController.prototype.setCurrentMode = function(mode, subMode) { |
| 125 if (this.mode_ === mode && this.subMode_ === subMode) | 123 if (this.mode_ === mode && this.subMode_ === subMode) |
| 126 return; | 124 return; |
| 127 | 125 |
| 128 this.mode_ = mode; | 126 this.mode_ = mode; |
| 129 this.subMode_ = subMode; | 127 this.subMode_ = subMode; |
| 130 this.updateAvailability_(); | 128 this.updateAvailability_(); |
| 131 }; | 129 }; |
| 132 | 130 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 }; | 369 }; |
| 372 | 370 |
| 373 /** | 371 /** |
| 374 * Sets cursor's state as out of tools. Mouseout event is not dispatched for | 372 * Sets cursor's state as out of tools. Mouseout event is not dispatched for |
| 375 * some cases even when mouse cursor goes out of elements. This method is used | 373 * some cases even when mouse cursor goes out of elements. This method is used |
| 376 * to handle these cases manually. | 374 * to handle these cases manually. |
| 377 */ | 375 */ |
| 378 DimmableUIController.prototype.setCursorOutOfTools = function() { | 376 DimmableUIController.prototype.setCursorOutOfTools = function() { |
| 379 this.isCursorInTools_ = false; | 377 this.isCursorInTools_ = false; |
| 380 }; | 378 }; |
| OLD | NEW |