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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "cc/output/compositor_frame_metadata.h" | 14 #include "cc/output/compositor_frame_metadata.h" |
15 #include "content/browser/devtools/protocol/devtools_domain_handler.h" | 15 #include "content/browser/devtools/protocol/devtools_domain_handler.h" |
16 #include "content/browser/devtools/protocol/page.h" | 16 #include "content/browser/devtools/protocol/page.h" |
17 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
19 #include "content/public/browser/readback_types.h" | 19 #include "content/public/browser/readback_types.h" |
20 | 20 |
21 class SkBitmap; | 21 class SkBitmap; |
22 | 22 |
23 namespace gfx { | |
24 class Image; | |
25 } // namespace gfx | |
26 | |
27 namespace content { | 23 namespace content { |
28 | 24 |
29 class DevToolsSession; | 25 class DevToolsSession; |
30 class NavigationHandle; | 26 class NavigationHandle; |
31 class PageNavigationThrottle; | 27 class PageNavigationThrottle; |
32 class RenderFrameHostImpl; | 28 class RenderFrameHostImpl; |
33 class WebContentsImpl; | 29 class WebContentsImpl; |
34 | 30 |
35 namespace protocol { | 31 namespace protocol { |
36 | 32 |
(...skipping 25 matching lines...) Expand all Loading... |
62 Response Navigate(const std::string& url, Page::FrameId* frame_id) override; | 58 Response Navigate(const std::string& url, Page::FrameId* frame_id) override; |
63 Response StopLoading() override; | 59 Response StopLoading() override; |
64 | 60 |
65 using NavigationEntries = protocol::Array<Page::NavigationEntry>; | 61 using NavigationEntries = protocol::Array<Page::NavigationEntry>; |
66 Response GetNavigationHistory( | 62 Response GetNavigationHistory( |
67 int* current_index, | 63 int* current_index, |
68 std::unique_ptr<NavigationEntries>* entries) override; | 64 std::unique_ptr<NavigationEntries>* entries) override; |
69 Response NavigateToHistoryEntry(int entry_id) override; | 65 Response NavigateToHistoryEntry(int entry_id) override; |
70 | 66 |
71 void CaptureScreenshot( | 67 void CaptureScreenshot( |
72 Maybe<std::string> format, | |
73 Maybe<int> quality, | |
74 std::unique_ptr<CaptureScreenshotCallback> callback) override; | 68 std::unique_ptr<CaptureScreenshotCallback> callback) override; |
75 Response StartScreencast(Maybe<std::string> format, | 69 Response StartScreencast(Maybe<std::string> format, |
76 Maybe<int> quality, | 70 Maybe<int> quality, |
77 Maybe<int> max_width, | 71 Maybe<int> max_width, |
78 Maybe<int> max_height, | 72 Maybe<int> max_height, |
79 Maybe<int> every_nth_frame) override; | 73 Maybe<int> every_nth_frame) override; |
80 Response StopScreencast() override; | 74 Response StopScreencast() override; |
81 Response ScreencastFrameAck(int session_id) override; | 75 Response ScreencastFrameAck(int session_id) override; |
82 | 76 |
83 Response HandleJavaScriptDialog(bool accept, | 77 Response HandleJavaScriptDialog(bool accept, |
84 Maybe<std::string> prompt_text) override; | 78 Maybe<std::string> prompt_text) override; |
85 | 79 |
86 Response SetColorPickerEnabled(bool enabled) override; | 80 Response SetColorPickerEnabled(bool enabled) override; |
87 Response RequestAppBanner() override; | 81 Response RequestAppBanner() override; |
88 | 82 |
89 Response SetControlNavigations(bool enabled) override; | 83 Response SetControlNavigations(bool enabled) override; |
90 Response ProcessNavigation(const std::string& response, | 84 Response ProcessNavigation(const std::string& response, |
91 int navigation_id) override; | 85 int navigation_id) override; |
92 | 86 |
93 std::unique_ptr<PageNavigationThrottle> CreateThrottleForNavigation( | 87 std::unique_ptr<PageNavigationThrottle> CreateThrottleForNavigation( |
94 NavigationHandle* navigation_handle); | 88 NavigationHandle* navigation_handle); |
95 | 89 |
96 void OnPageNavigationThrottleDisposed(int navigation_id); | 90 void OnPageNavigationThrottleDisposed(int navigation_id); |
97 void NavigationRequested(const PageNavigationThrottle* throttle); | 91 void NavigationRequested(const PageNavigationThrottle* throttle); |
98 | 92 |
99 private: | 93 private: |
100 enum EncodingFormat { PNG, JPEG }; | |
101 | |
102 WebContentsImpl* GetWebContents(); | 94 WebContentsImpl* GetWebContents(); |
103 void NotifyScreencastVisibility(bool visible); | 95 void NotifyScreencastVisibility(bool visible); |
104 void InnerSwapCompositorFrame(); | 96 void InnerSwapCompositorFrame(); |
105 void ScreencastFrameCaptured(cc::CompositorFrameMetadata metadata, | 97 void ScreencastFrameCaptured(cc::CompositorFrameMetadata metadata, |
106 const SkBitmap& bitmap, | 98 const SkBitmap& bitmap, |
107 ReadbackResponse response); | 99 ReadbackResponse response); |
108 void ScreencastFrameEncoded(cc::CompositorFrameMetadata metadata, | 100 void ScreencastFrameEncoded(cc::CompositorFrameMetadata metadata, |
109 const base::Time& timestamp, | 101 const base::Time& timestamp, |
110 const std::string& data); | 102 const std::string& data); |
111 | 103 |
112 void ScreenshotCaptured(std::unique_ptr<CaptureScreenshotCallback> callback, | 104 void ScreenshotCaptured( |
113 const std::string& format, | 105 std::unique_ptr<CaptureScreenshotCallback> callback, |
114 int quality, | 106 const unsigned char* png_data, |
115 const gfx::Image& image); | 107 size_t png_size); |
116 | 108 |
117 void OnColorPicked(int r, int g, int b, int a); | 109 void OnColorPicked(int r, int g, int b, int a); |
118 | 110 |
119 // NotificationObserver overrides. | 111 // NotificationObserver overrides. |
120 void Observe(int type, | 112 void Observe(int type, |
121 const NotificationSource& source, | 113 const NotificationSource& source, |
122 const NotificationDetails& details) override; | 114 const NotificationDetails& details) override; |
123 | 115 |
124 bool enabled_; | 116 bool enabled_; |
125 | 117 |
(...skipping 22 matching lines...) Expand all Loading... |
148 NotificationRegistrar registrar_; | 140 NotificationRegistrar registrar_; |
149 base::WeakPtrFactory<PageHandler> weak_factory_; | 141 base::WeakPtrFactory<PageHandler> weak_factory_; |
150 | 142 |
151 DISALLOW_COPY_AND_ASSIGN(PageHandler); | 143 DISALLOW_COPY_AND_ASSIGN(PageHandler); |
152 }; | 144 }; |
153 | 145 |
154 } // namespace protocol | 146 } // namespace protocol |
155 } // namespace content | 147 } // namespace content |
156 | 148 |
157 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ | 149 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ |
OLD | NEW |