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

Side by Side Diff: chrome/browser/resources/shared/js/cr/ui/touch_handler.js

Issue 8775024: Fix NTP not to slide with mouse (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't include tweak to enable Xinput2 Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 * @fileoverview Touch Handler. Class that handles all touch events and 6 * @fileoverview Touch Handler. Class that handles all touch events and
7 * uses them to interpret higher level gestures and behaviors. TouchEvent is a 7 * uses them to interpret higher level gestures and behaviors. TouchEvent is a
8 * built in mobile safari type: 8 * built in mobile safari type:
9 * http://developer.apple.com/safari/library/documentation/UserExperience/Refere nce/TouchEventClassReference/TouchEvent/TouchEvent.html. 9 * http://developer.apple.com/safari/library/documentation/UserExperience/Refere nce/TouchEventClassReference/TouchEvent/TouchEvent.html.
10 * This class is intended to work with all webkit browsers, tested on Chrome and 10 * This class is intended to work with all webkit browsers, tested on Chrome and
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 * If defined and true, the next click event should be swallowed 328 * If defined and true, the next click event should be swallowed
329 * @type {boolean|undefined} 329 * @type {boolean|undefined}
330 * @private 330 * @private
331 */ 331 */
332 swallowNextClick_: undefined, 332 swallowNextClick_: undefined,
333 333
334 /** 334 /**
335 * Start listenting for events. 335 * Start listenting for events.
336 * @param {boolean=} opt_capture True if the TouchHandler should listen to 336 * @param {boolean=} opt_capture True if the TouchHandler should listen to
337 * during the capture phase. 337 * during the capture phase.
338 * @param {boolean=} opt_mouse True if the TouchHandler should generate
339 * events for mouse input (in addition to touch input).
338 */ 340 */
339 enable: function(opt_capture) { 341 enable: function(opt_capture, opt_mouse) {
340 var capture = !!opt_capture; 342 var capture = !!opt_capture;
341 343
342 // Just listen to start events for now. When a touch is occuring we'll 344 // Just listen to start events for now. When a touch is occuring we'll
343 // want to be subscribed to move and end events on the document, but we 345 // want to be subscribed to move and end events on the document, but we
344 // don't want to incur the cost of lots of no-op handlers on the document. 346 // don't want to incur the cost of lots of no-op handlers on the document.
345 this.events_.add(this.element_, 'touchstart', this.onStart_.bind(this), 347 this.events_.add(this.element_, 'touchstart', this.onStart_.bind(this),
346 capture); 348 capture);
347 this.events_.add(this.element_, 'mousedown', 349 if (opt_mouse) {
348 this.mouseToTouchCallback_(this.onStart_.bind(this)), 350 this.events_.add(this.element_, 'mousedown',
349 capture); 351 this.mouseToTouchCallback_(this.onStart_.bind(this)),
352 capture);
353 }
350 354
351 // If the element is long-pressed, we may need to swallow a click 355 // If the element is long-pressed, we may need to swallow a click
352 this.events_.add(this.element_, 'click', this.onClick_.bind(this), true); 356 this.events_.add(this.element_, 'click', this.onClick_.bind(this), true);
353 }, 357 },
354 358
355 /** 359 /**
356 * Stop listening to all events. 360 * Stop listening to all events.
357 */ 361 */
358 disable: function() { 362 disable: function() {
359 this.stopTouching_(); 363 this.stopTouching_();
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 847
844 this.element_.dispatchEvent(event); 848 this.element_.dispatchEvent(event);
845 return event.enableDrag; 849 return event.enableDrag;
846 } 850 }
847 }; 851 };
848 852
849 return { 853 return {
850 TouchHandler: TouchHandler 854 TouchHandler: TouchHandler
851 }; 855 };
852 }); 856 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/shared/js/cr/ui/card_slider.js ('k') | chrome/browser/resources/touchhandler.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698