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 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ |
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "cc/output/compositor_frame_metadata.h" | 12 #include "cc/output/compositor_frame_metadata.h" |
13 #include "content/browser/devtools/protocol/devtools_protocol_handler.h" | 13 #include "content/browser/devtools/protocol/devtools_protocol_handler.h" |
14 #include "content/public/browser/readback_types.h" | 14 #include "content/public/browser/readback_types.h" |
| 15 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" |
15 | 16 |
16 class SkBitmap; | 17 class SkBitmap; |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 class RenderViewHostImpl; | 21 class RenderViewHostImpl; |
21 | 22 |
22 namespace devtools { | 23 namespace devtools { |
23 namespace page { | 24 namespace page { |
24 | 25 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 double* longitude, | 60 double* longitude, |
60 double* accuracy); | 61 double* accuracy); |
61 | 62 |
62 Response ClearGeolocationOverride(); | 63 Response ClearGeolocationOverride(); |
63 | 64 |
64 Response SetTouchEmulationEnabled(bool enabled, | 65 Response SetTouchEmulationEnabled(bool enabled, |
65 const std::string* configuration); | 66 const std::string* configuration); |
66 | 67 |
67 Response CaptureScreenshot(DevToolsCommandId command_id); | 68 Response CaptureScreenshot(DevToolsCommandId command_id); |
68 | 69 |
| 70 Response CanEmulate(bool* result); |
| 71 Response SetDeviceMetricsOverride(int width, |
| 72 int height, |
| 73 double device_scale_factor, |
| 74 bool mobile, |
| 75 bool fit_window, |
| 76 const double* optional_scale, |
| 77 const double* optional_offset_x, |
| 78 const double* optional_offset_y); |
| 79 Response ClearDeviceMetricsOverride(); |
| 80 |
69 Response CanScreencast(bool* result); | 81 Response CanScreencast(bool* result); |
70 Response CanEmulate(bool* result); | |
71 | |
72 Response StartScreencast(const std::string* format, | 82 Response StartScreencast(const std::string* format, |
73 const int* quality, | 83 const int* quality, |
74 const int* max_width, | 84 const int* max_width, |
75 const int* max_height); | 85 const int* max_height); |
76 Response StopScreencast(); | 86 Response StopScreencast(); |
77 Response ScreencastFrameAck(int frame_number); | 87 Response ScreencastFrameAck(int frame_number); |
78 | 88 |
79 Response StartRecordingFrames(int max_frame_count); | 89 Response StartRecordingFrames(int max_frame_count); |
80 Response StopRecordingFrames(DevToolsCommandId command_id); | 90 Response StopRecordingFrames(DevToolsCommandId command_id); |
81 Response CancelRecordingFrames(); | 91 Response CancelRecordingFrames(); |
82 | 92 |
83 Response HandleJavaScriptDialog(bool accept, const std::string* prompt_text); | 93 Response HandleJavaScriptDialog(bool accept, const std::string* prompt_text); |
84 | 94 |
85 Response QueryUsageAndQuota(DevToolsCommandId command_id, | 95 Response QueryUsageAndQuota(DevToolsCommandId command_id, |
86 const std::string& security_origin); | 96 const std::string& security_origin); |
87 | 97 |
88 Response SetColorPickerEnabled(bool enabled); | 98 Response SetColorPickerEnabled(bool enabled); |
89 | 99 |
90 private: | 100 private: |
91 void UpdateTouchEventEmulationState(); | 101 void UpdateTouchEventEmulationState(); |
| 102 void UpdateDeviceEmulationState(); |
92 | 103 |
93 void NotifyScreencastVisibility(bool visible); | 104 void NotifyScreencastVisibility(bool visible); |
94 void InnerSwapCompositorFrame(); | 105 void InnerSwapCompositorFrame(); |
95 void ScreencastFrameCaptured(const cc::CompositorFrameMetadata& metadata, | 106 void ScreencastFrameCaptured(const cc::CompositorFrameMetadata& metadata, |
96 const SkBitmap& bitmap, | 107 const SkBitmap& bitmap, |
97 ReadbackResponse response); | 108 ReadbackResponse response); |
98 void ScreencastFrameEncoded(const cc::CompositorFrameMetadata& metadata, | 109 void ScreencastFrameEncoded(const cc::CompositorFrameMetadata& metadata, |
99 const base::Time& timestamp, | 110 const base::Time& timestamp, |
100 const std::string& data); | 111 const std::string& data); |
101 | 112 |
102 void ScreenshotCaptured( | 113 void ScreenshotCaptured( |
103 DevToolsCommandId command_id, | 114 DevToolsCommandId command_id, |
104 const unsigned char* png_data, | 115 const unsigned char* png_data, |
105 size_t png_size); | 116 size_t png_size); |
106 | 117 |
107 void OnColorPicked(int r, int g, int b, int a); | 118 void OnColorPicked(int r, int g, int b, int a); |
108 void OnFramesRecorded( | 119 void OnFramesRecorded( |
109 DevToolsCommandId command_id, | 120 DevToolsCommandId command_id, |
110 scoped_refptr<StopRecordingFramesResponse> response_data); | 121 scoped_refptr<StopRecordingFramesResponse> response_data); |
111 | 122 |
112 bool enabled_; | 123 bool enabled_; |
| 124 |
113 bool touch_emulation_enabled_; | 125 bool touch_emulation_enabled_; |
114 std::string touch_emulation_configuration_; | 126 std::string touch_emulation_configuration_; |
115 | 127 |
| 128 bool device_emulation_enabled_; |
| 129 blink::WebDeviceEmulationParams device_emulation_params_; |
| 130 |
116 bool screencast_enabled_; | 131 bool screencast_enabled_; |
117 std::string screencast_format_; | 132 std::string screencast_format_; |
118 int screencast_quality_; | 133 int screencast_quality_; |
119 int screencast_max_width_; | 134 int screencast_max_width_; |
120 int screencast_max_height_; | 135 int screencast_max_height_; |
121 int capture_retry_count_; | 136 int capture_retry_count_; |
122 bool has_compositor_frame_metadata_; | 137 bool has_compositor_frame_metadata_; |
123 cc::CompositorFrameMetadata next_compositor_frame_metadata_; | 138 cc::CompositorFrameMetadata next_compositor_frame_metadata_; |
124 cc::CompositorFrameMetadata last_compositor_frame_metadata_; | 139 cc::CompositorFrameMetadata last_compositor_frame_metadata_; |
125 int screencast_frame_sent_; | 140 int screencast_frame_sent_; |
126 int screencast_frame_acked_; | 141 int screencast_frame_acked_; |
127 bool processing_screencast_frame_; | 142 bool processing_screencast_frame_; |
128 | 143 |
129 scoped_ptr<ColorPicker> color_picker_; | 144 scoped_ptr<ColorPicker> color_picker_; |
130 scoped_ptr<FrameRecorder> frame_recorder_; | 145 scoped_ptr<FrameRecorder> frame_recorder_; |
131 | 146 |
132 RenderViewHostImpl* host_; | 147 RenderViewHostImpl* host_; |
133 scoped_ptr<Client> client_; | 148 scoped_ptr<Client> client_; |
134 base::WeakPtrFactory<PageHandler> weak_factory_; | 149 base::WeakPtrFactory<PageHandler> weak_factory_; |
135 | 150 |
136 DISALLOW_COPY_AND_ASSIGN(PageHandler); | 151 DISALLOW_COPY_AND_ASSIGN(PageHandler); |
137 }; | 152 }; |
138 | 153 |
139 } // namespace page | 154 } // namespace page |
140 } // namespace devtools | 155 } // namespace devtools |
141 } // namespace content | 156 } // namespace content |
142 | 157 |
143 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ | 158 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ |
OLD | NEW |