| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "content/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1962 blink::WebPlugin* RenderFrameImpl::createPlugin( | 1962 blink::WebPlugin* RenderFrameImpl::createPlugin( |
| 1963 blink::WebLocalFrame* frame, | 1963 blink::WebLocalFrame* frame, |
| 1964 const blink::WebPluginParams& params) { | 1964 const blink::WebPluginParams& params) { |
| 1965 DCHECK_EQ(frame_, frame); | 1965 DCHECK_EQ(frame_, frame); |
| 1966 blink::WebPlugin* plugin = NULL; | 1966 blink::WebPlugin* plugin = NULL; |
| 1967 if (GetContentClient()->renderer()->OverrideCreatePlugin( | 1967 if (GetContentClient()->renderer()->OverrideCreatePlugin( |
| 1968 this, frame, params, &plugin)) { | 1968 this, frame, params, &plugin)) { |
| 1969 return plugin; | 1969 return plugin; |
| 1970 } | 1970 } |
| 1971 | 1971 |
| 1972 if (base::UTF16ToUTF8(params.mimeType) == kBrowserPluginMimeType) { | 1972 if (base::UTF16ToUTF8(base::StringPiece16(params.mimeType)) == |
| 1973 kBrowserPluginMimeType) { |
| 1973 return BrowserPluginManager::Get()->CreateBrowserPlugin( | 1974 return BrowserPluginManager::Get()->CreateBrowserPlugin( |
| 1974 this, GetContentClient() | 1975 this, GetContentClient() |
| 1975 ->renderer() | 1976 ->renderer() |
| 1976 ->CreateBrowserPluginDelegate(this, kBrowserPluginMimeType, | 1977 ->CreateBrowserPluginDelegate(this, kBrowserPluginMimeType, |
| 1977 GURL(params.url)) | 1978 GURL(params.url)) |
| 1978 ->GetWeakPtr()); | 1979 ->GetWeakPtr()); |
| 1979 } | 1980 } |
| 1980 | 1981 |
| 1981 #if defined(ENABLE_PLUGINS) | 1982 #if defined(ENABLE_PLUGINS) |
| 1982 WebPluginInfo info; | 1983 WebPluginInfo info; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2137 } | 2138 } |
| 2138 | 2139 |
| 2139 blink::WebFrame* RenderFrameImpl::createChildFrame( | 2140 blink::WebFrame* RenderFrameImpl::createChildFrame( |
| 2140 blink::WebLocalFrame* parent, | 2141 blink::WebLocalFrame* parent, |
| 2141 blink::WebTreeScopeType scope, | 2142 blink::WebTreeScopeType scope, |
| 2142 const blink::WebString& name, | 2143 const blink::WebString& name, |
| 2143 blink::WebSandboxFlags sandbox_flags) { | 2144 blink::WebSandboxFlags sandbox_flags) { |
| 2144 // Synchronously notify the browser of a child frame creation to get the | 2145 // Synchronously notify the browser of a child frame creation to get the |
| 2145 // routing_id for the RenderFrame. | 2146 // routing_id for the RenderFrame. |
| 2146 int child_routing_id = MSG_ROUTING_NONE; | 2147 int child_routing_id = MSG_ROUTING_NONE; |
| 2147 Send(new FrameHostMsg_CreateChildFrame(routing_id_, scope, | 2148 Send(new FrameHostMsg_CreateChildFrame( |
| 2148 base::UTF16ToUTF8(name), sandbox_flags, | 2149 routing_id_, scope, |
| 2149 &child_routing_id)); | 2150 base::UTF16ToUTF8(base::StringPiece16(name)), sandbox_flags, |
| 2151 &child_routing_id)); |
| 2150 | 2152 |
| 2151 // Allocation of routing id failed, so we can't create a child frame. This can | 2153 // Allocation of routing id failed, so we can't create a child frame. This can |
| 2152 // happen if this RenderFrameImpl's IPCs are being filtered when in swapped | 2154 // happen if this RenderFrameImpl's IPCs are being filtered when in swapped |
| 2153 // out state or synchronous IPC message above has failed. | 2155 // out state or synchronous IPC message above has failed. |
| 2154 if (child_routing_id == MSG_ROUTING_NONE) { | 2156 if (child_routing_id == MSG_ROUTING_NONE) { |
| 2155 NOTREACHED() << "Failed to allocate routing id for child frame."; | 2157 NOTREACHED() << "Failed to allocate routing id for child frame."; |
| 2156 return nullptr; | 2158 return nullptr; |
| 2157 } | 2159 } |
| 2158 | 2160 |
| 2159 // Create the RenderFrame and WebLocalFrame, linking the two. | 2161 // Create the RenderFrame and WebLocalFrame, linking the two. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2256 // For now, send these updates only for --site-per-process, which needs to | 2258 // For now, send these updates only for --site-per-process, which needs to |
| 2257 // replicate frame names to frame proxies, and when | 2259 // replicate frame names to frame proxies, and when |
| 2258 // |report_frame_name_changes| is set (used by <webview>). If needed, this | 2260 // |report_frame_name_changes| is set (used by <webview>). If needed, this |
| 2259 // can be optimized further by only sending the update if there are any | 2261 // can be optimized further by only sending the update if there are any |
| 2260 // remote frames in the frame tree, or delaying and batching up IPCs if | 2262 // remote frames in the frame tree, or delaying and batching up IPCs if |
| 2261 // updates are happening too frequently. | 2263 // updates are happening too frequently. |
| 2262 bool is_site_per_process = base::CommandLine::ForCurrentProcess()->HasSwitch( | 2264 bool is_site_per_process = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2263 switches::kSitePerProcess); | 2265 switches::kSitePerProcess); |
| 2264 if (is_site_per_process || | 2266 if (is_site_per_process || |
| 2265 render_view_->renderer_preferences_.report_frame_name_changes) { | 2267 render_view_->renderer_preferences_.report_frame_name_changes) { |
| 2266 Send(new FrameHostMsg_DidChangeName(routing_id_, base::UTF16ToUTF8(name))); | 2268 Send(new FrameHostMsg_DidChangeName( |
| 2269 routing_id_, base::UTF16ToUTF8(base::StringPiece16(name)))); |
| 2267 } | 2270 } |
| 2268 } | 2271 } |
| 2269 | 2272 |
| 2270 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame, | 2273 void RenderFrameImpl::didChangeSandboxFlags(blink::WebFrame* child_frame, |
| 2271 blink::WebSandboxFlags flags) { | 2274 blink::WebSandboxFlags flags) { |
| 2272 int frame_routing_id = MSG_ROUTING_NONE; | 2275 int frame_routing_id = MSG_ROUTING_NONE; |
| 2273 if (child_frame->isWebRemoteFrame()) { | 2276 if (child_frame->isWebRemoteFrame()) { |
| 2274 frame_routing_id = | 2277 frame_routing_id = |
| 2275 RenderFrameProxy::FromWebFrame(child_frame)->routing_id(); | 2278 RenderFrameProxy::FromWebFrame(child_frame)->routing_id(); |
| 2276 } else { | 2279 } else { |
| (...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3770 GetContentClient()->renderer()->CreateAppBannerClient(this); | 3773 GetContentClient()->renderer()->CreateAppBannerClient(this); |
| 3771 } | 3774 } |
| 3772 | 3775 |
| 3773 return app_banner_client_.get(); | 3776 return app_banner_client_.get(); |
| 3774 } | 3777 } |
| 3775 | 3778 |
| 3776 void RenderFrameImpl::registerProtocolHandler(const WebString& scheme, | 3779 void RenderFrameImpl::registerProtocolHandler(const WebString& scheme, |
| 3777 const WebURL& url, | 3780 const WebURL& url, |
| 3778 const WebString& title) { | 3781 const WebString& title) { |
| 3779 bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); | 3782 bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); |
| 3780 Send(new FrameHostMsg_RegisterProtocolHandler(routing_id_, | 3783 Send(new FrameHostMsg_RegisterProtocolHandler( |
| 3781 base::UTF16ToUTF8(scheme), | 3784 routing_id_, |
| 3782 url, | 3785 base::UTF16ToUTF8(base::StringPiece16(scheme)), |
| 3783 title, | 3786 url, |
| 3784 user_gesture)); | 3787 title, |
| 3788 user_gesture)); |
| 3785 } | 3789 } |
| 3786 | 3790 |
| 3787 void RenderFrameImpl::unregisterProtocolHandler(const WebString& scheme, | 3791 void RenderFrameImpl::unregisterProtocolHandler(const WebString& scheme, |
| 3788 const WebURL& url) { | 3792 const WebURL& url) { |
| 3789 bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); | 3793 bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture(); |
| 3790 Send(new FrameHostMsg_UnregisterProtocolHandler(routing_id_, | 3794 Send(new FrameHostMsg_UnregisterProtocolHandler( |
| 3791 base::UTF16ToUTF8(scheme), | 3795 routing_id_, |
| 3792 url, | 3796 base::UTF16ToUTF8(base::StringPiece16(scheme)), |
| 3793 user_gesture)); | 3797 url, |
| 3798 user_gesture)); |
| 3794 } | 3799 } |
| 3795 | 3800 |
| 3796 blink::WebBluetooth* RenderFrameImpl::bluetooth() { | 3801 blink::WebBluetooth* RenderFrameImpl::bluetooth() { |
| 3797 if (!bluetooth_) { | 3802 if (!bluetooth_) { |
| 3798 bluetooth_.reset(new WebBluetoothImpl( | 3803 bluetooth_.reset(new WebBluetoothImpl( |
| 3799 ChildThreadImpl::current()->thread_safe_sender(), routing_id_)); | 3804 ChildThreadImpl::current()->thread_safe_sender(), routing_id_)); |
| 3800 } | 3805 } |
| 3801 | 3806 |
| 3802 return bluetooth_.get(); | 3807 return bluetooth_.get(); |
| 3803 } | 3808 } |
| (...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5044 void RenderFrameImpl::RegisterMojoServices() { | 5049 void RenderFrameImpl::RegisterMojoServices() { |
| 5045 // Only main frame have ImageDownloader service. | 5050 // Only main frame have ImageDownloader service. |
| 5046 if (!frame_->parent()) { | 5051 if (!frame_->parent()) { |
| 5047 GetServiceRegistry()->AddService<image_downloader::ImageDownloader>( | 5052 GetServiceRegistry()->AddService<image_downloader::ImageDownloader>( |
| 5048 base::Bind(&ImageDownloaderImpl::CreateMojoService, | 5053 base::Bind(&ImageDownloaderImpl::CreateMojoService, |
| 5049 base::Unretained(this))); | 5054 base::Unretained(this))); |
| 5050 } | 5055 } |
| 5051 } | 5056 } |
| 5052 | 5057 |
| 5053 } // namespace content | 5058 } // namespace content |
| OLD | NEW |