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/browser/frame_host/interstitial_page_impl.h" | 5 #include "content/browser/frame_host/interstitial_page_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
20 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 20 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
21 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 21 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
22 #include "content/browser/frame_host/interstitial_page_navigator_impl.h" | 22 #include "content/browser/frame_host/interstitial_page_navigator_impl.h" |
23 #include "content/browser/frame_host/navigation_controller_impl.h" | 23 #include "content/browser/frame_host/navigation_controller_impl.h" |
24 #include "content/browser/frame_host/navigation_entry_impl.h" | 24 #include "content/browser/frame_host/navigation_entry_impl.h" |
25 #include "content/browser/loader/loader_io_thread_notifier_impl.h" | |
25 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 26 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
26 #include "content/browser/renderer_host/render_process_host_impl.h" | 27 #include "content/browser/renderer_host/render_process_host_impl.h" |
27 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 28 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
28 #include "content/browser/renderer_host/render_view_host_factory.h" | 29 #include "content/browser/renderer_host/render_view_host_factory.h" |
29 #include "content/browser/renderer_host/render_view_host_impl.h" | 30 #include "content/browser/renderer_host/render_view_host_impl.h" |
30 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 31 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
31 #include "content/browser/site_instance_impl.h" | 32 #include "content/browser/site_instance_impl.h" |
32 #include "content/browser/web_contents/web_contents_impl.h" | 33 #include "content/browser/web_contents/web_contents_impl.h" |
33 #include "content/browser/web_contents/web_contents_view.h" | 34 #include "content/browser/web_contents/web_contents_view.h" |
34 #include "content/common/frame_messages.h" | 35 #include "content/common/frame_messages.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
48 #include "net/base/escape.h" | 49 #include "net/base/escape.h" |
49 #include "net/url_request/url_request_context_getter.h" | 50 #include "net/url_request/url_request_context_getter.h" |
50 #include "ui/base/page_transition_types.h" | 51 #include "ui/base/page_transition_types.h" |
51 | 52 |
52 using blink::WebDragOperation; | 53 using blink::WebDragOperation; |
53 using blink::WebDragOperationsMask; | 54 using blink::WebDragOperationsMask; |
54 | 55 |
55 namespace content { | 56 namespace content { |
56 namespace { | 57 namespace { |
57 | 58 |
58 void ResourceRequestHelper(ResourceDispatcherHostImpl* rdh, | 59 void ResourceRequestHelper(ResourceRequestAction action, |
59 int process_id, | 60 ResourceDispatcherHostImpl* rdh, |
60 int render_view_host_id, | 61 const GlobalFrameRoutingId& routing_id) { |
61 ResourceRequestAction action) { | |
62 switch (action) { | 62 switch (action) { |
63 case BLOCK: | 63 case BLOCK: |
64 rdh->BlockRequestsForRoute(process_id, render_view_host_id); | 64 rdh->BlockRequestsForFrame(routing_id); |
65 break; | 65 break; |
66 case RESUME: | 66 case RESUME: |
67 rdh->ResumeBlockedRequestsForRoute(process_id, render_view_host_id); | 67 rdh->ResumeBlockedRequestsForFrame(routing_id); |
68 break; | 68 break; |
69 case CANCEL: | 69 case CANCEL: |
70 rdh->CancelBlockedRequestsForRoute(process_id, render_view_host_id); | 70 rdh->CancelBlockedRequestsForFrame(routing_id); |
71 break; | 71 break; |
72 default: | 72 default: |
73 NOTREACHED(); | 73 NOTREACHED(); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 } // namespace | 77 } // namespace |
78 | 78 |
79 class InterstitialPageImpl::InterstitialPageRVHDelegateView | 79 class InterstitialPageImpl::InterstitialPageRVHDelegateView |
80 : public RenderViewHostDelegateView { | 80 : public RenderViewHostDelegateView { |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
832 | 832 |
833 if (action == CANCEL || action == RESUME) { | 833 if (action == CANCEL || action == RESUME) { |
834 if (resource_dispatcher_host_notified_) | 834 if (resource_dispatcher_host_notified_) |
835 return; | 835 return; |
836 resource_dispatcher_host_notified_ = true; | 836 resource_dispatcher_host_notified_ = true; |
837 } | 837 } |
838 | 838 |
839 // The tab might not have a render_view_host if it was closed (in which case, | 839 // The tab might not have a render_view_host if it was closed (in which case, |
840 // we have taken care of the blocked requests when processing | 840 // we have taken care of the blocked requests when processing |
841 // NOTIFY_RENDER_WIDGET_HOST_DESTROYED. | 841 // NOTIFY_RENDER_WIDGET_HOST_DESTROYED. |
842 // Also we need to test there is a ResourceDispatcherHostImpl, as when unit- | 842 // LoaderIOThreadNotifier tests if there is a ResourceDispatcherHostImpl, as |
Randy Smith (Not in Mondays)
2016/01/06 21:56:29
This comment seems wrong to me--LIOTN isn't testin
Charlie Harrison
2016/01/07 22:47:05
This code tests that we have a rvh. The LIOTN test
| |
843 // tests we don't have one. | 843 // unit-tests don't have one. |
844 RenderViewHostImpl* rvh = RenderViewHostImpl::FromID(original_child_id_, | 844 RenderViewHostImpl* rvh = RenderViewHostImpl::FromID(original_child_id_, |
845 original_rvh_id_); | 845 original_rvh_id_); |
846 if (!rvh || !ResourceDispatcherHostImpl::Get()) | 846 if (!rvh) |
847 return; | 847 return; |
848 | 848 |
849 BrowserThread::PostTask( | 849 LoaderIOThreadNotifierImpl::NotifyForEachFrame( |
850 BrowserThread::IO, | 850 rvh->GetDelegate()->GetFrameTree(), |
851 FROM_HERE, | 851 base::Bind(&ResourceRequestHelper, action)); |
852 base::Bind( | |
853 &ResourceRequestHelper, | |
854 ResourceDispatcherHostImpl::Get(), | |
855 original_child_id_, | |
856 original_rvh_id_, | |
857 action)); | |
858 } | 852 } |
859 | 853 |
860 void InterstitialPageImpl::OnDomOperationResponse( | 854 void InterstitialPageImpl::OnDomOperationResponse( |
861 const std::string& json_string) { | 855 const std::string& json_string) { |
862 std::string json = json_string; | 856 std::string json = json_string; |
863 // Needed by test code. | 857 // Needed by test code. |
864 NotificationService::current()->Notify(NOTIFICATION_DOM_OPERATION_RESPONSE, | 858 NotificationService::current()->Notify(NOTIFICATION_DOM_OPERATION_RESPONSE, |
865 Source<WebContents>(web_contents()), | 859 Source<WebContents>(web_contents()), |
866 Details<std::string>(&json)); | 860 Details<std::string>(&json)); |
867 | 861 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
941 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted( | 935 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted( |
942 const LoadCommittedDetails& load_details) { | 936 const LoadCommittedDetails& load_details) { |
943 interstitial_->OnNavigatingAwayOrTabClosing(); | 937 interstitial_->OnNavigatingAwayOrTabClosing(); |
944 } | 938 } |
945 | 939 |
946 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { | 940 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { |
947 interstitial_->OnNavigatingAwayOrTabClosing(); | 941 interstitial_->OnNavigatingAwayOrTabClosing(); |
948 } | 942 } |
949 | 943 |
950 } // namespace content | 944 } // namespace content |
OLD | NEW |