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

Side by Side Diff: content/shell/renderer/test_runner/event_sender.cc

Issue 755403006: Added experimental Touch.tilt, Touch.tiltDirection support for Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused code (event_sender.cc) Created 5 years, 9 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 | « content/shell/renderer/test_runner/event_sender.h ('k') | ui/events/cocoa/events_mac.mm » ('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 #include "content/shell/renderer/test_runner/event_sender.h" 5 #include "content/shell/renderer/test_runner/event_sender.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 std::vector<std::string> ContextClick(); 374 std::vector<std::string> ContextClick();
375 void TextZoomIn(); 375 void TextZoomIn();
376 void TextZoomOut(); 376 void TextZoomOut();
377 void ZoomPageIn(); 377 void ZoomPageIn();
378 void ZoomPageOut(); 378 void ZoomPageOut();
379 void SetPageZoomFactor(double factor); 379 void SetPageZoomFactor(double factor);
380 void SetPageScaleFactor(gin::Arguments* args); 380 void SetPageScaleFactor(gin::Arguments* args);
381 void SetPageScaleFactorLimits(gin::Arguments* args); 381 void SetPageScaleFactorLimits(gin::Arguments* args);
382 void ClearTouchPoints(); 382 void ClearTouchPoints();
383 void ReleaseTouchPoint(unsigned index); 383 void ReleaseTouchPoint(unsigned index);
384 void UpdateTouchPoint(unsigned index, double x, double y); 384 void UpdateTouchPoint(unsigned index, float x, float y);
385 void CancelTouchPoint(unsigned index); 385 void CancelTouchPoint(unsigned index);
386 void SetTouchPointTilt(unsigned index,
387 float tils,
388 float tiltDirection,
389 bool set_state_moved);
386 void SetTouchModifier(const std::string& key_name, bool set_mask); 390 void SetTouchModifier(const std::string& key_name, bool set_mask);
387 void SetTouchCancelable(bool cancelable); 391 void SetTouchCancelable(bool cancelable);
388 void DumpFilenameBeingDragged(); 392 void DumpFilenameBeingDragged();
389 void GestureFlingCancel(); 393 void GestureFlingCancel();
390 void GestureFlingStart(float x, 394 void GestureFlingStart(float x,
391 float y, 395 float y,
392 float velocity_x, 396 float velocity_x,
393 float velocity_y, 397 float velocity_y,
394 gin::Arguments* args); 398 gin::Arguments* args);
395 void GestureScrollFirstPoint(int x, int y); 399 void GestureScrollFirstPoint(int x, int y);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 .SetMethod("zoomPageIn", &EventSenderBindings::ZoomPageIn) 515 .SetMethod("zoomPageIn", &EventSenderBindings::ZoomPageIn)
512 .SetMethod("zoomPageOut", &EventSenderBindings::ZoomPageOut) 516 .SetMethod("zoomPageOut", &EventSenderBindings::ZoomPageOut)
513 .SetMethod("setPageZoomFactor", &EventSenderBindings::SetPageZoomFactor) 517 .SetMethod("setPageZoomFactor", &EventSenderBindings::SetPageZoomFactor)
514 .SetMethod("setPageScaleFactor", &EventSenderBindings::SetPageScaleFactor) 518 .SetMethod("setPageScaleFactor", &EventSenderBindings::SetPageScaleFactor)
515 .SetMethod("setPageScaleFactorLimits", 519 .SetMethod("setPageScaleFactorLimits",
516 &EventSenderBindings::SetPageScaleFactorLimits) 520 &EventSenderBindings::SetPageScaleFactorLimits)
517 .SetMethod("clearTouchPoints", &EventSenderBindings::ClearTouchPoints) 521 .SetMethod("clearTouchPoints", &EventSenderBindings::ClearTouchPoints)
518 .SetMethod("releaseTouchPoint", &EventSenderBindings::ReleaseTouchPoint) 522 .SetMethod("releaseTouchPoint", &EventSenderBindings::ReleaseTouchPoint)
519 .SetMethod("updateTouchPoint", &EventSenderBindings::UpdateTouchPoint) 523 .SetMethod("updateTouchPoint", &EventSenderBindings::UpdateTouchPoint)
520 .SetMethod("cancelTouchPoint", &EventSenderBindings::CancelTouchPoint) 524 .SetMethod("cancelTouchPoint", &EventSenderBindings::CancelTouchPoint)
525 .SetMethod("setTouchPointTilt", &EventSenderBindings::SetTouchPointTilt)
521 .SetMethod("setTouchModifier", &EventSenderBindings::SetTouchModifier) 526 .SetMethod("setTouchModifier", &EventSenderBindings::SetTouchModifier)
522 .SetMethod("setTouchCancelable", &EventSenderBindings::SetTouchCancelable) 527 .SetMethod("setTouchCancelable", &EventSenderBindings::SetTouchCancelable)
523 .SetMethod("dumpFilenameBeingDragged", 528 .SetMethod("dumpFilenameBeingDragged",
524 &EventSenderBindings::DumpFilenameBeingDragged) 529 &EventSenderBindings::DumpFilenameBeingDragged)
525 .SetMethod("gestureFlingCancel", &EventSenderBindings::GestureFlingCancel) 530 .SetMethod("gestureFlingCancel", &EventSenderBindings::GestureFlingCancel)
526 .SetMethod("gestureFlingStart", &EventSenderBindings::GestureFlingStart) 531 .SetMethod("gestureFlingStart", &EventSenderBindings::GestureFlingStart)
527 .SetMethod("gestureScrollFirstPoint", 532 .SetMethod("gestureScrollFirstPoint",
528 &EventSenderBindings::GestureScrollFirstPoint) 533 &EventSenderBindings::GestureScrollFirstPoint)
529 .SetMethod("touchStart", &EventSenderBindings::TouchStart) 534 .SetMethod("touchStart", &EventSenderBindings::TouchStart)
530 .SetMethod("touchMove", &EventSenderBindings::TouchMove) 535 .SetMethod("touchMove", &EventSenderBindings::TouchMove)
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 void EventSenderBindings::ClearTouchPoints() { 695 void EventSenderBindings::ClearTouchPoints() {
691 if (sender_) 696 if (sender_)
692 sender_->ClearTouchPoints(); 697 sender_->ClearTouchPoints();
693 } 698 }
694 699
695 void EventSenderBindings::ReleaseTouchPoint(unsigned index) { 700 void EventSenderBindings::ReleaseTouchPoint(unsigned index) {
696 if (sender_) 701 if (sender_)
697 sender_->ReleaseTouchPoint(index); 702 sender_->ReleaseTouchPoint(index);
698 } 703 }
699 704
700 void EventSenderBindings::UpdateTouchPoint(unsigned index, double x, double y) { 705 void EventSenderBindings::UpdateTouchPoint(unsigned index, float x, float y) {
701 if (sender_) 706 if (sender_)
702 sender_->UpdateTouchPoint(index, static_cast<float>(x), static_cast<float>(y )); 707 sender_->UpdateTouchPoint(index, x, y);
703 } 708 }
704 709
705 void EventSenderBindings::CancelTouchPoint(unsigned index) { 710 void EventSenderBindings::CancelTouchPoint(unsigned index) {
706 if (sender_) 711 if (sender_)
707 sender_->CancelTouchPoint(index); 712 sender_->CancelTouchPoint(index);
708 } 713 }
709 714
715 void EventSenderBindings::SetTouchPointTilt(unsigned index,
716 float tilt,
717 float tiltDirection,
718 bool set_state_moved) {
719 if (sender_)
720 sender_->SetTouchPointTilt(index, tilt, tiltDirection, set_state_moved);
721 }
722
710 void EventSenderBindings::SetTouchModifier(const std::string& key_name, 723 void EventSenderBindings::SetTouchModifier(const std::string& key_name,
711 bool set_mask) { 724 bool set_mask) {
712 if (sender_) 725 if (sender_)
713 sender_->SetTouchModifier(key_name, set_mask); 726 sender_->SetTouchModifier(key_name, set_mask);
714 } 727 }
715 728
716 void EventSenderBindings::SetTouchCancelable(bool cancelable) { 729 void EventSenderBindings::SetTouchCancelable(bool cancelable) {
717 if (sender_) 730 if (sender_)
718 sender_->SetTouchCancelable(cancelable); 731 sender_->SetTouchCancelable(cancelable);
719 } 732 }
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 void EventSender::CancelTouchPoint(unsigned index) { 1623 void EventSender::CancelTouchPoint(unsigned index) {
1611 if (index >= touch_points_.size()) { 1624 if (index >= touch_points_.size()) {
1612 ThrowTouchPointError(); 1625 ThrowTouchPointError();
1613 return; 1626 return;
1614 } 1627 }
1615 1628
1616 WebTouchPoint* touch_point = &touch_points_[index]; 1629 WebTouchPoint* touch_point = &touch_points_[index];
1617 touch_point->state = WebTouchPoint::StateCancelled; 1630 touch_point->state = WebTouchPoint::StateCancelled;
1618 } 1631 }
1619 1632
1633 void EventSender::SetTouchPointTilt(unsigned index,
1634 float tilt,
1635 float tiltDirection,
1636 bool set_state_moved) {
1637 if (index >= touch_points_.size()) {
1638 ThrowTouchPointError();
1639 return;
1640 }
1641
1642 WebTouchPoint* touch_point = &touch_points_[index];
1643 touch_point->tilt = tilt;
1644 touch_point->tiltDirection = tiltDirection;
1645 if (set_state_moved)
1646 touch_point->state = WebTouchPoint::StateMoved;
1647 }
1648
1620 void EventSender::SetTouchModifier(const std::string& key_name, 1649 void EventSender::SetTouchModifier(const std::string& key_name,
1621 bool set_mask) { 1650 bool set_mask) {
1622 int mask = 0; 1651 int mask = 0;
1623 if (key_name == "shift") 1652 if (key_name == "shift")
1624 mask = WebInputEvent::ShiftKey; 1653 mask = WebInputEvent::ShiftKey;
1625 else if (key_name == "alt") 1654 else if (key_name == "alt")
1626 mask = WebInputEvent::AltKey; 1655 mask = WebInputEvent::AltKey;
1627 else if (key_name == "ctrl") 1656 else if (key_name == "ctrl")
1628 mask = WebInputEvent::ControlKey; 1657 mask = WebInputEvent::ControlKey;
1629 else if (key_name == "meta") 1658 else if (key_name == "meta")
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
2513 2542
2514 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) { 2543 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) {
2515 if (WebPagePopup* popup = view_->pagePopup()) { 2544 if (WebPagePopup* popup = view_->pagePopup()) {
2516 if (!WebInputEvent::isKeyboardEventType(event.type)) 2545 if (!WebInputEvent::isKeyboardEventType(event.type))
2517 return popup->handleInputEvent(event); 2546 return popup->handleInputEvent(event);
2518 } 2547 }
2519 return view_->handleInputEvent(event); 2548 return view_->handleInputEvent(event);
2520 } 2549 }
2521 2550
2522 } // namespace content 2551 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/event_sender.h ('k') | ui/events/cocoa/events_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698