OLD | NEW |
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 "components/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" |
11 #include "content/shell/renderer/test_runner/mock_spell_check.h" | 11 #include "components/test_runner/mock_spell_check.h" |
12 #include "content/shell/renderer/test_runner/test_interfaces.h" | 12 #include "components/test_runner/test_interfaces.h" |
13 #include "content/shell/renderer/test_runner/web_test_delegate.h" | 13 #include "components/test_runner/web_test_delegate.h" |
14 #include "content/shell/renderer/test_runner/web_test_proxy.h" | 14 #include "components/test_runner/web_test_proxy.h" |
15 #include "gin/handle.h" | 15 #include "gin/handle.h" |
16 #include "gin/object_template_builder.h" | 16 #include "gin/object_template_builder.h" |
17 #include "gin/wrappable.h" | 17 #include "gin/wrappable.h" |
18 #include "third_party/WebKit/public/platform/WebString.h" | 18 #include "third_party/WebKit/public/platform/WebString.h" |
19 #include "third_party/WebKit/public/platform/WebVector.h" | 19 #include "third_party/WebKit/public/platform/WebVector.h" |
20 #include "third_party/WebKit/public/web/WebContextMenuData.h" | 20 #include "third_party/WebKit/public/web/WebContextMenuData.h" |
21 #include "third_party/WebKit/public/web/WebFrame.h" | 21 #include "third_party/WebKit/public/web/WebFrame.h" |
22 #include "third_party/WebKit/public/web/WebKit.h" | 22 #include "third_party/WebKit/public/web/WebKit.h" |
23 #include "third_party/WebKit/public/web/WebPagePopup.h" | 23 #include "third_party/WebKit/public/web/WebPagePopup.h" |
24 #include "third_party/WebKit/public/web/WebView.h" | 24 #include "third_party/WebKit/public/web/WebView.h" |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 if (sender_) | 690 if (sender_) |
691 sender_->ClearTouchPoints(); | 691 sender_->ClearTouchPoints(); |
692 } | 692 } |
693 | 693 |
694 void EventSenderBindings::ReleaseTouchPoint(unsigned index) { | 694 void EventSenderBindings::ReleaseTouchPoint(unsigned index) { |
695 if (sender_) | 695 if (sender_) |
696 sender_->ReleaseTouchPoint(index); | 696 sender_->ReleaseTouchPoint(index); |
697 } | 697 } |
698 | 698 |
699 void EventSenderBindings::UpdateTouchPoint(unsigned index, double x, double y) { | 699 void EventSenderBindings::UpdateTouchPoint(unsigned index, double x, double y) { |
700 if (sender_) | 700 if (sender_) { |
701 sender_->UpdateTouchPoint(index, static_cast<float>(x), static_cast<float>(y
)); | 701 sender_->UpdateTouchPoint(index, static_cast<float>(x), |
| 702 static_cast<float>(y)); |
| 703 } |
702 } | 704 } |
703 | 705 |
704 void EventSenderBindings::CancelTouchPoint(unsigned index) { | 706 void EventSenderBindings::CancelTouchPoint(unsigned index) { |
705 if (sender_) | 707 if (sender_) |
706 sender_->CancelTouchPoint(index); | 708 sender_->CancelTouchPoint(index); |
707 } | 709 } |
708 | 710 |
709 void EventSenderBindings::SetTouchModifier(const std::string& key_name, | 711 void EventSenderBindings::SetTouchModifier(const std::string& key_name, |
710 bool set_mask) { | 712 bool set_mask) { |
711 if (sender_) | 713 if (sender_) |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 last_mouse_pos_, | 1523 last_mouse_pos_, |
1522 GetCurrentEventTimeSec(), | 1524 GetCurrentEventTimeSec(), |
1523 click_count_, | 1525 click_count_, |
1524 0, | 1526 0, |
1525 &event); | 1527 &event); |
1526 HandleInputEventOnViewOrPopup(event); | 1528 HandleInputEventOnViewOrPopup(event); |
1527 | 1529 |
1528 pressed_button_= WebMouseEvent::ButtonNone; | 1530 pressed_button_= WebMouseEvent::ButtonNone; |
1529 #endif | 1531 #endif |
1530 | 1532 |
1531 std::vector<std::string> menu_items = MakeMenuItemStringsFor(last_context_menu
_data_.get(), delegate_); | 1533 std::vector<std::string> menu_items = |
| 1534 MakeMenuItemStringsFor(last_context_menu_data_.get(), delegate_); |
1532 last_context_menu_data_.reset(); | 1535 last_context_menu_data_.reset(); |
1533 return menu_items; | 1536 return menu_items; |
1534 } | 1537 } |
1535 | 1538 |
1536 void EventSender::TextZoomIn() { | 1539 void EventSender::TextZoomIn() { |
1537 view_->setTextZoomFactor(view_->textZoomFactor() * 1.2f); | 1540 view_->setTextZoomFactor(view_->textZoomFactor() * 1.2f); |
1538 } | 1541 } |
1539 | 1542 |
1540 void EventSender::TextZoomOut() { | 1543 void EventSender::TextZoomOut() { |
1541 view_->setTextZoomFactor(view_->textZoomFactor() / 1.2f); | 1544 view_->setTextZoomFactor(view_->textZoomFactor() / 1.2f); |
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2517 | 2520 |
2518 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) { | 2521 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) { |
2519 if (WebPagePopup* popup = view_->pagePopup()) { | 2522 if (WebPagePopup* popup = view_->pagePopup()) { |
2520 if (!WebInputEvent::isKeyboardEventType(event.type)) | 2523 if (!WebInputEvent::isKeyboardEventType(event.type)) |
2521 return popup->handleInputEvent(event); | 2524 return popup->handleInputEvent(event); |
2522 } | 2525 } |
2523 return view_->handleInputEvent(event); | 2526 return view_->handleInputEvent(event); |
2524 } | 2527 } |
2525 | 2528 |
2526 } // namespace content | 2529 } // namespace content |
OLD | NEW |