Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: content/browser/frame_host/interstitial_page_impl.cc

Issue 1542743002: [RDHI] Refactored blocked_loaders_map_ to key by render frame route id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nasko nit Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "content/public/browser/web_contents_delegate.h" 46 #include "content/public/browser/web_contents_delegate.h"
47 #include "content/public/common/bindings_policy.h" 47 #include "content/public/common/bindings_policy.h"
48 #include "net/base/escape.h" 48 #include "net/base/escape.h"
49 #include "net/url_request/url_request_context_getter.h" 49 #include "net/url_request/url_request_context_getter.h"
50 #include "ui/base/page_transition_types.h" 50 #include "ui/base/page_transition_types.h"
51 51
52 using blink::WebDragOperation; 52 using blink::WebDragOperation;
53 using blink::WebDragOperationsMask; 53 using blink::WebDragOperationsMask;
54 54
55 namespace content { 55 namespace content {
56 namespace {
57
58 void ResourceRequestHelper(ResourceDispatcherHostImpl* rdh,
59 int process_id,
60 int render_view_host_id,
61 ResourceRequestAction action) {
62 switch (action) {
63 case BLOCK:
64 rdh->BlockRequestsForRoute(process_id, render_view_host_id);
65 break;
66 case RESUME:
67 rdh->ResumeBlockedRequestsForRoute(process_id, render_view_host_id);
68 break;
69 case CANCEL:
70 rdh->CancelBlockedRequestsForRoute(process_id, render_view_host_id);
71 break;
72 default:
73 NOTREACHED();
74 }
75 }
76
77 } // namespace
78 56
79 class InterstitialPageImpl::InterstitialPageRVHDelegateView 57 class InterstitialPageImpl::InterstitialPageRVHDelegateView
80 : public RenderViewHostDelegateView { 58 : public RenderViewHostDelegateView {
81 public: 59 public:
82 explicit InterstitialPageRVHDelegateView(InterstitialPageImpl* page); 60 explicit InterstitialPageRVHDelegateView(InterstitialPageImpl* page);
83 61
84 // RenderViewHostDelegateView implementation: 62 // RenderViewHostDelegateView implementation:
85 #if defined(OS_MACOSX) || defined(OS_ANDROID) 63 #if defined(OS_MACOSX) || defined(OS_ANDROID)
86 void ShowPopupMenu(RenderFrameHost* render_frame_host, 64 void ShowPopupMenu(RenderFrameHost* render_frame_host,
87 const gfx::Rect& bounds, 65 const gfx::Rect& bounds,
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 826
849 if (action == CANCEL || action == RESUME) { 827 if (action == CANCEL || action == RESUME) {
850 if (resource_dispatcher_host_notified_) 828 if (resource_dispatcher_host_notified_)
851 return; 829 return;
852 resource_dispatcher_host_notified_ = true; 830 resource_dispatcher_host_notified_ = true;
853 } 831 }
854 832
855 // The tab might not have a render_view_host if it was closed (in which case, 833 // The tab might not have a render_view_host if it was closed (in which case,
856 // we have taken care of the blocked requests when processing 834 // we have taken care of the blocked requests when processing
857 // NOTIFY_RENDER_WIDGET_HOST_DESTROYED. 835 // NOTIFY_RENDER_WIDGET_HOST_DESTROYED.
858 // Also we need to test there is a ResourceDispatcherHostImpl, as when unit-
859 // tests we don't have one.
860 RenderViewHostImpl* rvh = RenderViewHostImpl::FromID(original_child_id_, 836 RenderViewHostImpl* rvh = RenderViewHostImpl::FromID(original_child_id_,
861 original_rvh_id_); 837 original_rvh_id_);
862 if (!rvh || !ResourceDispatcherHostImpl::Get()) 838 if (!rvh)
863 return; 839 return;
864 840
865 BrowserThread::PostTask( 841 RenderFrameHostImpl* rfh =
866 BrowserThread::IO, 842 static_cast<RenderFrameHostImpl*>(rvh->GetMainFrame());
867 FROM_HERE, 843 switch (action) {
868 base::Bind( 844 case BLOCK:
869 &ResourceRequestHelper, 845 ResourceDispatcherHost::BlockRequestsForFrameFromUI(rfh);
870 ResourceDispatcherHostImpl::Get(), 846 break;
871 original_child_id_, 847 case RESUME:
872 original_rvh_id_, 848 ResourceDispatcherHost::ResumeBlockedRequestsForFrameFromUI(rfh);
873 action)); 849 break;
850 default:
851 DCHECK_EQ(action, CANCEL);
852 ResourceDispatcherHostImpl::CancelBlockedRequestsForFrameFromUI(rfh);
853 break;
854 }
874 } 855 }
875 856
876 void InterstitialPageImpl::OnDomOperationResponse( 857 void InterstitialPageImpl::OnDomOperationResponse(
877 const std::string& json_string) { 858 const std::string& json_string) {
878 std::string json = json_string; 859 std::string json = json_string;
879 // Needed by test code. 860 // Needed by test code.
880 NotificationService::current()->Notify(NOTIFICATION_DOM_OPERATION_RESPONSE, 861 NotificationService::current()->Notify(NOTIFICATION_DOM_OPERATION_RESPONSE,
881 Source<WebContents>(web_contents()), 862 Source<WebContents>(web_contents()),
882 Details<std::string>(&json)); 863 Details<std::string>(&json));
883 864
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted( 938 void InterstitialPageImpl::UnderlyingContentObserver::NavigationEntryCommitted(
958 const LoadCommittedDetails& load_details) { 939 const LoadCommittedDetails& load_details) {
959 interstitial_->OnNavigatingAwayOrTabClosing(); 940 interstitial_->OnNavigatingAwayOrTabClosing();
960 } 941 }
961 942
962 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { 943 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() {
963 interstitial_->OnNavigatingAwayOrTabClosing(); 944 interstitial_->OnNavigatingAwayOrTabClosing();
964 } 945 }
965 946
966 } // namespace content 947 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698