Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: content/browser/devtools/protocol/page_handler.h

Issue 2548263002: [DevTools] Migrate dom, emulation, inspector, network, page and schema handlers to new generator. (Closed)
Patch Set: rebased atop of roll Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/page.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 NavigationHandle;
25 class PageNavigationThrottle;
25 class RenderFrameHostImpl; 26 class RenderFrameHostImpl;
26 class WebContentsImpl; 27 class WebContentsImpl;
27 28
28 namespace devtools { 29 namespace protocol {
29 class PageNavigationThrottle;
30
31 namespace page {
32 30
33 class ColorPicker; 31 class ColorPicker;
34 32
35 class PageHandler : public NotificationObserver { 33 class PageHandler : public Page::Backend,
34 public NotificationObserver {
36 public: 35 public:
37 typedef DevToolsProtocolClient::Response Response;
38
39 PageHandler(); 36 PageHandler();
40 ~PageHandler() override; 37 ~PageHandler() override;
41 38
39 void Wire(UberDispatcher*);
42 void SetRenderFrameHost(RenderFrameHostImpl* host); 40 void SetRenderFrameHost(RenderFrameHostImpl* host);
43 void SetClient(std::unique_ptr<Client> client);
44 void Detached();
45 void OnSwapCompositorFrame(cc::CompositorFrameMetadata frame_metadata); 41 void OnSwapCompositorFrame(cc::CompositorFrameMetadata frame_metadata);
46 void OnSynchronousSwapCompositorFrame( 42 void OnSynchronousSwapCompositorFrame(
47 cc::CompositorFrameMetadata frame_metadata); 43 cc::CompositorFrameMetadata frame_metadata);
48 void DidAttachInterstitialPage(); 44 void DidAttachInterstitialPage();
49 void DidDetachInterstitialPage(); 45 void DidDetachInterstitialPage();
50 bool screencast_enabled() const { return enabled_ && screencast_enabled_; } 46 bool screencast_enabled() const { return enabled_ && screencast_enabled_; }
51 47
52 Response Enable(); 48 Response Enable() override;
53 Response Disable(); 49 Response Disable() override;
54 50
55 Response Reload(const bool* bypassCache, 51 Response Reload(Maybe<bool> bypassCache,
56 const std::string* script_to_evaluate_on_load, 52 Maybe<std::string> script_to_evaluate_on_load) override;
57 const std::string* script_preprocessor = NULL); 53 Response Navigate(const std::string& url, Page::FrameId* frame_id) override;
54 Response StopLoading() override;
58 55
59 Response Navigate(const std::string& url, FrameId* frame_id); 56 using NavigationEntries = protocol::Array<Page::NavigationEntry>;
57 Response GetNavigationHistory(
58 int* current_index,
59 std::unique_ptr<NavigationEntries>* entries) override;
60 Response NavigateToHistoryEntry(int entry_id) override;
60 61
61 Response StopLoading(); 62 void CaptureScreenshot(
63 std::unique_ptr<CaptureScreenshotCallback> callback) override;
64 Response StartScreencast(Maybe<std::string> format,
65 Maybe<int> quality,
66 Maybe<int> max_width,
67 Maybe<int> max_height,
68 Maybe<int> every_nth_frame) override;
69 Response StopScreencast() override;
70 Response ScreencastFrameAck(int session_id) override;
62 71
63 using NavigationEntries = std::vector<scoped_refptr<NavigationEntry>>; 72 Response HandleJavaScriptDialog(bool accept,
64 Response GetNavigationHistory(int* current_index, 73 Maybe<std::string> prompt_text) override;
65 NavigationEntries* entries);
66 74
67 Response NavigateToHistoryEntry(int entry_id); 75 Response SetColorPickerEnabled(bool enabled) override;
76 Response RequestAppBanner() override;
68 77
69 Response CaptureScreenshot(DevToolsCommandId command_id); 78 Response SetControlNavigations(bool enabled) override;
70 79 Response ProcessNavigation(const std::string& response,
71 Response StartScreencast(const std::string* format, 80 int navigation_id) override;
72 const int* quality,
73 const int* max_width,
74 const int* max_height,
75 const int* every_nth_frame);
76 Response StopScreencast();
77 Response ScreencastFrameAck(int session_id);
78
79 Response HandleJavaScriptDialog(bool accept, const std::string* prompt_text);
80
81 Response QueryUsageAndQuota(DevToolsCommandId command_id,
82 const std::string& security_origin);
83
84 Response SetColorPickerEnabled(bool enabled);
85 Response RequestAppBanner();
86
87 Response SetControlNavigations(bool enabled);
88 Response ProcessNavigation(const std::string& response, int navigation_id);
89
90 Response AddScriptToEvaluateOnLoad(const std::string& source,
91 std::string* identifier);
92 Response RemoveScriptToEvaluateOnLoad(const std::string& identifier);
93 Response SetAutoAttachToCreatedPages(bool auto_attach);
94 Response GetResourceTree(scoped_refptr<FrameResourceTree>* tree);
95 Response GetResourceContent(DevToolsCommandId command_id,
96 const std::string& frame_id,
97 const std::string& url);
98 Response SearchInResource(DevToolsCommandId command_id,
99 const std::string& frame_id,
100 const std::string& url,
101 const std::string& query,
102 bool* case_sensitive,
103 bool* is_regex);
104 Response SetDocumentContent(const std::string& frame_id,
105 const std::string& html);
106 Response ConfigureOverlay(const bool* is_suspended,
107 const std::string* message);
108 Response GetAppManifest(
109 std::string* url,
110 std::vector<scoped_refptr<AppManifestError>>* errors,
111 std::string* data);
112 Response GetLayoutMetrics(
113 scoped_refptr<LayoutViewport>* layout_viewport,
114 scoped_refptr<VisualViewport>* visual_viewport);
115 81
116 std::unique_ptr<PageNavigationThrottle> CreateThrottleForNavigation( 82 std::unique_ptr<PageNavigationThrottle> CreateThrottleForNavigation(
117 NavigationHandle* navigation_handle); 83 NavigationHandle* navigation_handle);
118 84
119 void OnPageNavigationThrottleDisposed(int navigation_id); 85 void OnPageNavigationThrottleDisposed(int navigation_id);
120 void NavigationRequested(const PageNavigationThrottle* throttle); 86 void NavigationRequested(const PageNavigationThrottle* throttle);
121 87
122 private: 88 private:
123 WebContentsImpl* GetWebContents(); 89 WebContentsImpl* GetWebContents();
124 void NotifyScreencastVisibility(bool visible); 90 void NotifyScreencastVisibility(bool visible);
125 void InnerSwapCompositorFrame(); 91 void InnerSwapCompositorFrame();
126 void ScreencastFrameCaptured(cc::CompositorFrameMetadata metadata, 92 void ScreencastFrameCaptured(cc::CompositorFrameMetadata metadata,
127 const SkBitmap& bitmap, 93 const SkBitmap& bitmap,
128 ReadbackResponse response); 94 ReadbackResponse response);
129 void ScreencastFrameEncoded(cc::CompositorFrameMetadata metadata, 95 void ScreencastFrameEncoded(cc::CompositorFrameMetadata metadata,
130 const base::Time& timestamp, 96 const base::Time& timestamp,
131 const std::string& data); 97 const std::string& data);
132 98
133 void ScreenshotCaptured( 99 void ScreenshotCaptured(
134 DevToolsCommandId command_id, 100 std::unique_ptr<CaptureScreenshotCallback> callback,
135 const unsigned char* png_data, 101 const unsigned char* png_data,
136 size_t png_size); 102 size_t png_size);
137 103
138 void OnColorPicked(int r, int g, int b, int a); 104 void OnColorPicked(int r, int g, int b, int a);
139 105
140 // NotificationObserver overrides. 106 // NotificationObserver overrides.
141 void Observe(int type, 107 void Observe(int type,
142 const NotificationSource& source, 108 const NotificationSource& source,
143 const NotificationDetails& details) override; 109 const NotificationDetails& details) override;
144 110
(...skipping 13 matching lines...) Expand all
158 int frame_counter_; 124 int frame_counter_;
159 int frames_in_flight_; 125 int frames_in_flight_;
160 126
161 std::unique_ptr<ColorPicker> color_picker_; 127 std::unique_ptr<ColorPicker> color_picker_;
162 128
163 bool navigation_throttle_enabled_; 129 bool navigation_throttle_enabled_;
164 int next_navigation_id_; 130 int next_navigation_id_;
165 std::map<int, PageNavigationThrottle*> navigation_throttles_; 131 std::map<int, PageNavigationThrottle*> navigation_throttles_;
166 132
167 RenderFrameHostImpl* host_; 133 RenderFrameHostImpl* host_;
168 std::unique_ptr<Client> client_; 134 std::unique_ptr<Page::Frontend> frontend_;
169 NotificationRegistrar registrar_; 135 NotificationRegistrar registrar_;
170 base::WeakPtrFactory<PageHandler> weak_factory_; 136 base::WeakPtrFactory<PageHandler> weak_factory_;
171 137
172 DISALLOW_COPY_AND_ASSIGN(PageHandler); 138 DISALLOW_COPY_AND_ASSIGN(PageHandler);
173 }; 139 };
174 140
175 } // namespace page 141 } // namespace protocol
176 } // namespace devtools
177 } // namespace content 142 } // namespace content
178 143
179 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ 144 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_
OLDNEW
« no previous file with comments | « content/browser/devtools/protocol/network_handler.cc ('k') | content/browser/devtools/protocol/page_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698