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 "extensions/browser/app_window/app_window_contents.h" | 5 #include "extensions/browser/app_window/app_window_contents.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 content::RenderFrameHost* rfh = web_contents_->GetMainFrame(); | 82 content::RenderFrameHost* rfh = web_contents_->GetMainFrame(); |
83 rfh->Send(new ExtensionMsg_MessageInvoke( | 83 rfh->Send(new ExtensionMsg_MessageInvoke( |
84 rfh->GetRoutingID(), host_->extension_id(), "app.window", | 84 rfh->GetRoutingID(), host_->extension_id(), "app.window", |
85 "appWindowShownForTests", args, false)); | 85 "appWindowShownForTests", args, false)); |
86 } | 86 } |
87 | 87 |
88 void AppWindowContentsImpl::OnWindowReady() { | 88 void AppWindowContentsImpl::OnWindowReady() { |
89 is_window_ready_ = true; | 89 is_window_ready_ = true; |
90 if (is_blocking_requests_) { | 90 if (is_blocking_requests_) { |
91 is_blocking_requests_ = false; | 91 is_blocking_requests_ = false; |
92 content::RenderFrameHost* frame = web_contents_->GetMainFrame(); | 92 content::ResourceDispatcherHost::ResumeBlockedRequestsForFrameFromUI( |
Devlin
2016/02/03 21:02:55
Yay type checking! I had a bug awhile back that t
| |
93 content::BrowserThread::PostTask( | 93 web_contents_->GetMainFrame()); |
94 content::BrowserThread::IO, FROM_HERE, | |
95 base::Bind( | |
96 &content::ResourceDispatcherHost::ResumeBlockedRequestsForRoute, | |
97 base::Unretained(content::ResourceDispatcherHost::Get()), | |
98 frame->GetProcess()->GetID(), | |
99 frame->GetRenderViewHost()->GetRoutingID())); | |
100 } | 94 } |
101 } | 95 } |
102 | 96 |
103 content::WebContents* AppWindowContentsImpl::GetWebContents() const { | 97 content::WebContents* AppWindowContentsImpl::GetWebContents() const { |
104 return web_contents_.get(); | 98 return web_contents_.get(); |
105 } | 99 } |
106 | 100 |
107 WindowController* AppWindowContentsImpl::GetWindowController() const { | 101 WindowController* AppWindowContentsImpl::GetWindowController() const { |
108 return nullptr; | 102 return nullptr; |
109 } | 103 } |
(...skipping 19 matching lines...) Expand all Loading... | |
129 host_->UpdateDraggableRegions(regions); | 123 host_->UpdateDraggableRegions(regions); |
130 } | 124 } |
131 | 125 |
132 void AppWindowContentsImpl::SuspendRenderFrameHost( | 126 void AppWindowContentsImpl::SuspendRenderFrameHost( |
133 content::RenderFrameHost* rfh) { | 127 content::RenderFrameHost* rfh) { |
134 DCHECK(rfh); | 128 DCHECK(rfh); |
135 // Don't bother blocking requests if the renderer side is already good to go. | 129 // Don't bother blocking requests if the renderer side is already good to go. |
136 if (is_window_ready_) | 130 if (is_window_ready_) |
137 return; | 131 return; |
138 is_blocking_requests_ = true; | 132 is_blocking_requests_ = true; |
139 // The ResourceDispatcherHost only accepts RenderViewHost child ids. | 133 content::ResourceDispatcherHost::BlockRequestsForFrameFromUI(rfh); |
140 // TODO(devlin): This will need to change for site isolation. | |
141 content::BrowserThread::PostTask( | |
142 content::BrowserThread::IO, FROM_HERE, | |
143 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute, | |
144 base::Unretained(content::ResourceDispatcherHost::Get()), | |
145 rfh->GetProcess()->GetID(), | |
146 rfh->GetRenderViewHost()->GetRoutingID())); | |
147 } | 134 } |
148 | 135 |
149 } // namespace extensions | 136 } // namespace extensions |
OLD | NEW |