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