| 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 "base/command_line.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 9 #include "content/child/appcache/appcache_dispatcher.h" | 10 #include "content/child/appcache/appcache_dispatcher.h" |
| 10 #include "content/child/quota_dispatcher.h" | 11 #include "content/child/quota_dispatcher.h" |
| 11 #include "content/child/request_extra_data.h" | 12 #include "content/child/request_extra_data.h" |
| 12 #include "content/common/socket_stream_handle_data.h" | 13 #include "content/common/socket_stream_handle_data.h" |
| 14 #include "content/common/swapped_out_messages.h" |
| 13 #include "content/common/view_messages.h" | 15 #include "content/common/view_messages.h" |
| 14 #include "content/public/common/content_constants.h" | 16 #include "content/public/common/content_constants.h" |
| 17 #include "content/public/common/content_switches.h" |
| 15 #include "content/public/common/url_constants.h" | 18 #include "content/public/common/url_constants.h" |
| 16 #include "content/public/renderer/content_renderer_client.h" | 19 #include "content/public/renderer/content_renderer_client.h" |
| 17 #include "content/public/renderer/document_state.h" | 20 #include "content/public/renderer/document_state.h" |
| 18 #include "content/public/renderer/navigation_state.h" | 21 #include "content/public/renderer/navigation_state.h" |
| 19 #include "content/public/renderer/password_form_conversion_utils.h" | 22 #include "content/public/renderer/password_form_conversion_utils.h" |
| 20 #include "content/renderer/browser_plugin/browser_plugin.h" | 23 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 21 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 24 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
| 22 #include "content/renderer/internal_document_state_data.h" | 25 #include "content/renderer/internal_document_state_data.h" |
| 23 #include "content/renderer/media/rtc_peer_connection_handler.h" | 26 #include "content/renderer/media/rtc_peer_connection_handler.h" |
| 24 #include "content/renderer/render_thread_impl.h" | 27 #include "content/renderer/render_thread_impl.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // static | 90 // static |
| 88 void RenderFrameImpl::InstallCreateHook( | 91 void RenderFrameImpl::InstallCreateHook( |
| 89 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)) { | 92 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)) { |
| 90 CHECK(!g_create_render_frame_impl); | 93 CHECK(!g_create_render_frame_impl); |
| 91 g_create_render_frame_impl = create_render_frame_impl; | 94 g_create_render_frame_impl = create_render_frame_impl; |
| 92 } | 95 } |
| 93 | 96 |
| 94 // RenderFrameImpl ---------------------------------------------------------- | 97 // RenderFrameImpl ---------------------------------------------------------- |
| 95 RenderFrameImpl::RenderFrameImpl(RenderViewImpl* render_view, int routing_id) | 98 RenderFrameImpl::RenderFrameImpl(RenderViewImpl* render_view, int routing_id) |
| 96 : render_view_(render_view), | 99 : render_view_(render_view), |
| 97 routing_id_(routing_id) { | 100 routing_id_(routing_id), |
| 101 is_swapped_out_(false), |
| 102 is_detaching_(false) { |
| 98 } | 103 } |
| 99 | 104 |
| 100 RenderFrameImpl::~RenderFrameImpl() { | 105 RenderFrameImpl::~RenderFrameImpl() { |
| 101 } | 106 } |
| 102 | 107 |
| 103 int RenderFrameImpl::GetRoutingID() const { | 108 int RenderFrameImpl::GetRoutingID() const { |
| 104 // TODO(nasko): Until we register RenderFrameHost in the browser process as | 109 return routing_id_; |
| 105 // a listener, we must route all messages to the RenderViewHost, so use the | |
| 106 // routing id of the RenderView for now. | |
| 107 return render_view_->GetRoutingID(); | |
| 108 } | 110 } |
| 109 | 111 |
| 110 bool RenderFrameImpl::Send(IPC::Message* message) { | 112 bool RenderFrameImpl::Send(IPC::Message* message) { |
| 111 // TODO(nasko): Move away from using the RenderView's Send method once we | 113 if (is_detaching_ || |
| 112 // have enough infrastructure and state to make the right checks here. | 114 (is_swapped_out_ && |
| 113 return render_view_->Send(message); | 115 !SwappedOutMessages::CanSendWhileSwappedOut(message))) { |
| 116 delete message; |
| 117 return false; |
| 118 } |
| 119 |
| 120 if (message->routing_id() == MSG_ROUTING_NONE) |
| 121 message->set_routing_id(routing_id_); |
| 122 |
| 123 return RenderThread::Get()->Send(message); |
| 114 } | 124 } |
| 115 | 125 |
| 116 bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) { | 126 bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) { |
| 117 // Pass the message up to the RenderView, until we have enough | 127 // TODO(ajwong): Fill in with message handlers as various components |
| 118 // infrastructure to start processing messages in this object. | 128 // are migrated over to understand frames. |
| 119 return render_view_->OnMessageReceived(msg); | 129 return false; |
| 120 } | 130 } |
| 121 | 131 |
| 122 // WebKit::WebFrameClient implementation ------------------------------------- | 132 // WebKit::WebFrameClient implementation ------------------------------------- |
| 123 | 133 |
| 124 WebKit::WebPlugin* RenderFrameImpl::createPlugin( | 134 WebKit::WebPlugin* RenderFrameImpl::createPlugin( |
| 125 WebKit::WebFrame* frame, | 135 WebKit::WebFrame* frame, |
| 126 const WebKit::WebPluginParams& params) { | 136 const WebKit::WebPluginParams& params) { |
| 127 WebKit::WebPlugin* plugin = NULL; | 137 WebKit::WebPlugin* plugin = NULL; |
| 128 if (GetContentClient()->renderer()->OverrideCreatePlugin( | 138 if (GetContentClient()->renderer()->OverrideCreatePlugin( |
| 129 render_view_, frame, params, &plugin)) { | 139 render_view_, frame, params, &plugin)) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 157 const WebKit::WebURL& url, | 167 const WebKit::WebURL& url, |
| 158 const WebKit::WebString& name, | 168 const WebKit::WebString& name, |
| 159 unsigned long long document_id) { | 169 unsigned long long document_id) { |
| 160 int route_id = MSG_ROUTING_NONE; | 170 int route_id = MSG_ROUTING_NONE; |
| 161 bool exists = false; | 171 bool exists = false; |
| 162 bool url_mismatch = false; | 172 bool url_mismatch = false; |
| 163 ViewHostMsg_CreateWorker_Params params; | 173 ViewHostMsg_CreateWorker_Params params; |
| 164 params.url = url; | 174 params.url = url; |
| 165 params.name = name; | 175 params.name = name; |
| 166 params.document_id = document_id; | 176 params.document_id = document_id; |
| 167 params.render_view_route_id = GetRoutingID(); | 177 params.render_view_route_id = render_view_->GetRoutingID(); |
| 168 params.route_id = MSG_ROUTING_NONE; | 178 params.route_id = MSG_ROUTING_NONE; |
| 169 params.script_resource_appcache_id = 0; | 179 params.script_resource_appcache_id = 0; |
| 170 Send(new ViewHostMsg_LookupSharedWorker( | 180 render_view_->Send(new ViewHostMsg_LookupSharedWorker( |
| 171 params, &exists, &route_id, &url_mismatch)); | 181 params, &exists, &route_id, &url_mismatch)); |
| 172 if (url_mismatch) { | 182 if (url_mismatch) { |
| 173 return NULL; | 183 return NULL; |
| 174 } else { | 184 } else { |
| 175 return new WebSharedWorkerProxy(RenderThreadImpl::current(), | 185 return new WebSharedWorkerProxy(RenderThreadImpl::current(), |
| 176 document_id, | 186 document_id, |
| 177 exists, | 187 exists, |
| 178 route_id, | 188 route_id, |
| 179 GetRoutingID()); | 189 render_view_->GetRoutingID()); |
| 180 } | 190 } |
| 181 } | 191 } |
| 182 | 192 |
| 183 WebKit::WebMediaPlayer* RenderFrameImpl::createMediaPlayer( | 193 WebKit::WebMediaPlayer* RenderFrameImpl::createMediaPlayer( |
| 184 WebKit::WebFrame* frame, | 194 WebKit::WebFrame* frame, |
| 185 const WebKit::WebURL& url, | 195 const WebKit::WebURL& url, |
| 186 WebKit::WebMediaPlayerClient* client) { | 196 WebKit::WebMediaPlayerClient* client) { |
| 187 // TODO(nasko): Moving the implementation here involves moving a few media | 197 // TODO(nasko): Moving the implementation here involves moving a few media |
| 188 // related client objects here or referencing them in the RenderView. Needs | 198 // related client objects here or referencing them in the RenderView. Needs |
| 189 // more work to understand where the proper place for those objects is. | 199 // more work to understand where the proper place for those objects is. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 203 WebKit::WebCookieJar* RenderFrameImpl::cookieJar(WebKit::WebFrame* frame) { | 213 WebKit::WebCookieJar* RenderFrameImpl::cookieJar(WebKit::WebFrame* frame) { |
| 204 return render_view_->cookieJar(frame); | 214 return render_view_->cookieJar(frame); |
| 205 } | 215 } |
| 206 | 216 |
| 207 void RenderFrameImpl::didAccessInitialDocument(WebKit::WebFrame* frame) { | 217 void RenderFrameImpl::didAccessInitialDocument(WebKit::WebFrame* frame) { |
| 208 render_view_->didAccessInitialDocument(frame); | 218 render_view_->didAccessInitialDocument(frame); |
| 209 } | 219 } |
| 210 | 220 |
| 211 void RenderFrameImpl::didCreateFrame(WebKit::WebFrame* parent, | 221 void RenderFrameImpl::didCreateFrame(WebKit::WebFrame* parent, |
| 212 WebKit::WebFrame* child) { | 222 WebKit::WebFrame* child) { |
| 213 Send(new ViewHostMsg_FrameAttached(GetRoutingID(), parent->identifier(), | 223 render_view_->Send( |
| 224 new ViewHostMsg_FrameAttached(render_view_->GetRoutingID(), |
| 225 parent->identifier(), |
| 214 child->identifier(), UTF16ToUTF8(child->assignedName()))); | 226 child->identifier(), UTF16ToUTF8(child->assignedName()))); |
| 215 } | 227 } |
| 216 | 228 |
| 217 void RenderFrameImpl::didDisownOpener(WebKit::WebFrame* frame) { | 229 void RenderFrameImpl::didDisownOpener(WebKit::WebFrame* frame) { |
| 218 render_view_->didDisownOpener(frame); | 230 render_view_->didDisownOpener(frame); |
| 219 } | 231 } |
| 220 | 232 |
| 221 void RenderFrameImpl::frameDetached(WebKit::WebFrame* frame) { | 233 void RenderFrameImpl::frameDetached(WebKit::WebFrame* frame) { |
| 234 // Currently multiple WebCore::Frames can send frameDetached to a single |
| 235 // RenderFrameImpl. This is legacy behavior from when RenderViewImpl served |
| 236 // as a shared WebFrameClient for multiple Webcore::Frame objects. It also |
| 237 // prevents this class from entering the |is_detaching_| state because |
| 238 // even though one WebCore::Frame may have detached itself, others will |
| 239 // still need to use this object. |
| 240 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess)) { |
| 241 // TODO(ajwong): Add CHECK(!is_detaching_) once we guarantee each |
| 242 // RenderFrameImpl is only used by one WebCore::Frame. |
| 243 is_detaching_ = true; |
| 244 } |
| 245 |
| 222 int64 parent_frame_id = -1; | 246 int64 parent_frame_id = -1; |
| 223 if (frame->parent()) | 247 if (frame->parent()) |
| 224 parent_frame_id = frame->parent()->identifier(); | 248 parent_frame_id = frame->parent()->identifier(); |
| 225 | 249 |
| 226 Send(new ViewHostMsg_FrameDetached(GetRoutingID(), parent_frame_id, | 250 render_view_->Send(new ViewHostMsg_FrameDetached(render_view_->GetRoutingID(), |
| 227 frame->identifier())); | 251 parent_frame_id, |
| 252 frame->identifier())); |
| 228 | 253 |
| 229 // Call back to RenderViewImpl for observers to be notified. | 254 // Call back to RenderViewImpl for observers to be notified. |
| 230 // TODO(nasko): Remove once we have RenderFrameObserver. | 255 // TODO(nasko): Remove once we have RenderFrameObserver. |
| 231 render_view_->frameDetached(frame); | 256 render_view_->frameDetached(frame); |
| 232 } | 257 } |
| 233 | 258 |
| 234 void RenderFrameImpl::willClose(WebKit::WebFrame* frame) { | 259 void RenderFrameImpl::willClose(WebKit::WebFrame* frame) { |
| 235 // Call back to RenderViewImpl for observers to be notified. | 260 // Call back to RenderViewImpl for observers to be notified. |
| 236 // TODO(nasko): Remove once we have RenderFrameObserver. | 261 // TODO(nasko): Remove once we have RenderFrameObserver. |
| 237 render_view_->willClose(frame); | 262 render_view_->willClose(frame); |
| 238 } | 263 } |
| 239 | 264 |
| 240 void RenderFrameImpl::didChangeName(WebKit::WebFrame* frame, | 265 void RenderFrameImpl::didChangeName(WebKit::WebFrame* frame, |
| 241 const WebKit::WebString& name) { | 266 const WebKit::WebString& name) { |
| 242 if (!render_view_->renderer_preferences_.report_frame_name_changes) | 267 if (!render_view_->renderer_preferences_.report_frame_name_changes) |
| 243 return; | 268 return; |
| 244 | 269 |
| 245 Send(new ViewHostMsg_UpdateFrameName(GetRoutingID(), | 270 render_view_->Send( |
| 246 frame->identifier(), | 271 new ViewHostMsg_UpdateFrameName(render_view_->GetRoutingID(), |
| 247 !frame->parent(), | 272 frame->identifier(), |
| 248 UTF16ToUTF8(name))); | 273 !frame->parent(), |
| 274 UTF16ToUTF8(name))); |
| 249 } | 275 } |
| 250 | 276 |
| 251 void RenderFrameImpl::loadURLExternally(WebKit::WebFrame* frame, | 277 void RenderFrameImpl::loadURLExternally(WebKit::WebFrame* frame, |
| 252 const WebKit::WebURLRequest& request, | 278 const WebKit::WebURLRequest& request, |
| 253 WebKit::WebNavigationPolicy policy) { | 279 WebKit::WebNavigationPolicy policy) { |
| 254 loadURLExternally(frame, request, policy, WebString()); | 280 loadURLExternally(frame, request, policy, WebString()); |
| 255 } | 281 } |
| 256 | 282 |
| 257 void RenderFrameImpl::loadURLExternally( | 283 void RenderFrameImpl::loadURLExternally( |
| 258 WebKit::WebFrame* frame, | 284 WebKit::WebFrame* frame, |
| 259 const WebKit::WebURLRequest& request, | 285 const WebKit::WebURLRequest& request, |
| 260 WebKit::WebNavigationPolicy policy, | 286 WebKit::WebNavigationPolicy policy, |
| 261 const WebKit::WebString& suggested_name) { | 287 const WebKit::WebString& suggested_name) { |
| 262 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(frame, request)); | 288 Referrer referrer(RenderViewImpl::GetReferrerFromRequest(frame, request)); |
| 263 if (policy == WebKit::WebNavigationPolicyDownload) { | 289 if (policy == WebKit::WebNavigationPolicyDownload) { |
| 264 Send(new ViewHostMsg_DownloadUrl(GetRoutingID(), request.url(), referrer, | 290 render_view_->Send(new ViewHostMsg_DownloadUrl(render_view_->GetRoutingID(), |
| 265 suggested_name)); | 291 request.url(), referrer, |
| 292 suggested_name)); |
| 266 } else { | 293 } else { |
| 267 render_view_->OpenURL(frame, request.url(), referrer, policy); | 294 render_view_->OpenURL(frame, request.url(), referrer, policy); |
| 268 } | 295 } |
| 269 } | 296 } |
| 270 | 297 |
| 271 WebKit::WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( | 298 WebKit::WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( |
| 272 WebKit::WebFrame* frame, | 299 WebKit::WebFrame* frame, |
| 273 WebKit::WebDataSource::ExtraData* extra_data, | 300 WebKit::WebDataSource::ExtraData* extra_data, |
| 274 const WebKit::WebURLRequest& request, | 301 const WebKit::WebURLRequest& request, |
| 275 WebKit::WebNavigationType type, | 302 WebKit::WebNavigationType type, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 // * stats_collection_controller_ | 407 // * stats_collection_controller_ |
| 381 render_view_->didClearWindowObject(frame); | 408 render_view_->didClearWindowObject(frame); |
| 382 } | 409 } |
| 383 | 410 |
| 384 void RenderFrameImpl::didCreateDocumentElement(WebKit::WebFrame* frame) { | 411 void RenderFrameImpl::didCreateDocumentElement(WebKit::WebFrame* frame) { |
| 385 // Notify the browser about non-blank documents loading in the top frame. | 412 // Notify the browser about non-blank documents loading in the top frame. |
| 386 GURL url = frame->document().url(); | 413 GURL url = frame->document().url(); |
| 387 if (url.is_valid() && url.spec() != kAboutBlankURL) { | 414 if (url.is_valid() && url.spec() != kAboutBlankURL) { |
| 388 // TODO(nasko): Check if webview()->mainFrame() is the same as the | 415 // TODO(nasko): Check if webview()->mainFrame() is the same as the |
| 389 // frame->tree()->top(). | 416 // frame->tree()->top(). |
| 390 if (frame == render_view_->webview()->mainFrame()) | 417 if (frame == render_view_->webview()->mainFrame()) { |
| 391 Send(new ViewHostMsg_DocumentAvailableInMainFrame(GetRoutingID())); | 418 render_view_->Send(new ViewHostMsg_DocumentAvailableInMainFrame( |
| 419 render_view_->GetRoutingID())); |
| 420 } |
| 392 } | 421 } |
| 393 | 422 |
| 394 // Call back to RenderViewImpl for observers to be notified. | 423 // Call back to RenderViewImpl for observers to be notified. |
| 395 // TODO(nasko): Remove once we have RenderFrameObserver. | 424 // TODO(nasko): Remove once we have RenderFrameObserver. |
| 396 render_view_->didCreateDocumentElement(frame); | 425 render_view_->didCreateDocumentElement(frame); |
| 397 } | 426 } |
| 398 | 427 |
| 399 void RenderFrameImpl::didReceiveTitle(WebKit::WebFrame* frame, | 428 void RenderFrameImpl::didReceiveTitle(WebKit::WebFrame* frame, |
| 400 const WebKit::WebString& title, | 429 const WebKit::WebString& title, |
| 401 WebKit::WebTextDirection direction) { | 430 WebKit::WebTextDirection direction) { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 top_document_state->set_was_prefetcher(true); | 590 top_document_state->set_was_prefetcher(true); |
| 562 | 591 |
| 563 if (was_after_preconnect_request) | 592 if (was_after_preconnect_request) |
| 564 top_document_state->set_was_after_preconnect_request(true); | 593 top_document_state->set_was_after_preconnect_request(true); |
| 565 } | 594 } |
| 566 | 595 |
| 567 // This is an instance where we embed a copy of the routing id | 596 // This is an instance where we embed a copy of the routing id |
| 568 // into the data portion of the message. This can cause problems if we | 597 // into the data portion of the message. This can cause problems if we |
| 569 // don't register this id on the browser side, since the download manager | 598 // don't register this id on the browser side, since the download manager |
| 570 // expects to find a RenderViewHost based off the id. | 599 // expects to find a RenderViewHost based off the id. |
| 571 request.setRequestorID(GetRoutingID()); | 600 request.setRequestorID(render_view_->GetRoutingID()); |
| 572 request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture()); | 601 request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture()); |
| 573 | 602 |
| 574 if (!navigation_state->extra_headers().empty()) { | 603 if (!navigation_state->extra_headers().empty()) { |
| 575 for (net::HttpUtil::HeadersIterator i( | 604 for (net::HttpUtil::HeadersIterator i( |
| 576 navigation_state->extra_headers().begin(), | 605 navigation_state->extra_headers().begin(), |
| 577 navigation_state->extra_headers().end(), "\n"); | 606 navigation_state->extra_headers().end(), "\n"); |
| 578 i.GetNext(); ) { | 607 i.GetNext(); ) { |
| 579 request.setHTTPHeaderField(WebString::fromUTF8(i.name()), | 608 request.setHTTPHeaderField(WebString::fromUTF8(i.name()), |
| 580 WebString::fromUTF8(i.values())); | 609 WebString::fromUTF8(i.values())); |
| 581 } | 610 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 // The recipients of this message have no use for data: URLs: they don't | 676 // The recipients of this message have no use for data: URLs: they don't |
| 648 // affect the page's insecure content list and are not in the disk cache. To | 677 // affect the page's insecure content list and are not in the disk cache. To |
| 649 // prevent large (1M+) data: URLs from crashing in the IPC system, we simply | 678 // prevent large (1M+) data: URLs from crashing in the IPC system, we simply |
| 650 // filter them out here. | 679 // filter them out here. |
| 651 GURL url(request.url()); | 680 GURL url(request.url()); |
| 652 if (url.SchemeIs("data")) | 681 if (url.SchemeIs("data")) |
| 653 return; | 682 return; |
| 654 | 683 |
| 655 // Let the browser know we loaded a resource from the memory cache. This | 684 // Let the browser know we loaded a resource from the memory cache. This |
| 656 // message is needed to display the correct SSL indicators. | 685 // message is needed to display the correct SSL indicators. |
| 657 Send(new ViewHostMsg_DidLoadResourceFromMemoryCache( | 686 render_view_->Send(new ViewHostMsg_DidLoadResourceFromMemoryCache( |
| 658 GetRoutingID(), | 687 render_view_->GetRoutingID(), |
| 659 url, | 688 url, |
| 660 response.securityInfo(), | 689 response.securityInfo(), |
| 661 request.httpMethod().utf8(), | 690 request.httpMethod().utf8(), |
| 662 response.mimeType().utf8(), | 691 response.mimeType().utf8(), |
| 663 ResourceType::FromTargetType(request.targetType()))); | 692 ResourceType::FromTargetType(request.targetType()))); |
| 664 } | 693 } |
| 665 | 694 |
| 666 void RenderFrameImpl::didDisplayInsecureContent(WebKit::WebFrame* frame) { | 695 void RenderFrameImpl::didDisplayInsecureContent(WebKit::WebFrame* frame) { |
| 667 Send(new ViewHostMsg_DidDisplayInsecureContent(GetRoutingID())); | 696 render_view_->Send(new ViewHostMsg_DidDisplayInsecureContent( |
| 697 render_view_->GetRoutingID())); |
| 668 } | 698 } |
| 669 | 699 |
| 670 void RenderFrameImpl::didRunInsecureContent( | 700 void RenderFrameImpl::didRunInsecureContent( |
| 671 WebKit::WebFrame* frame, | 701 WebKit::WebFrame* frame, |
| 672 const WebKit::WebSecurityOrigin& origin, | 702 const WebKit::WebSecurityOrigin& origin, |
| 673 const WebKit::WebURL& target) { | 703 const WebKit::WebURL& target) { |
| 674 Send(new ViewHostMsg_DidRunInsecureContent( | 704 render_view_->Send(new ViewHostMsg_DidRunInsecureContent( |
| 675 GetRoutingID(), | 705 render_view_->GetRoutingID(), |
| 676 origin.toString().utf8(), | 706 origin.toString().utf8(), |
| 677 target)); | 707 target)); |
| 678 } | 708 } |
| 679 | 709 |
| 680 void RenderFrameImpl::didExhaustMemoryAvailableForScript( | 710 void RenderFrameImpl::didExhaustMemoryAvailableForScript( |
| 681 WebKit::WebFrame* frame) { | 711 WebKit::WebFrame* frame) { |
| 682 Send(new ViewHostMsg_JSOutOfMemory(GetRoutingID())); | 712 render_view_->Send(new ViewHostMsg_JSOutOfMemory( |
| 713 render_view_->GetRoutingID())); |
| 683 } | 714 } |
| 684 | 715 |
| 685 void RenderFrameImpl::didCreateScriptContext(WebKit::WebFrame* frame, | 716 void RenderFrameImpl::didCreateScriptContext(WebKit::WebFrame* frame, |
| 686 v8::Handle<v8::Context> context, | 717 v8::Handle<v8::Context> context, |
| 687 int extension_group, | 718 int extension_group, |
| 688 int world_id) { | 719 int world_id) { |
| 689 GetContentClient()->renderer()->DidCreateScriptContext( | 720 GetContentClient()->renderer()->DidCreateScriptContext( |
| 690 frame, context, extension_group, world_id); | 721 frame, context, extension_group, world_id); |
| 691 } | 722 } |
| 692 | 723 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 709 render_view_->didChangeContentsSize(frame, size); | 740 render_view_->didChangeContentsSize(frame, size); |
| 710 } | 741 } |
| 711 | 742 |
| 712 void RenderFrameImpl::didChangeScrollOffset(WebKit::WebFrame* frame) { | 743 void RenderFrameImpl::didChangeScrollOffset(WebKit::WebFrame* frame) { |
| 713 // TODO(nasko): Move implementation here. Needed methods: | 744 // TODO(nasko): Move implementation here. Needed methods: |
| 714 // * StartNavStateSyncTimerIfNecessary | 745 // * StartNavStateSyncTimerIfNecessary |
| 715 render_view_->didChangeScrollOffset(frame); | 746 render_view_->didChangeScrollOffset(frame); |
| 716 } | 747 } |
| 717 | 748 |
| 718 void RenderFrameImpl::willInsertBody(WebKit::WebFrame* frame) { | 749 void RenderFrameImpl::willInsertBody(WebKit::WebFrame* frame) { |
| 719 if (!frame->parent()) | 750 if (!frame->parent()) { |
| 720 Send(new ViewHostMsg_WillInsertBody(GetRoutingID())); | 751 render_view_->Send(new ViewHostMsg_WillInsertBody( |
| 752 render_view_->GetRoutingID())); |
| 753 } |
| 721 } | 754 } |
| 722 | 755 |
| 723 void RenderFrameImpl::reportFindInPageMatchCount(int request_id, | 756 void RenderFrameImpl::reportFindInPageMatchCount(int request_id, |
| 724 int count, | 757 int count, |
| 725 bool final_update) { | 758 bool final_update) { |
| 726 int active_match_ordinal = -1; // -1 = don't update active match ordinal | 759 int active_match_ordinal = -1; // -1 = don't update active match ordinal |
| 727 if (!count) | 760 if (!count) |
| 728 active_match_ordinal = 0; | 761 active_match_ordinal = 0; |
| 729 | 762 |
| 730 Send(new ViewHostMsg_Find_Reply(GetRoutingID(), | 763 render_view_->Send(new ViewHostMsg_Find_Reply( |
| 731 request_id, | 764 render_view_->GetRoutingID(), request_id, count, |
| 732 count, | 765 gfx::Rect(), active_match_ordinal, final_update)); |
| 733 gfx::Rect(), | |
| 734 active_match_ordinal, | |
| 735 final_update)); | |
| 736 } | 766 } |
| 737 | 767 |
| 738 void RenderFrameImpl::reportFindInPageSelection( | 768 void RenderFrameImpl::reportFindInPageSelection( |
| 739 int request_id, | 769 int request_id, |
| 740 int active_match_ordinal, | 770 int active_match_ordinal, |
| 741 const WebKit::WebRect& selection_rect) { | 771 const WebKit::WebRect& selection_rect) { |
| 742 Send(new ViewHostMsg_Find_Reply(GetRoutingID(), | 772 render_view_->Send(new ViewHostMsg_Find_Reply( |
| 743 request_id, | 773 render_view_->GetRoutingID(), request_id, -1, selection_rect, |
| 744 -1, | 774 active_match_ordinal, false)); |
| 745 selection_rect, | |
| 746 active_match_ordinal, | |
| 747 false)); | |
| 748 } | 775 } |
| 749 | 776 |
| 750 void RenderFrameImpl::requestStorageQuota( | 777 void RenderFrameImpl::requestStorageQuota( |
| 751 WebKit::WebFrame* frame, | 778 WebKit::WebFrame* frame, |
| 752 WebKit::WebStorageQuotaType type, | 779 WebKit::WebStorageQuotaType type, |
| 753 unsigned long long requested_size, | 780 unsigned long long requested_size, |
| 754 WebKit::WebStorageQuotaCallbacks* callbacks) { | 781 WebKit::WebStorageQuotaCallbacks* callbacks) { |
| 755 DCHECK(frame); | 782 DCHECK(frame); |
| 756 WebSecurityOrigin origin = frame->document().securityOrigin(); | 783 WebSecurityOrigin origin = frame->document().securityOrigin(); |
| 757 if (origin.isUnique()) { | 784 if (origin.isUnique()) { |
| 758 // Unique origins cannot store persistent state. | 785 // Unique origins cannot store persistent state. |
| 759 callbacks->didFail(WebKit::WebStorageQuotaErrorAbort); | 786 callbacks->didFail(WebKit::WebStorageQuotaErrorAbort); |
| 760 return; | 787 return; |
| 761 } | 788 } |
| 762 ChildThread::current()->quota_dispatcher()->RequestStorageQuota( | 789 ChildThread::current()->quota_dispatcher()->RequestStorageQuota( |
| 763 GetRoutingID(), GURL(origin.toString()), | 790 render_view_->GetRoutingID(), GURL(origin.toString()), |
| 764 static_cast<quota::StorageType>(type), requested_size, | 791 static_cast<quota::StorageType>(type), requested_size, |
| 765 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); | 792 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); |
| 766 } | 793 } |
| 767 | 794 |
| 768 void RenderFrameImpl::willOpenSocketStream( | 795 void RenderFrameImpl::willOpenSocketStream( |
| 769 WebKit::WebSocketStreamHandle* handle) { | 796 WebKit::WebSocketStreamHandle* handle) { |
| 770 SocketStreamHandleData::AddToHandle(handle, GetRoutingID()); | 797 SocketStreamHandleData::AddToHandle(handle, render_view_->GetRoutingID()); |
| 771 } | 798 } |
| 772 | 799 |
| 773 void RenderFrameImpl::willStartUsingPeerConnectionHandler( | 800 void RenderFrameImpl::willStartUsingPeerConnectionHandler( |
| 774 WebKit::WebFrame* frame, | 801 WebKit::WebFrame* frame, |
| 775 WebKit::WebRTCPeerConnectionHandler* handler) { | 802 WebKit::WebRTCPeerConnectionHandler* handler) { |
| 776 #if defined(ENABLE_WEBRTC) | 803 #if defined(ENABLE_WEBRTC) |
| 777 static_cast<RTCPeerConnectionHandler*>(handler)->associateWithFrame(frame); | 804 static_cast<RTCPeerConnectionHandler*>(handler)->associateWithFrame(frame); |
| 778 #endif | 805 #endif |
| 779 } | 806 } |
| 780 | 807 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 if (render_view_->renderer_preferences_.enable_do_not_track) | 845 if (render_view_->renderer_preferences_.enable_do_not_track) |
| 819 return WebString::fromUTF8("1"); | 846 return WebString::fromUTF8("1"); |
| 820 return WebString(); | 847 return WebString(); |
| 821 } | 848 } |
| 822 | 849 |
| 823 bool RenderFrameImpl::allowWebGL(WebKit::WebFrame* frame, bool default_value) { | 850 bool RenderFrameImpl::allowWebGL(WebKit::WebFrame* frame, bool default_value) { |
| 824 if (!default_value) | 851 if (!default_value) |
| 825 return false; | 852 return false; |
| 826 | 853 |
| 827 bool blocked = true; | 854 bool blocked = true; |
| 828 Send(new ViewHostMsg_Are3DAPIsBlocked( | 855 render_view_->Send(new ViewHostMsg_Are3DAPIsBlocked( |
| 829 GetRoutingID(), | 856 render_view_->GetRoutingID(), |
| 830 GURL(frame->top()->document().securityOrigin().toString()), | 857 GURL(frame->top()->document().securityOrigin().toString()), |
| 831 THREE_D_API_TYPE_WEBGL, | 858 THREE_D_API_TYPE_WEBGL, |
| 832 &blocked)); | 859 &blocked)); |
| 833 return !blocked; | 860 return !blocked; |
| 834 } | 861 } |
| 835 | 862 |
| 836 void RenderFrameImpl::didLoseWebGLContext(WebKit::WebFrame* frame, | 863 void RenderFrameImpl::didLoseWebGLContext(WebKit::WebFrame* frame, |
| 837 int arb_robustness_status_code) { | 864 int arb_robustness_status_code) { |
| 838 Send(new ViewHostMsg_DidLose3DContext( | 865 render_view_->Send(new ViewHostMsg_DidLose3DContext( |
| 839 GURL(frame->top()->document().securityOrigin().toString()), | 866 GURL(frame->top()->document().securityOrigin().toString()), |
| 840 THREE_D_API_TYPE_WEBGL, | 867 THREE_D_API_TYPE_WEBGL, |
| 841 arb_robustness_status_code)); | 868 arb_robustness_status_code)); |
| 842 } | 869 } |
| 843 | 870 |
| 844 } // namespace content | 871 } // namespace content |
| OLD | NEW |