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

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

Issue 801533006: Add type annotations to gallery/js/gallery.js. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed false-positive lint errors. Created 6 years 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 | « ui/file_manager/gallery/js/mosaic_mode.js ('k') | no next file » | 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.
11 * @param {!HTMLElement} toolbar Toolbar element. 11 * @param {!HTMLElement} toolbar Toolbar element.
12 * @param {!ImageEditor.Prompt} prompt Prompt. 12 * @param {!ImageEditor.Prompt} prompt Prompt.
13 * @param {!ErrorBanner} errorBanner Error banner. 13 * @param {!ErrorBanner} errorBanner Error banner.
14 * @param {!cr.ui.ArrayDataModel} dataModel Data model. 14 * @param {!cr.ui.ArrayDataModel} dataModel Data model.
15 * @param {!cr.ui.ListSelectionModel} selectionModel Selection model. 15 * @param {!cr.ui.ListSelectionModel} selectionModel Selection model.
16 * @param {!Object} context Context. 16 * @param {!Object} context Context.
17 * @param {!VolumeManager} volumeManager Volume manager. 17 * @param {!VolumeManager} volumeManager Volume manager.
18 * @param {function(function())} toggleMode Function to toggle the Gallery mode. 18 * @param {function(function())} toggleMode Function to toggle the Gallery mode.
19 * @param {function(string):string} displayStringFunction String formatting 19 * @param {function(string):string} displayStringFunction String formatting
20 * function. 20 * function.
21 * @constructor 21 * @constructor
22 * @struct 22 * @struct
23 * @extends {cr.EventTarget}
23 */ 24 */
24 function SlideMode(container, content, toolbar, prompt, errorBanner, dataModel, 25 function SlideMode(container, content, toolbar, prompt, errorBanner, dataModel,
25 selectionModel, context, volumeManager, toggleMode, displayStringFunction) { 26 selectionModel, context, volumeManager, toggleMode, displayStringFunction) {
26 /** 27 /**
27 * @type {!HTMLElement} 28 * @type {!HTMLElement}
28 * @private 29 * @private
29 * @const 30 * @const
30 */ 31 */
31 this.container_ = container; 32 this.container_ = container;
32 33
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 */ 498 */
498 SlideMode.prototype.getTitle = function() { return 'GALLERY_SLIDE'; }; 499 SlideMode.prototype.getTitle = function() { return 'GALLERY_SLIDE'; };
499 500
500 /** 501 /**
501 * @return {!Viewport} Viewport. 502 * @return {!Viewport} Viewport.
502 */ 503 */
503 SlideMode.prototype.getViewport = function() { return this.viewport_; }; 504 SlideMode.prototype.getViewport = function() { return this.viewport_; };
504 505
505 /** 506 /**
506 * Load items, display the selected item. 507 * Load items, display the selected item.
507 * @param {!ImageRect} zoomFromRect Rectangle for zoom effect. 508 * @param {ImageRect} zoomFromRect Rectangle for zoom effect.
508 * @param {function()} displayCallback Called when the image is displayed. 509 * @param {function()} displayCallback Called when the image is displayed.
509 * @param {function()} loadCallback Called when the image is displayed. 510 * @param {function()} loadCallback Called when the image is displayed.
510 */ 511 */
511 SlideMode.prototype.enter = function( 512 SlideMode.prototype.enter = function(
512 zoomFromRect, displayCallback, loadCallback) { 513 zoomFromRect, displayCallback, loadCallback) {
513 this.sequenceDirection_ = 0; 514 this.sequenceDirection_ = 0;
514 this.sequenceLength_ = 0; 515 this.sequenceLength_ = 0;
515 516
516 var loadDone = function(loadType, delay) { 517 var loadDone = function(loadType, delay) {
517 this.active_ = true; 518 this.active_ = true;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 // Call load callback. 586 // Call load callback.
586 if (loadCallback) 587 if (loadCallback)
587 loadCallback(); 588 loadCallback();
588 }.bind(this)).catch(function(error) { 589 }.bind(this)).catch(function(error) {
589 console.error(error.stack, error); 590 console.error(error.stack, error);
590 }); 591 });
591 }; 592 };
592 593
593 /** 594 /**
594 * Leave the mode. 595 * Leave the mode.
595 * @param {!ImageRect} zoomToRect Rectangle for zoom effect. 596 * @param {ImageRect} zoomToRect Rectangle for zoom effect.
596 * @param {function()} callback Called when the image is committed and 597 * @param {function()} callback Called when the image is committed and
597 * the zoom-out animation has started. 598 * the zoom-out animation has started.
598 */ 599 */
599 SlideMode.prototype.leave = function(zoomToRect, callback) { 600 SlideMode.prototype.leave = function(zoomToRect, callback) {
600 var commitDone = function() { 601 var commitDone = function() {
601 this.stopEditing_(); 602 this.stopEditing_();
602 this.stopSlideshow_(); 603 this.stopSlideshow_();
603 ImageUtil.setAttribute(this.arrowBox_, 'active', false); 604 ImageUtil.setAttribute(this.arrowBox_, 'active', false);
604 this.selectionModel_.removeEventListener( 605 this.selectionModel_.removeEventListener(
605 'change', this.onSelectionBound_); 606 'change', this.onSelectionBound_);
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 SlideMode.prototype.requestPrefetch = function(direction, delay) { 1068 SlideMode.prototype.requestPrefetch = function(direction, delay) {
1068 if (this.getItemCount_() <= 1) return; 1069 if (this.getItemCount_() <= 1) return;
1069 1070
1070 var index = this.getNextSelectedIndex_(direction); 1071 var index = this.getNextSelectedIndex_(direction);
1071 this.imageView_.prefetch(this.getItem(index), delay); 1072 this.imageView_.prefetch(this.getItem(index), delay);
1072 }; 1073 };
1073 1074
1074 // Event handlers. 1075 // Event handlers.
1075 1076
1076 /** 1077 /**
1077 * Unload handler, to be called from the top frame.
1078 * @param {boolean} exiting True if the app is exiting.
1079 */
1080 SlideMode.prototype.onUnload = function(exiting) {
1081 };
1082
1083 /**
1084 * Click handler for the image container. 1078 * Click handler for the image container.
1085 * 1079 *
1086 * @param {!Event} event Mouse click event. 1080 * @param {!Event} event Mouse click event.
1087 * @private 1081 * @private
1088 */ 1082 */
1089 SlideMode.prototype.onClick_ = function(event) { 1083 SlideMode.prototype.onClick_ = function(event) {
1090 }; 1084 };
1091 1085
1092 /** 1086 /**
1093 * Click handler for the entire document. 1087 * Click handler for the entire document.
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 var event = assertInstanceof(event, MouseEvent); 1853 var event = assertInstanceof(event, MouseEvent);
1860 var viewport = this.slideMode_.getViewport(); 1854 var viewport = this.slideMode_.getViewport();
1861 if (!this.enabled_ || !viewport.isZoomed()) 1855 if (!this.enabled_ || !viewport.isZoomed())
1862 return; 1856 return;
1863 this.stopOperation(); 1857 this.stopOperation();
1864 viewport.setOffset( 1858 viewport.setOffset(
1865 viewport.getOffsetX() + event.wheelDeltaX, 1859 viewport.getOffsetX() + event.wheelDeltaX,
1866 viewport.getOffsetY() + event.wheelDeltaY); 1860 viewport.getOffsetY() + event.wheelDeltaY);
1867 this.slideMode_.applyViewportChange(); 1861 this.slideMode_.applyViewportChange();
1868 }; 1862 };
OLDNEW
« no previous file with comments | « ui/file_manager/gallery/js/mosaic_mode.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698