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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/devtools/protocol/page_handler.h
diff --git a/content/browser/devtools/protocol/page_handler.h b/content/browser/devtools/protocol/page_handler.h
index ce125e6bd59570991cf9b3c9fbaea13bed348ffe..32f80267eb3d92094559c551ead1a7011d8bc636 100644
--- a/content/browser/devtools/protocol/page_handler.h
+++ b/content/browser/devtools/protocol/page_handler.h
@@ -12,7 +12,7 @@
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
#include "cc/output/compositor_frame_metadata.h"
-#include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h"
+#include "content/browser/devtools/protocol/page.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/readback_types.h"
@@ -22,26 +22,22 @@ class SkBitmap;
namespace content {
class NavigationHandle;
+class PageNavigationThrottle;
class RenderFrameHostImpl;
class WebContentsImpl;
-namespace devtools {
-class PageNavigationThrottle;
-
-namespace page {
+namespace protocol {
class ColorPicker;
-class PageHandler : public NotificationObserver {
+class PageHandler : public Page::Backend,
+ public NotificationObserver {
public:
- typedef DevToolsProtocolClient::Response Response;
-
PageHandler();
~PageHandler() override;
+ void Wire(UberDispatcher*);
void SetRenderFrameHost(RenderFrameHostImpl* host);
- void SetClient(std::unique_ptr<Client> client);
- void Detached();
void OnSwapCompositorFrame(cc::CompositorFrameMetadata frame_metadata);
void OnSynchronousSwapCompositorFrame(
cc::CompositorFrameMetadata frame_metadata);
@@ -49,69 +45,39 @@ class PageHandler : public NotificationObserver {
void DidDetachInterstitialPage();
bool screencast_enabled() const { return enabled_ && screencast_enabled_; }
- Response Enable();
- Response Disable();
-
- Response Reload(const bool* bypassCache,
- const std::string* script_to_evaluate_on_load,
- const std::string* script_preprocessor = NULL);
-
- Response Navigate(const std::string& url, FrameId* frame_id);
-
- Response StopLoading();
-
- using NavigationEntries = std::vector<scoped_refptr<NavigationEntry>>;
- Response GetNavigationHistory(int* current_index,
- NavigationEntries* entries);
-
- Response NavigateToHistoryEntry(int entry_id);
-
- Response CaptureScreenshot(DevToolsCommandId command_id);
-
- Response StartScreencast(const std::string* format,
- const int* quality,
- const int* max_width,
- const int* max_height,
- const int* every_nth_frame);
- Response StopScreencast();
- Response ScreencastFrameAck(int session_id);
-
- Response HandleJavaScriptDialog(bool accept, const std::string* prompt_text);
-
- Response QueryUsageAndQuota(DevToolsCommandId command_id,
- const std::string& security_origin);
-
- Response SetColorPickerEnabled(bool enabled);
- Response RequestAppBanner();
-
- Response SetControlNavigations(bool enabled);
- Response ProcessNavigation(const std::string& response, int navigation_id);
-
- Response AddScriptToEvaluateOnLoad(const std::string& source,
- std::string* identifier);
- Response RemoveScriptToEvaluateOnLoad(const std::string& identifier);
- Response SetAutoAttachToCreatedPages(bool auto_attach);
- Response GetResourceTree(scoped_refptr<FrameResourceTree>* tree);
- Response GetResourceContent(DevToolsCommandId command_id,
- const std::string& frame_id,
- const std::string& url);
- Response SearchInResource(DevToolsCommandId command_id,
- const std::string& frame_id,
- const std::string& url,
- const std::string& query,
- bool* case_sensitive,
- bool* is_regex);
- Response SetDocumentContent(const std::string& frame_id,
- const std::string& html);
- Response ConfigureOverlay(const bool* is_suspended,
- const std::string* message);
- Response GetAppManifest(
- std::string* url,
- std::vector<scoped_refptr<AppManifestError>>* errors,
- std::string* data);
- Response GetLayoutMetrics(
- scoped_refptr<LayoutViewport>* layout_viewport,
- scoped_refptr<VisualViewport>* visual_viewport);
+ Response Enable() override;
+ Response Disable() override;
+
+ Response Reload(Maybe<bool> bypassCache,
+ Maybe<std::string> script_to_evaluate_on_load) override;
+ Response Navigate(const std::string& url, Page::FrameId* frame_id) override;
+ Response StopLoading() override;
+
+ using NavigationEntries = protocol::Array<Page::NavigationEntry>;
+ Response GetNavigationHistory(
+ int* current_index,
+ std::unique_ptr<NavigationEntries>* entries) override;
+ Response NavigateToHistoryEntry(int entry_id) override;
+
+ void CaptureScreenshot(
+ std::unique_ptr<CaptureScreenshotCallback> callback) override;
+ Response StartScreencast(Maybe<std::string> format,
+ Maybe<int> quality,
+ Maybe<int> max_width,
+ Maybe<int> max_height,
+ Maybe<int> every_nth_frame) override;
+ Response StopScreencast() override;
+ Response ScreencastFrameAck(int session_id) override;
+
+ Response HandleJavaScriptDialog(bool accept,
+ Maybe<std::string> prompt_text) override;
+
+ Response SetColorPickerEnabled(bool enabled) override;
+ Response RequestAppBanner() override;
+
+ Response SetControlNavigations(bool enabled) override;
+ Response ProcessNavigation(const std::string& response,
+ int navigation_id) override;
std::unique_ptr<PageNavigationThrottle> CreateThrottleForNavigation(
NavigationHandle* navigation_handle);
@@ -131,7 +97,7 @@ class PageHandler : public NotificationObserver {
const std::string& data);
void ScreenshotCaptured(
- DevToolsCommandId command_id,
+ std::unique_ptr<CaptureScreenshotCallback> callback,
const unsigned char* png_data,
size_t png_size);
@@ -165,15 +131,14 @@ class PageHandler : public NotificationObserver {
std::map<int, PageNavigationThrottle*> navigation_throttles_;
RenderFrameHostImpl* host_;
- std::unique_ptr<Client> client_;
+ std::unique_ptr<Page::Frontend> frontend_;
NotificationRegistrar registrar_;
base::WeakPtrFactory<PageHandler> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(PageHandler);
};
-} // namespace page
-} // namespace devtools
+} // namespace protocol
} // namespace content
#endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_
« 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