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 | 15 |
16 class SkBitmap; | 16 class SkBitmap; |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class RenderViewHostImpl; | 20 class RenderViewHostImpl; |
21 | 21 |
22 namespace devtools { | 22 namespace devtools { |
23 namespace page { | 23 namespace page { |
24 | 24 |
25 class ColorPicker; | 25 class ColorPicker; |
26 class FrameRecorder; | |
27 | 26 |
28 class PageHandler { | 27 class PageHandler { |
29 public: | 28 public: |
30 typedef DevToolsProtocolClient::Response Response; | 29 typedef DevToolsProtocolClient::Response Response; |
31 | 30 |
32 class ScreencastListener { | 31 class ScreencastListener { |
33 public: | 32 public: |
34 virtual ~ScreencastListener() { } | 33 virtual ~ScreencastListener() { } |
35 virtual void ScreencastEnabledChanged() = 0; | 34 virtual void ScreencastEnabledChanged() = 0; |
36 }; | 35 }; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 Response CanScreencast(bool* result); | 67 Response CanScreencast(bool* result); |
69 Response StartScreencast(const std::string* format, | 68 Response StartScreencast(const std::string* format, |
70 const int* quality, | 69 const int* quality, |
71 const int* max_width, | 70 const int* max_width, |
72 const int* max_height); | 71 const int* max_height); |
73 Response StopScreencast(); | 72 Response StopScreencast(); |
74 Response ScreencastFrameAck(int frame_number); | 73 Response ScreencastFrameAck(int frame_number); |
75 | 74 |
76 Response StartRecordingFrames(int max_frame_count); | 75 Response StartRecordingFrames(int max_frame_count); |
77 Response StopRecordingFrames(DevToolsCommandId command_id); | 76 Response StopRecordingFrames(DevToolsCommandId command_id); |
78 Response CancelRecordingFrames(); | |
dgozman
2015/03/27 12:58:58
Was it never added to protocol.json?
| |
79 | 77 |
80 Response HandleJavaScriptDialog(bool accept, const std::string* prompt_text); | 78 Response HandleJavaScriptDialog(bool accept, const std::string* prompt_text); |
81 | 79 |
82 Response QueryUsageAndQuota(DevToolsCommandId command_id, | 80 Response QueryUsageAndQuota(DevToolsCommandId command_id, |
83 const std::string& security_origin); | 81 const std::string& security_origin); |
84 | 82 |
85 Response SetColorPickerEnabled(bool enabled); | 83 Response SetColorPickerEnabled(bool enabled); |
86 | 84 |
87 private: | 85 private: |
88 void NotifyScreencastVisibility(bool visible); | 86 void NotifyScreencastVisibility(bool visible); |
89 void InnerSwapCompositorFrame(); | 87 void InnerSwapCompositorFrame(); |
90 void ScreencastFrameCaptured(const cc::CompositorFrameMetadata& metadata, | 88 void ScreencastFrameCaptured(const cc::CompositorFrameMetadata& metadata, |
91 const SkBitmap& bitmap, | 89 const SkBitmap& bitmap, |
92 ReadbackResponse response); | 90 ReadbackResponse response); |
93 void ScreencastFrameEncoded(const cc::CompositorFrameMetadata& metadata, | 91 void ScreencastFrameEncoded(const cc::CompositorFrameMetadata& metadata, |
94 const base::Time& timestamp, | 92 const base::Time& timestamp, |
95 const std::string& data); | 93 const std::string& data); |
96 | 94 |
97 void ScreenshotCaptured( | 95 void ScreenshotCaptured( |
98 DevToolsCommandId command_id, | 96 DevToolsCommandId command_id, |
99 const unsigned char* png_data, | 97 const unsigned char* png_data, |
100 size_t png_size); | 98 size_t png_size); |
101 | 99 |
102 void OnColorPicked(int r, int g, int b, int a); | 100 void OnColorPicked(int r, int g, int b, int a); |
103 void OnFramesRecorded( | |
104 DevToolsCommandId command_id, | |
105 scoped_refptr<StopRecordingFramesResponse> response_data); | |
106 | 101 |
107 bool enabled_; | 102 bool enabled_; |
108 | 103 |
109 bool screencast_enabled_; | 104 bool screencast_enabled_; |
110 std::string screencast_format_; | 105 std::string screencast_format_; |
111 int screencast_quality_; | 106 int screencast_quality_; |
112 int screencast_max_width_; | 107 int screencast_max_width_; |
113 int screencast_max_height_; | 108 int screencast_max_height_; |
114 int capture_retry_count_; | 109 int capture_retry_count_; |
115 bool has_compositor_frame_metadata_; | 110 bool has_compositor_frame_metadata_; |
116 cc::CompositorFrameMetadata next_compositor_frame_metadata_; | 111 cc::CompositorFrameMetadata next_compositor_frame_metadata_; |
117 cc::CompositorFrameMetadata last_compositor_frame_metadata_; | 112 cc::CompositorFrameMetadata last_compositor_frame_metadata_; |
118 int screencast_frame_sent_; | 113 int screencast_frame_sent_; |
119 int screencast_frame_acked_; | 114 int screencast_frame_acked_; |
120 bool processing_screencast_frame_; | 115 bool processing_screencast_frame_; |
121 | 116 |
122 scoped_ptr<ColorPicker> color_picker_; | 117 scoped_ptr<ColorPicker> color_picker_; |
123 scoped_ptr<FrameRecorder> frame_recorder_; | |
124 | 118 |
125 RenderViewHostImpl* host_; | 119 RenderViewHostImpl* host_; |
126 scoped_ptr<Client> client_; | 120 scoped_ptr<Client> client_; |
127 ScreencastListener* screencast_listener_; | 121 ScreencastListener* screencast_listener_; |
128 base::WeakPtrFactory<PageHandler> weak_factory_; | 122 base::WeakPtrFactory<PageHandler> weak_factory_; |
129 | 123 |
130 DISALLOW_COPY_AND_ASSIGN(PageHandler); | 124 DISALLOW_COPY_AND_ASSIGN(PageHandler); |
131 }; | 125 }; |
132 | 126 |
133 } // namespace page | 127 } // namespace page |
134 } // namespace devtools | 128 } // namespace devtools |
135 } // namespace content | 129 } // namespace content |
136 | 130 |
137 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ | 131 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ |
OLD | NEW |