Commit ef392e8b authored by dgozman's avatar dgozman Committed by Commit bot

[DevTools] Implement Inspector.interstitial events.

BUG=404631

Review URL: https://codereview.chromium.org/493213004

Cr-Commit-Position: refs/heads/master@{#291629}
parent 28ba7f5f
......@@ -319,6 +319,8 @@ bool RenderViewDevToolsAgentHost::OnMessageReceived(
}
void RenderViewDevToolsAgentHost::DidAttachInterstitialPage() {
overrides_handler_->DidAttachInterstitialPage();
if (!render_view_host_)
return;
// The rvh set in AboutToNavigateRenderView turned out to be interstitial.
......@@ -331,6 +333,10 @@ void RenderViewDevToolsAgentHost::DidAttachInterstitialPage() {
ConnectRenderViewHost(web_contents->GetRenderViewHost());
}
void RenderViewDevToolsAgentHost::DidDetachInterstitialPage() {
overrides_handler_->DidDetachInterstitialPage();
}
void RenderViewDevToolsAgentHost::Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) {
......
......@@ -70,6 +70,7 @@ class CONTENT_EXPORT RenderViewDevToolsAgentHost
RenderFrameHost* render_frame_host) OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void DidAttachInterstitialPage() OVERRIDE;
virtual void DidDetachInterstitialPage() OVERRIDE;
// NotificationObserver overrides:
virtual void Observe(int type,
......
......@@ -72,7 +72,8 @@ static int kCaptureRetryLimit = 2;
} // namespace
RendererOverridesHandler::RendererOverridesHandler()
: has_last_compositor_frame_metadata_(false),
: page_domain_enabled_(false),
has_last_compositor_frame_metadata_(false),
capture_retry_count_(0),
touch_emulation_enabled_(false),
color_picker_enabled_(false),
......@@ -99,6 +100,10 @@ RendererOverridesHandler::RendererOverridesHandler()
base::Bind(
&RendererOverridesHandler::ClearBrowserCookies,
base::Unretained(this)));
RegisterCommandHandler(
devtools::Page::enable::kName,
base::Bind(
&RendererOverridesHandler::PageEnable, base::Unretained(this)));
RegisterCommandHandler(
devtools::Page::disable::kName,
base::Bind(
......@@ -216,6 +221,16 @@ void RendererOverridesHandler::ClearRenderViewHost() {
ResetColorPickerFrame();
}
void RendererOverridesHandler::DidAttachInterstitialPage() {
if (page_domain_enabled_)
SendNotification(devtools::Page::interstitialShown::kName, NULL);
}
void RendererOverridesHandler::DidDetachInterstitialPage() {
if (page_domain_enabled_)
SendNotification(devtools::Page::interstitialHidden::kName, NULL);
}
void RendererOverridesHandler::InnerSwapCompositorFrame() {
if ((base::TimeTicks::Now() - last_frame_time_).InMilliseconds() <
kFrameRateThresholdMs) {
......@@ -340,10 +355,20 @@ RendererOverridesHandler::ClearBrowserCookies(
// Page agent handlers -------------------------------------------------------
scoped_refptr<DevToolsProtocol::Response>
RendererOverridesHandler::PageEnable(
scoped_refptr<DevToolsProtocol::Command> command) {
page_domain_enabled_ = true;
// Fall through to the renderer.
return NULL;
}
scoped_refptr<DevToolsProtocol::Response>
RendererOverridesHandler::PageDisable(
scoped_refptr<DevToolsProtocol::Command> command) {
page_domain_enabled_ = false;
OnClientDetached();
// Fall through to the renderer.
return NULL;
}
......
......@@ -46,6 +46,8 @@ class CONTENT_EXPORT RendererOverridesHandler
void OnVisibilityChanged(bool visible);
void SetRenderViewHost(RenderViewHostImpl* host);
void ClearRenderViewHost();
void DidAttachInterstitialPage();
void DidDetachInterstitialPage();
private:
void InnerSwapCompositorFrame();
......@@ -64,6 +66,8 @@ class CONTENT_EXPORT RendererOverridesHandler
scoped_refptr<DevToolsProtocol::Command> command);
// Page domain.
scoped_refptr<DevToolsProtocol::Response> PageEnable(
scoped_refptr<DevToolsProtocol::Command> command);
scoped_refptr<DevToolsProtocol::Response> PageDisable(
scoped_refptr<DevToolsProtocol::Command> command);
scoped_refptr<DevToolsProtocol::Response> PageHandleJavaScriptDialog(
......@@ -122,6 +126,7 @@ class CONTENT_EXPORT RendererOverridesHandler
void UpdateTouchEventEmulationState();
RenderViewHostImpl* host_;
bool page_domain_enabled_;
scoped_refptr<DevToolsProtocol::Command> screencast_command_;
bool has_last_compositor_frame_metadata_;
cc::CompositorFrameMetadata last_compositor_frame_metadata_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment