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_protocol_dispatcher.h" | 15 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" |
16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
18 #include "content/public/browser/readback_types.h" | 18 #include "content/public/browser/readback_types.h" |
19 | 19 |
20 class SkBitmap; | 20 class SkBitmap; |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
| 24 class NavigationHandle; |
24 class RenderFrameHostImpl; | 25 class RenderFrameHostImpl; |
25 class WebContentsImpl; | 26 class WebContentsImpl; |
26 | 27 |
27 namespace devtools { | 28 namespace devtools { |
| 29 class PageNavigationThrottle; |
| 30 |
28 namespace page { | 31 namespace page { |
29 | 32 |
30 class ColorPicker; | 33 class ColorPicker; |
31 | 34 |
32 class PageHandler : public NotificationObserver { | 35 class PageHandler : public NotificationObserver { |
33 public: | 36 public: |
34 typedef DevToolsProtocolClient::Response Response; | 37 typedef DevToolsProtocolClient::Response Response; |
35 | 38 |
36 PageHandler(); | 39 PageHandler(); |
37 ~PageHandler() override; | 40 ~PageHandler() override; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 Response ScreencastFrameAck(int session_id); | 75 Response ScreencastFrameAck(int session_id); |
73 | 76 |
74 Response HandleJavaScriptDialog(bool accept, const std::string* prompt_text); | 77 Response HandleJavaScriptDialog(bool accept, const std::string* prompt_text); |
75 | 78 |
76 Response QueryUsageAndQuota(DevToolsCommandId command_id, | 79 Response QueryUsageAndQuota(DevToolsCommandId command_id, |
77 const std::string& security_origin); | 80 const std::string& security_origin); |
78 | 81 |
79 Response SetColorPickerEnabled(bool enabled); | 82 Response SetColorPickerEnabled(bool enabled); |
80 Response RequestAppBanner(); | 83 Response RequestAppBanner(); |
81 | 84 |
| 85 Response SetNavigationThrottleEnabled(bool enabled); |
| 86 Response ProcessNavigation(const std::string& response, int navigation_id); |
| 87 |
| 88 std::unique_ptr<PageNavigationThrottle> GetThrottleForNavigation( |
| 89 NavigationHandle* navigation_handle); |
| 90 |
| 91 void OnPageNavigationThrottleDisposed(int navigation_id); |
| 92 void NavigationRequested(const PageNavigationThrottle* throttle); |
| 93 void RedirectRequested(const PageNavigationThrottle* throttle); |
| 94 |
82 private: | 95 private: |
83 WebContentsImpl* GetWebContents(); | 96 WebContentsImpl* GetWebContents(); |
84 void NotifyScreencastVisibility(bool visible); | 97 void NotifyScreencastVisibility(bool visible); |
85 void InnerSwapCompositorFrame(); | 98 void InnerSwapCompositorFrame(); |
86 void ScreencastFrameCaptured(cc::CompositorFrameMetadata metadata, | 99 void ScreencastFrameCaptured(cc::CompositorFrameMetadata metadata, |
87 const SkBitmap& bitmap, | 100 const SkBitmap& bitmap, |
88 ReadbackResponse response); | 101 ReadbackResponse response); |
89 void ScreencastFrameEncoded(cc::CompositorFrameMetadata metadata, | 102 void ScreencastFrameEncoded(cc::CompositorFrameMetadata metadata, |
90 const base::Time& timestamp, | 103 const base::Time& timestamp, |
91 const std::string& data); | 104 const std::string& data); |
(...skipping 21 matching lines...) Expand all Loading... |
113 int capture_retry_count_; | 126 int capture_retry_count_; |
114 bool has_compositor_frame_metadata_; | 127 bool has_compositor_frame_metadata_; |
115 cc::CompositorFrameMetadata next_compositor_frame_metadata_; | 128 cc::CompositorFrameMetadata next_compositor_frame_metadata_; |
116 cc::CompositorFrameMetadata last_compositor_frame_metadata_; | 129 cc::CompositorFrameMetadata last_compositor_frame_metadata_; |
117 int session_id_; | 130 int session_id_; |
118 int frame_counter_; | 131 int frame_counter_; |
119 int frames_in_flight_; | 132 int frames_in_flight_; |
120 | 133 |
121 std::unique_ptr<ColorPicker> color_picker_; | 134 std::unique_ptr<ColorPicker> color_picker_; |
122 | 135 |
| 136 bool navigation_throttle_enabled_; |
| 137 int next_navigation_id_; |
| 138 std::map<int, PageNavigationThrottle*> navigation_throttles_; |
| 139 |
123 RenderFrameHostImpl* host_; | 140 RenderFrameHostImpl* host_; |
124 std::unique_ptr<Client> client_; | 141 std::unique_ptr<Client> client_; |
125 NotificationRegistrar registrar_; | 142 NotificationRegistrar registrar_; |
126 base::WeakPtrFactory<PageHandler> weak_factory_; | 143 base::WeakPtrFactory<PageHandler> weak_factory_; |
127 | 144 |
128 DISALLOW_COPY_AND_ASSIGN(PageHandler); | 145 DISALLOW_COPY_AND_ASSIGN(PageHandler); |
129 }; | 146 }; |
130 | 147 |
131 } // namespace page | 148 } // namespace page |
132 } // namespace devtools | 149 } // namespace devtools |
133 } // namespace content | 150 } // namespace content |
134 | 151 |
135 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ | 152 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ |
OLD | NEW |