OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/browser/devtools/renderer_overrides_handler.h" | 5 #include "content/browser/devtools/renderer_overrides_handler.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/barrier_closure.h" | 10 #include "base/barrier_closure.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "ipc/ipc_sender.h" | 38 #include "ipc/ipc_sender.h" |
39 #include "net/base/net_util.h" | 39 #include "net/base/net_util.h" |
40 #include "third_party/WebKit/public/web/WebInputEvent.h" | 40 #include "third_party/WebKit/public/web/WebInputEvent.h" |
41 #include "ui/gfx/codec/jpeg_codec.h" | 41 #include "ui/gfx/codec/jpeg_codec.h" |
42 #include "ui/gfx/codec/png_codec.h" | 42 #include "ui/gfx/codec/png_codec.h" |
43 #include "ui/gfx/size_conversions.h" | 43 #include "ui/gfx/size_conversions.h" |
44 #include "ui/snapshot/snapshot.h" | 44 #include "ui/snapshot/snapshot.h" |
45 #include "url/gurl.h" | 45 #include "url/gurl.h" |
46 #include "webkit/browser/quota/quota_manager.h" | 46 #include "webkit/browser/quota/quota_manager.h" |
47 | 47 |
48 using WebKit::WebGestureEvent; | 48 using blink::WebGestureEvent; |
49 using WebKit::WebInputEvent; | 49 using blink::WebInputEvent; |
50 using WebKit::WebMouseEvent; | 50 using blink::WebMouseEvent; |
51 | 51 |
52 namespace content { | 52 namespace content { |
53 | 53 |
54 namespace { | 54 namespace { |
55 | 55 |
56 static const char kPng[] = "png"; | 56 static const char kPng[] = "png"; |
57 static const char kJpeg[] = "jpeg"; | 57 static const char kJpeg[] = "jpeg"; |
58 static int kDefaultScreenshotQuality = 80; | 58 static int kDefaultScreenshotQuality = 80; |
59 static int kFrameRateThresholdMs = 100; | 59 static int kFrameRateThresholdMs = 100; |
60 static int kCaptureRetryLimit = 2; | 60 static int kCaptureRetryLimit = 2; |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 return NULL; | 818 return NULL; |
819 | 819 |
820 bool device_space = false; | 820 bool device_space = false; |
821 if (!params->GetBoolean(devtools::Input::kParamDeviceSpace, | 821 if (!params->GetBoolean(devtools::Input::kParamDeviceSpace, |
822 &device_space) || | 822 &device_space) || |
823 !device_space) { | 823 !device_space) { |
824 return NULL; | 824 return NULL; |
825 } | 825 } |
826 | 826 |
827 RenderViewHost* host = agent_->GetRenderViewHost(); | 827 RenderViewHost* host = agent_->GetRenderViewHost(); |
828 WebKit::WebMouseEvent mouse_event; | 828 blink::WebMouseEvent mouse_event; |
829 ParseGenericInputParams(params, &mouse_event); | 829 ParseGenericInputParams(params, &mouse_event); |
830 | 830 |
831 std::string type; | 831 std::string type; |
832 if (params->GetString(devtools::Input::kParamType, | 832 if (params->GetString(devtools::Input::kParamType, |
833 &type)) { | 833 &type)) { |
834 if (type == "mousePressed") | 834 if (type == "mousePressed") |
835 mouse_event.type = WebInputEvent::MouseDown; | 835 mouse_event.type = WebInputEvent::MouseDown; |
836 else if (type == "mouseReleased") | 836 else if (type == "mouseReleased") |
837 mouse_event.type = WebInputEvent::MouseUp; | 837 mouse_event.type = WebInputEvent::MouseUp; |
838 else if (type == "mouseMoved") | 838 else if (type == "mouseMoved") |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 | 883 |
884 scoped_refptr<DevToolsProtocol::Response> | 884 scoped_refptr<DevToolsProtocol::Response> |
885 RendererOverridesHandler::InputDispatchGestureEvent( | 885 RendererOverridesHandler::InputDispatchGestureEvent( |
886 scoped_refptr<DevToolsProtocol::Command> command) { | 886 scoped_refptr<DevToolsProtocol::Command> command) { |
887 base::DictionaryValue* params = command->params(); | 887 base::DictionaryValue* params = command->params(); |
888 if (!params) | 888 if (!params) |
889 return NULL; | 889 return NULL; |
890 | 890 |
891 RenderViewHostImpl* host = static_cast<RenderViewHostImpl*>( | 891 RenderViewHostImpl* host = static_cast<RenderViewHostImpl*>( |
892 agent_->GetRenderViewHost()); | 892 agent_->GetRenderViewHost()); |
893 WebKit::WebGestureEvent event; | 893 blink::WebGestureEvent event; |
894 ParseGenericInputParams(params, &event); | 894 ParseGenericInputParams(params, &event); |
895 | 895 |
896 std::string type; | 896 std::string type; |
897 if (params->GetString(devtools::Input::kParamType, | 897 if (params->GetString(devtools::Input::kParamType, |
898 &type)) { | 898 &type)) { |
899 if (type == "scrollBegin") | 899 if (type == "scrollBegin") |
900 event.type = WebInputEvent::GestureScrollBegin; | 900 event.type = WebInputEvent::GestureScrollBegin; |
901 else if (type == "scrollUpdate") | 901 else if (type == "scrollUpdate") |
902 event.type = WebInputEvent::GestureScrollUpdate; | 902 event.type = WebInputEvent::GestureScrollUpdate; |
903 else if (type == "scrollEnd") | 903 else if (type == "scrollEnd") |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 return NULL; | 946 return NULL; |
947 } | 947 } |
948 event.data.pinchUpdate.scale = static_cast<float>(scale); | 948 event.data.pinchUpdate.scale = static_cast<float>(scale); |
949 } | 949 } |
950 | 950 |
951 host->ForwardGestureEvent(event); | 951 host->ForwardGestureEvent(event); |
952 return command->SuccessResponse(NULL); | 952 return command->SuccessResponse(NULL); |
953 } | 953 } |
954 | 954 |
955 } // namespace content | 955 } // namespace content |
OLD | NEW |