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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "content/child/appcache/appcache_dispatcher.h" | 9 #include "content/child/appcache/appcache_dispatcher.h" |
10 #include "content/child/fileapi/file_system_dispatcher.h" | 10 #include "content/child/fileapi/file_system_dispatcher.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "third_party/WebKit/public/web/WebFileSystemCallbacks.h" | 38 #include "third_party/WebKit/public/web/WebFileSystemCallbacks.h" |
39 #include "third_party/WebKit/public/web/WebFrame.h" | 39 #include "third_party/WebKit/public/web/WebFrame.h" |
40 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 40 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
41 #include "third_party/WebKit/public/web/WebPlugin.h" | 41 #include "third_party/WebKit/public/web/WebPlugin.h" |
42 #include "third_party/WebKit/public/web/WebPluginParams.h" | 42 #include "third_party/WebKit/public/web/WebPluginParams.h" |
43 #include "third_party/WebKit/public/web/WebSearchableFormData.h" | 43 #include "third_party/WebKit/public/web/WebSearchableFormData.h" |
44 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 44 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
45 #include "third_party/WebKit/public/web/WebStorageQuotaCallbacks.h" | 45 #include "third_party/WebKit/public/web/WebStorageQuotaCallbacks.h" |
46 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 46 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
47 #include "third_party/WebKit/public/web/WebView.h" | 47 #include "third_party/WebKit/public/web/WebView.h" |
| 48 #include "webkit/child/site_isolation_policy.h" |
48 #include "webkit/child/weburlresponse_extradata_impl.h" | 49 #include "webkit/child/weburlresponse_extradata_impl.h" |
49 | 50 |
50 using WebKit::WebDataSource; | 51 using WebKit::WebDataSource; |
51 using WebKit::WebDocument; | 52 using WebKit::WebDocument; |
52 using WebKit::WebFileSystemCallbacks; | 53 using WebKit::WebFileSystemCallbacks; |
53 using WebKit::WebFrame; | 54 using WebKit::WebFrame; |
54 using WebKit::WebNavigationPolicy; | 55 using WebKit::WebNavigationPolicy; |
55 using WebKit::WebPluginParams; | 56 using WebKit::WebPluginParams; |
56 using WebKit::WebReferrerPolicy; | 57 using WebKit::WebReferrerPolicy; |
57 using WebKit::WebSearchableFormData; | 58 using WebKit::WebSearchableFormData; |
58 using WebKit::WebSecurityOrigin; | 59 using WebKit::WebSecurityOrigin; |
59 using WebKit::WebStorageQuotaCallbacks; | 60 using WebKit::WebStorageQuotaCallbacks; |
60 using WebKit::WebString; | 61 using WebKit::WebString; |
61 using WebKit::WebURL; | 62 using WebKit::WebURL; |
62 using WebKit::WebURLError; | 63 using WebKit::WebURLError; |
63 using WebKit::WebURLRequest; | 64 using WebKit::WebURLRequest; |
64 using WebKit::WebURLResponse; | 65 using WebKit::WebURLResponse; |
65 using WebKit::WebUserGestureIndicator; | 66 using WebKit::WebUserGestureIndicator; |
66 using WebKit::WebVector; | 67 using WebKit::WebVector; |
67 using WebKit::WebView; | 68 using WebKit::WebView; |
68 using base::Time; | 69 using base::Time; |
69 using base::TimeDelta; | 70 using base::TimeDelta; |
| 71 |
| 72 using webkit_glue::SiteIsolationPolicy; |
70 using webkit_glue::WebURLResponseExtraDataImpl; | 73 using webkit_glue::WebURLResponseExtraDataImpl; |
71 | 74 |
72 namespace content { | 75 namespace content { |
73 | 76 |
74 static RenderFrameImpl* (*g_create_render_frame_impl)(RenderViewImpl*, int32) = | 77 static RenderFrameImpl* (*g_create_render_frame_impl)(RenderViewImpl*, int32) = |
75 NULL; | 78 NULL; |
76 | 79 |
77 // static | 80 // static |
78 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, | 81 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, |
79 int32 routing_id) { | 82 int32 routing_id) { |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 void RenderFrameImpl::didFailProvisionalLoad( | 368 void RenderFrameImpl::didFailProvisionalLoad( |
366 WebKit::WebFrame* frame, | 369 WebKit::WebFrame* frame, |
367 const WebKit::WebURLError& error) { | 370 const WebKit::WebURLError& error) { |
368 // TODO(nasko): Move implementation here. Needed state: | 371 // TODO(nasko): Move implementation here. Needed state: |
369 // * page_id_ | 372 // * page_id_ |
370 // * pending_navigation_params_ | 373 // * pending_navigation_params_ |
371 // Needed methods | 374 // Needed methods |
372 // * MaybeLoadAlternateErrorPage | 375 // * MaybeLoadAlternateErrorPage |
373 // * LoadNavigationErrorPage | 376 // * LoadNavigationErrorPage |
374 render_view_->didFailProvisionalLoad(frame, error); | 377 render_view_->didFailProvisionalLoad(frame, error); |
| 378 |
| 379 SiteIsolationPolicy::DidFinishResourceLoadForUrl(error.unreachableURL); |
375 } | 380 } |
376 | 381 |
377 void RenderFrameImpl::didCommitProvisionalLoad(WebKit::WebFrame* frame, | 382 void RenderFrameImpl::didCommitProvisionalLoad(WebKit::WebFrame* frame, |
378 bool is_new_navigation) { | 383 bool is_new_navigation) { |
379 // TODO(nasko): Move implementation here. Needed state: | 384 // TODO(nasko): Move implementation here. Needed state: |
380 // * page_id_ | 385 // * page_id_ |
381 // * next_page_id_ | 386 // * next_page_id_ |
382 // * history_list_offset_ | 387 // * history_list_offset_ |
383 // * history_list_length_ | 388 // * history_list_length_ |
384 // * history_page_ids_ | 389 // * history_page_ids_ |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 void RenderFrameImpl::didHandleOnloadEvents(WebKit::WebFrame* frame) { | 439 void RenderFrameImpl::didHandleOnloadEvents(WebKit::WebFrame* frame) { |
435 // TODO(nasko): Move implementation here. Needed state: | 440 // TODO(nasko): Move implementation here. Needed state: |
436 // * page_id_ | 441 // * page_id_ |
437 render_view_->didHandleOnloadEvents(frame); | 442 render_view_->didHandleOnloadEvents(frame); |
438 } | 443 } |
439 | 444 |
440 void RenderFrameImpl::didFailLoad(WebKit::WebFrame* frame, | 445 void RenderFrameImpl::didFailLoad(WebKit::WebFrame* frame, |
441 const WebKit::WebURLError& error) { | 446 const WebKit::WebURLError& error) { |
442 // TODO(nasko): Move implementation here. No state needed. | 447 // TODO(nasko): Move implementation here. No state needed. |
443 render_view_->didFailLoad(frame, error); | 448 render_view_->didFailLoad(frame, error); |
| 449 |
| 450 SiteIsolationPolicy::DidFinishResourceLoadForUrl(error.unreachableURL); |
444 } | 451 } |
445 | 452 |
446 void RenderFrameImpl::didFinishLoad(WebKit::WebFrame* frame) { | 453 void RenderFrameImpl::didFinishLoad(WebKit::WebFrame* frame) { |
447 // TODO(nasko): Move implementation here. No state needed, just observers | 454 // TODO(nasko): Move implementation here. No state needed, just observers |
448 // notification before sending message to the browser process. | 455 // notification before sending message to the browser process. |
449 render_view_->didFinishLoad(frame); | 456 render_view_->didFinishLoad(frame); |
450 } | 457 } |
451 | 458 |
452 void RenderFrameImpl::didNavigateWithinPage(WebKit::WebFrame* frame, | 459 void RenderFrameImpl::didNavigateWithinPage(WebKit::WebFrame* frame, |
453 bool is_new_navigation) { | 460 bool is_new_navigation) { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 navigation_state->extra_headers().begin(), | 598 navigation_state->extra_headers().begin(), |
592 navigation_state->extra_headers().end(), "\n"); | 599 navigation_state->extra_headers().end(), "\n"); |
593 i.GetNext(); ) { | 600 i.GetNext(); ) { |
594 request.setHTTPHeaderField(WebString::fromUTF8(i.name()), | 601 request.setHTTPHeaderField(WebString::fromUTF8(i.name()), |
595 WebString::fromUTF8(i.values())); | 602 WebString::fromUTF8(i.values())); |
596 } | 603 } |
597 } | 604 } |
598 | 605 |
599 if (!render_view_->renderer_preferences_.enable_referrers) | 606 if (!render_view_->renderer_preferences_.enable_referrers) |
600 request.clearHTTPHeaderField("Referer"); | 607 request.clearHTTPHeaderField("Referer"); |
| 608 |
| 609 SiteIsolationPolicy::WillSendRequest(identifier, request.targetType()); |
601 } | 610 } |
602 | 611 |
603 void RenderFrameImpl::didReceiveResponse( | 612 void RenderFrameImpl::didReceiveResponse( |
604 WebKit::WebFrame* frame, | 613 WebKit::WebFrame* frame, |
605 unsigned identifier, | 614 unsigned identifier, |
606 const WebKit::WebURLResponse& response) { | 615 const WebKit::WebURLResponse& response) { |
| 616 |
| 617 // Calling will update bookkeeping related to the response for later |
| 618 // use. |
| 619 SiteIsolationPolicy::DidReceiveResponse(frame, identifier, response); |
| 620 |
607 // Only do this for responses that correspond to a provisional data source | 621 // Only do this for responses that correspond to a provisional data source |
608 // of the top-most frame. If we have a provisional data source, then we | 622 // of the top-most frame. If we have a provisional data source, then we |
609 // can't have any sub-resources yet, so we know that this response must | 623 // can't have any sub-resources yet, so we know that this response must |
610 // correspond to a frame load. | 624 // correspond to a frame load. |
611 if (!frame->provisionalDataSource() || frame->parent()) | 625 if (!frame->provisionalDataSource() || frame->parent()) |
612 return; | 626 return; |
613 | 627 |
614 // If we are in view source mode, then just let the user see the source of | 628 // If we are in view source mode, then just let the user see the source of |
615 // the server's error page. | 629 // the server's error page. |
616 if (frame->isViewSourceModeEnabled()) | 630 if (frame->isViewSourceModeEnabled()) |
(...skipping 29 matching lines...) Expand all Loading... |
646 internal_data->set_use_error_page(true); | 660 internal_data->set_use_error_page(true); |
647 } | 661 } |
648 | 662 |
649 void RenderFrameImpl::didFinishResourceLoad(WebKit::WebFrame* frame, | 663 void RenderFrameImpl::didFinishResourceLoad(WebKit::WebFrame* frame, |
650 unsigned identifier) { | 664 unsigned identifier) { |
651 // TODO(nasko): Move implementation here. Needed state: | 665 // TODO(nasko): Move implementation here. Needed state: |
652 // * devtools_agent_ | 666 // * devtools_agent_ |
653 // Needed methods: | 667 // Needed methods: |
654 // * LoadNavigationErrorPage | 668 // * LoadNavigationErrorPage |
655 render_view_->didFinishResourceLoad(frame, identifier); | 669 render_view_->didFinishResourceLoad(frame, identifier); |
| 670 |
| 671 SiteIsolationPolicy::DidFinishResourceLoad(identifier); |
656 } | 672 } |
657 | 673 |
658 void RenderFrameImpl::didLoadResourceFromMemoryCache( | 674 void RenderFrameImpl::didLoadResourceFromMemoryCache( |
659 WebKit::WebFrame* frame, | 675 WebKit::WebFrame* frame, |
660 const WebKit::WebURLRequest& request, | 676 const WebKit::WebURLRequest& request, |
661 const WebKit::WebURLResponse& response) { | 677 const WebKit::WebURLResponse& response) { |
662 // The recipients of this message have no use for data: URLs: they don't | 678 // The recipients of this message have no use for data: URLs: they don't |
663 // affect the page's insecure content list and are not in the disk cache. To | 679 // affect the page's insecure content list and are not in the disk cache. To |
664 // prevent large (1M+) data: URLs from crashing in the IPC system, we simply | 680 // prevent large (1M+) data: URLs from crashing in the IPC system, we simply |
665 // filter them out here. | 681 // filter them out here. |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 | 907 |
892 void RenderFrameImpl::didLoseWebGLContext(WebKit::WebFrame* frame, | 908 void RenderFrameImpl::didLoseWebGLContext(WebKit::WebFrame* frame, |
893 int arb_robustness_status_code) { | 909 int arb_robustness_status_code) { |
894 Send(new ViewHostMsg_DidLose3DContext( | 910 Send(new ViewHostMsg_DidLose3DContext( |
895 GURL(frame->top()->document().securityOrigin().toString()), | 911 GURL(frame->top()->document().securityOrigin().toString()), |
896 THREE_D_API_TYPE_WEBGL, | 912 THREE_D_API_TYPE_WEBGL, |
897 arb_robustness_status_code)); | 913 arb_robustness_status_code)); |
898 } | 914 } |
899 | 915 |
900 } // namespace content | 916 } // namespace content |
OLD | NEW |