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 26 matching lines...) Expand all Loading... |
37 web_contents_->GetMutableRendererPrefs()-> | 37 web_contents_->GetMutableRendererPrefs()-> |
38 browser_handles_all_top_level_requests = true; | 38 browser_handles_all_top_level_requests = true; |
39 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); | 39 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); |
40 } | 40 } |
41 | 41 |
42 void AppWindowContentsImpl::LoadContents(int32 creator_process_id) { | 42 void AppWindowContentsImpl::LoadContents(int32 creator_process_id) { |
43 // If the new view is in the same process as the creator, block the created | 43 // If the new view is in the same process as the creator, block the created |
44 // RVH from loading anything until the background page has had a chance to | 44 // RVH from loading anything until the background page has had a chance to |
45 // do any initialization it wants. If it's a different process, the new RVH | 45 // do any initialization it wants. If it's a different process, the new RVH |
46 // shouldn't communicate with the background page anyway (e.g. sandboxed). | 46 // shouldn't communicate with the background page anyway (e.g. sandboxed). |
47 if (web_contents_->GetRenderViewHost()->GetProcess()->GetID() == | 47 if (web_contents_->GetMainFrame()->GetProcess()->GetID() == |
48 creator_process_id) { | 48 creator_process_id) { |
49 SuspendRenderViewHost(web_contents_->GetRenderViewHost()); | 49 SuspendRenderFrameHost(web_contents_->GetMainFrame()); |
50 } else { | 50 } else { |
51 VLOG(1) << "AppWindow created in new process (" | 51 VLOG(1) << "AppWindow created in new process (" |
52 << web_contents_->GetRenderViewHost()->GetProcess()->GetID() | 52 << web_contents_->GetMainFrame()->GetProcess()->GetID() |
53 << ") != creator (" << creator_process_id << "). Routing disabled."; | 53 << ") != creator (" << creator_process_id << "). Routing disabled."; |
54 } | 54 } |
55 | 55 |
56 web_contents_->GetController().LoadURL( | 56 web_contents_->GetController().LoadURL( |
57 url_, content::Referrer(), ui::PAGE_TRANSITION_LINK, | 57 url_, content::Referrer(), ui::PAGE_TRANSITION_LINK, |
58 std::string()); | 58 std::string()); |
59 } | 59 } |
60 | 60 |
61 void AppWindowContentsImpl::NativeWindowChanged( | 61 void AppWindowContentsImpl::NativeWindowChanged( |
62 NativeAppWindow* native_app_window) { | 62 NativeAppWindow* native_app_window) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 IPC_MESSAGE_UNHANDLED(handled = false) | 100 IPC_MESSAGE_UNHANDLED(handled = false) |
101 IPC_END_MESSAGE_MAP() | 101 IPC_END_MESSAGE_MAP() |
102 return handled; | 102 return handled; |
103 } | 103 } |
104 | 104 |
105 void AppWindowContentsImpl::UpdateDraggableRegions( | 105 void AppWindowContentsImpl::UpdateDraggableRegions( |
106 const std::vector<DraggableRegion>& regions) { | 106 const std::vector<DraggableRegion>& regions) { |
107 host_->UpdateDraggableRegions(regions); | 107 host_->UpdateDraggableRegions(regions); |
108 } | 108 } |
109 | 109 |
110 void AppWindowContentsImpl::SuspendRenderViewHost( | 110 void AppWindowContentsImpl::SuspendRenderFrameHost( |
111 content::RenderViewHost* rvh) { | 111 content::RenderFrameHost* rfh) { |
112 DCHECK(rvh); | 112 DCHECK(rfh); |
113 content::BrowserThread::PostTask( | 113 content::BrowserThread::PostTask( |
114 content::BrowserThread::IO, FROM_HERE, | 114 content::BrowserThread::IO, FROM_HERE, |
115 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute, | 115 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute, |
116 base::Unretained(content::ResourceDispatcherHost::Get()), | 116 base::Unretained(content::ResourceDispatcherHost::Get()), |
117 rvh->GetProcess()->GetID(), rvh->GetRoutingID())); | 117 rfh->GetProcess()->GetID(), rfh->GetRoutingID())); |
118 } | 118 } |
119 | 119 |
120 } // namespace extensions | 120 } // namespace extensions |
OLD | NEW |