diff options
| -rw-r--r-- | content/browser/web_contents/web_contents_impl.cc | 4 | ||||
| -rw-r--r-- | content/common/frame_messages.h | 13 | ||||
| -rw-r--r-- | content/renderer/render_frame_impl.cc | 20 | ||||
| -rw-r--r-- | content/renderer/render_frame_impl.h | 5 |
4 files changed, 42 insertions, 0 deletions
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 00e524c..cb891ec 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -599,6 +599,10 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, OnRegisterProtocolHandler) IPC_MESSAGE_HANDLER(ViewHostMsg_UnregisterProtocolHandler, OnUnregisterProtocolHandler) + IPC_MESSAGE_HANDLER(FrameHostMsg_RegisterProtocolHandler, + OnRegisterProtocolHandler) + IPC_MESSAGE_HANDLER(FrameHostMsg_UnregisterProtocolHandler, + OnUnregisterProtocolHandler) IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h index 3b271c1..5acb07d 100644 --- a/content/common/frame_messages.h +++ b/content/common/frame_messages.h @@ -973,6 +973,19 @@ IPC_MESSAGE_ROUTED3(FrameHostMsg_TextSurroundingSelectionResponse, size_t, /* startOffset */ size_t /* endOffset */) +// Register a new handler for URL requests with the given scheme. +IPC_MESSAGE_ROUTED4(FrameHostMsg_RegisterProtocolHandler, + std::string /* scheme */, + GURL /* url */, + base::string16 /* title */, + bool /* user_gesture */) + +// Unregister the registered handler for URL requests with the given scheme. +IPC_MESSAGE_ROUTED3(FrameHostMsg_UnregisterProtocolHandler, + std::string /* scheme */, + GURL /* url */, + bool /* user_gesture */) + // PlzNavigate // Tells the browser to perform a navigation. IPC_MESSAGE_ROUTED3(FrameHostMsg_BeginNavigation, diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 95f957f..feb8329 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -3754,6 +3754,26 @@ blink::WebAppBannerClient* RenderFrameImpl::appBannerClient() { return app_banner_client_.get(); } +void RenderFrameImpl::registerProtocolHandler(const WebString& scheme, + const WebURL& url, + const WebString& title) { + bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); + Send(new FrameHostMsg_RegisterProtocolHandler(routing_id_, + base::UTF16ToUTF8(scheme), + url, + title, + user_gesture)); +} + +void RenderFrameImpl::unregisterProtocolHandler(const WebString& scheme, + const WebURL& url) { + bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); + Send(new FrameHostMsg_UnregisterProtocolHandler(routing_id_, + base::UTF16ToUTF8(scheme), + url, + user_gesture)); +} + #if defined(ENABLE_WEBVR) blink::WebVRClient* RenderFrameImpl::webVRClient() { if (!vr_dispatcher_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index d28a53c..5d640a9 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h @@ -540,6 +540,11 @@ class CONTENT_EXPORT RenderFrameImpl virtual bool exitFullscreen(); virtual blink::WebPermissionClient* permissionClient(); virtual blink::WebAppBannerClient* appBannerClient(); + virtual void registerProtocolHandler(const blink::WebString& scheme, + const blink::WebURL& url, + const blink::WebString& title); + virtual void unregisterProtocolHandler(const blink::WebString& scheme, + const blink::WebURL& url); #if defined(ENABLE_WEBVR) blink::WebVRClient* webVRClient() override; |
