| 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 22 matching lines...) Expand all Loading... |
| 33 web_contents_.reset( | 33 web_contents_.reset( |
| 34 content::WebContents::Create(content::WebContents::CreateParams( | 34 content::WebContents::Create(content::WebContents::CreateParams( |
| 35 context, content::SiteInstance::CreateForURL(context, url_)))); | 35 context, content::SiteInstance::CreateForURL(context, url_)))); |
| 36 | 36 |
| 37 Observe(web_contents_.get()); | 37 Observe(web_contents_.get()); |
| 38 web_contents_->GetMutableRendererPrefs()-> | 38 web_contents_->GetMutableRendererPrefs()-> |
| 39 browser_handles_all_top_level_requests = true; | 39 browser_handles_all_top_level_requests = true; |
| 40 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); | 40 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void AppWindowContentsImpl::LoadContents(int32 creator_process_id) { | 43 void AppWindowContentsImpl::LoadContents(int32_t creator_process_id) { |
| 44 // If the new view is in the same process as the creator, block the created | 44 // If the new view is in the same process as the creator, block the created |
| 45 // RVH from loading anything until the background page has had a chance to | 45 // RVH from loading anything until the background page has had a chance to |
| 46 // do any initialization it wants. If it's a different process, the new RVH | 46 // do any initialization it wants. If it's a different process, the new RVH |
| 47 // shouldn't communicate with the background page anyway (e.g. sandboxed). | 47 // shouldn't communicate with the background page anyway (e.g. sandboxed). |
| 48 if (web_contents_->GetMainFrame()->GetProcess()->GetID() == | 48 if (web_contents_->GetMainFrame()->GetProcess()->GetID() == |
| 49 creator_process_id) { | 49 creator_process_id) { |
| 50 SuspendRenderFrameHost(web_contents_->GetMainFrame()); | 50 SuspendRenderFrameHost(web_contents_->GetMainFrame()); |
| 51 } else { | 51 } else { |
| 52 VLOG(1) << "AppWindow created in new process (" | 52 VLOG(1) << "AppWindow created in new process (" |
| 53 << web_contents_->GetMainFrame()->GetProcess()->GetID() | 53 << web_contents_->GetMainFrame()->GetProcess()->GetID() |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // TODO(devlin): This will need to change for site isolation. | 140 // TODO(devlin): This will need to change for site isolation. |
| 141 content::BrowserThread::PostTask( | 141 content::BrowserThread::PostTask( |
| 142 content::BrowserThread::IO, FROM_HERE, | 142 content::BrowserThread::IO, FROM_HERE, |
| 143 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute, | 143 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute, |
| 144 base::Unretained(content::ResourceDispatcherHost::Get()), | 144 base::Unretained(content::ResourceDispatcherHost::Get()), |
| 145 rfh->GetProcess()->GetID(), | 145 rfh->GetProcess()->GetID(), |
| 146 rfh->GetRenderViewHost()->GetRoutingID())); | 146 rfh->GetRenderViewHost()->GetRoutingID())); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace extensions | 149 } // namespace extensions |
| OLD | NEW |