| 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 <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/render_frame_host.h" | 13 #include "content/public/browser/render_frame_host.h" |
| 14 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
| 15 #include "content/public/browser/render_view_host.h" | 15 #include "content/public/browser/render_view_host.h" |
| 16 #include "content/public/browser/resource_dispatcher_host.h" | |
| 17 #include "content/public/browser/site_instance.h" | 16 #include "content/public/browser/site_instance.h" |
| 18 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 19 #include "content/public/common/renderer_preferences.h" | 18 #include "content/public/common/renderer_preferences.h" |
| 20 #include "extensions/browser/app_window/native_app_window.h" | 19 #include "extensions/browser/app_window/native_app_window.h" |
| 21 #include "extensions/common/extension_messages.h" | 20 #include "extensions/common/extension_messages.h" |
| 22 | 21 |
| 23 namespace extensions { | 22 namespace extensions { |
| 24 | 23 |
| 25 AppWindowContentsImpl::AppWindowContentsImpl(AppWindow* host) | 24 AppWindowContentsImpl::AppWindowContentsImpl(AppWindow* host) |
| 26 : host_(host), is_blocking_requests_(false), is_window_ready_(false) {} | 25 : host_(host), is_blocking_requests_(false), is_window_ready_(false) {} |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 78 |
| 80 void AppWindowContentsImpl::NativeWindowClosed() { | 79 void AppWindowContentsImpl::NativeWindowClosed() { |
| 81 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost(); | 80 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost(); |
| 82 rvh->Send(new ExtensionMsg_AppWindowClosed(rvh->GetRoutingID())); | 81 rvh->Send(new ExtensionMsg_AppWindowClosed(rvh->GetRoutingID())); |
| 83 } | 82 } |
| 84 | 83 |
| 85 void AppWindowContentsImpl::OnWindowReady() { | 84 void AppWindowContentsImpl::OnWindowReady() { |
| 86 is_window_ready_ = true; | 85 is_window_ready_ = true; |
| 87 if (is_blocking_requests_) { | 86 if (is_blocking_requests_) { |
| 88 is_blocking_requests_ = false; | 87 is_blocking_requests_ = false; |
| 89 content::ResourceDispatcherHost::ResumeBlockedRequestsForFrameFromUI( | 88 web_contents_->GetMainFrame()->ResumeBlockedRequestsForFrame(); |
| 90 web_contents_->GetMainFrame()); | |
| 91 } | 89 } |
| 92 } | 90 } |
| 93 | 91 |
| 94 content::WebContents* AppWindowContentsImpl::GetWebContents() const { | 92 content::WebContents* AppWindowContentsImpl::GetWebContents() const { |
| 95 return web_contents_.get(); | 93 return web_contents_.get(); |
| 96 } | 94 } |
| 97 | 95 |
| 98 WindowController* AppWindowContentsImpl::GetWindowController() const { | 96 WindowController* AppWindowContentsImpl::GetWindowController() const { |
| 99 return nullptr; | 97 return nullptr; |
| 100 } | 98 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 120 host_->UpdateDraggableRegions(regions); | 118 host_->UpdateDraggableRegions(regions); |
| 121 } | 119 } |
| 122 | 120 |
| 123 void AppWindowContentsImpl::SuspendRenderFrameHost( | 121 void AppWindowContentsImpl::SuspendRenderFrameHost( |
| 124 content::RenderFrameHost* rfh) { | 122 content::RenderFrameHost* rfh) { |
| 125 DCHECK(rfh); | 123 DCHECK(rfh); |
| 126 // Don't bother blocking requests if the renderer side is already good to go. | 124 // Don't bother blocking requests if the renderer side is already good to go. |
| 127 if (is_window_ready_) | 125 if (is_window_ready_) |
| 128 return; | 126 return; |
| 129 is_blocking_requests_ = true; | 127 is_blocking_requests_ = true; |
| 130 content::ResourceDispatcherHost::BlockRequestsForFrameFromUI(rfh); | 128 rfh->BlockRequestsForFrame(); |
| 131 } | 129 } |
| 132 | 130 |
| 133 } // namespace extensions | 131 } // namespace extensions |
| OLD | NEW |