Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: ui/file_manager/gallery/js/slide_mode.js

Issue 1149323006: Gallery: capture escape key in full screen by adding a permission. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary code. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/file_manager/gallery/manifest.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * Slide mode displays a single image and has a set of controls to navigate 6 * Slide mode displays a single image and has a set of controls to navigate
7 * between the images and to edit an image. 7 * between the images and to edit an image.
8 * 8 *
9 * @param {!HTMLElement} container Main container element. 9 * @param {!HTMLElement} container Main container element.
10 * @param {!HTMLElement} content Content container element. 10 * @param {!HTMLElement} content Content container element.
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 * @private 196 * @private
197 */ 197 */
198 this.slideShowTimeout_ = null; 198 this.slideShowTimeout_ = null;
199 199
200 /** 200 /**
201 * @type {?number} 201 * @type {?number}
202 * @private 202 * @private
203 */ 203 */
204 this.spinnerTimer_ = null; 204 this.spinnerTimer_ = null;
205 205
206 this.context_.appWindow.onRestored.addListener(this.onRestored_.bind(this));
207 window.addEventListener('resize', this.onResize_.bind(this)); 206 window.addEventListener('resize', this.onResize_.bind(this));
208 207
209 // ---------------------------------------------------------------- 208 // ----------------------------------------------------------------
210 // Initializes the UI. 209 // Initializes the UI.
211 210
212 /** 211 /**
213 * Container for displayed image. 212 * Container for displayed image.
214 * @type {!HTMLElement} 213 * @type {!HTMLElement}
215 * @private 214 * @private
216 * @const 215 * @const
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 * Keydown handler. 1101 * Keydown handler.
1103 * 1102 *
1104 * @param {!Event} event Event. 1103 * @param {!Event} event Event.
1105 * @return {boolean} True if handled. 1104 * @return {boolean} True if handled.
1106 */ 1105 */
1107 SlideMode.prototype.onKeyDown = function(event) { 1106 SlideMode.prototype.onKeyDown = function(event) {
1108 var keyID = util.getKeyModifiers(event) + event.keyIdentifier; 1107 var keyID = util.getKeyModifiers(event) + event.keyIdentifier;
1109 1108
1110 if (this.isSlideshowOn_()) { 1109 if (this.isSlideshowOn_()) {
1111 switch (keyID) { 1110 switch (keyID) {
1112 // Escape key is captured by the platform to exit full screen. We handle 1111 case 'U+001B': // Escape
1113 // it by onRestored event.
1114
1115 case 'MediaStop': 1112 case 'MediaStop':
1116 this.stopSlideshow_(event); 1113 this.stopSlideshow_(event);
1117 break; 1114 break;
1118 1115
1119 case 'U+0020': // Space pauses/resumes the slideshow. 1116 case 'U+0020': // Space pauses/resumes the slideshow.
1120 case 'MediaPlayPause': 1117 case 'MediaPlayPause':
1121 this.toggleSlideshowPause_(); 1118 this.toggleSlideshowPause_();
1122 break; 1119 break;
1123 1120
1124 case 'Up': 1121 case 'Up':
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 this.touchHandlers_.stopOperation(); 1206 this.touchHandlers_.stopOperation();
1210 this.imageView_.applyViewportChange(); 1207 this.imageView_.applyViewportChange();
1211 } 1208 }
1212 break; 1209 break;
1213 } 1210 }
1214 1211
1215 return true; 1212 return true;
1216 }; 1213 };
1217 1214
1218 /** 1215 /**
1219 * Restored event handler.
1220 * @private
1221 */
1222 SlideMode.prototype.onRestored_ = function() {
1223 // Leave slide show since the window should not be in full screen when
1224 // onRestored event is dispatched.
1225 if (this.isSlideshowOn_())
1226 this.stopSlideshow_();
1227 };
1228
1229 /**
1230 * Resize handler. 1216 * Resize handler.
1231 * @private 1217 * @private
1232 */ 1218 */
1233 SlideMode.prototype.onResize_ = function() { 1219 SlideMode.prototype.onResize_ = function() {
1234 this.viewport_.setScreenSize( 1220 this.viewport_.setScreenSize(
1235 this.container_.clientWidth, this.container_.clientHeight); 1221 this.container_.clientWidth, this.container_.clientHeight);
1236 this.touchHandlers_.stopOperation(); 1222 this.touchHandlers_.stopOperation();
1237 this.editor_.getBuffer().draw(); 1223 this.editor_.getBuffer().draw();
1238 }; 1224 };
1239 1225
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 var event = assertInstanceof(event, MouseEvent); 1851 var event = assertInstanceof(event, MouseEvent);
1866 var viewport = this.slideMode_.getViewport(); 1852 var viewport = this.slideMode_.getViewport();
1867 if (!this.enabled_ || !viewport.isZoomed()) 1853 if (!this.enabled_ || !viewport.isZoomed())
1868 return; 1854 return;
1869 this.stopOperation(); 1855 this.stopOperation();
1870 viewport.setOffset( 1856 viewport.setOffset(
1871 viewport.getOffsetX() + event.wheelDeltaX, 1857 viewport.getOffsetX() + event.wheelDeltaX,
1872 viewport.getOffsetY() + event.wheelDeltaY); 1858 viewport.getOffsetY() + event.wheelDeltaY);
1873 this.slideMode_.applyViewportChange(); 1859 this.slideMode_.applyViewportChange();
1874 }; 1860 };
OLDNEW
« no previous file with comments | « no previous file | ui/file_manager/gallery/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698