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