summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravi <avi@chromium.org>2015-07-09 07:18:48 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-09 14:20:20 +0000
commita23e16b2487eb27949a3e0c9eaf2c20385c7346a (patch)
tree75798b332a0ec7b46356e172331ef85d6b9532fa
parente0eb8c846ed729c729eb9db7319ab70fd808a680 (diff)
downloadchromium_src-a23e16b2487eb27949a3e0c9eaf2c20385c7346a.zip
chromium_src-a23e16b2487eb27949a3e0c9eaf2c20385c7346a.tar.gz
chromium_src-a23e16b2487eb27949a3e0c9eaf2c20385c7346a.tar.bz2
Move protocol registration from WebViewClient to WebFrameClient, part 1/3.
BUG=304341 TEST=protocol registration still works Review URL: https://codereview.chromium.org/1228713003 Cr-Commit-Position: refs/heads/master@{#338036}
-rw-r--r--content/browser/web_contents/web_contents_impl.cc4
-rw-r--r--content/common/frame_messages.h13
-rw-r--r--content/renderer/render_frame_impl.cc20
-rw-r--r--content/renderer/render_frame_impl.h5
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;