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

Side by Side Diff: extensions/browser/app_window/app_window_contents.cc

Issue 1685003002: Plumb the correct owner document through DocumentInit::m_owner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 "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"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/render_frame_host.h" 12 #include "content/public/browser/render_frame_host.h"
13 #include "content/public/browser/render_process_host.h" 13 #include "content/public/browser/render_process_host.h"
14 #include "content/public/browser/render_view_host.h" 14 #include "content/public/browser/render_view_host.h"
15 #include "content/public/browser/resource_dispatcher_host.h" 15 #include "content/public/browser/resource_dispatcher_host.h"
16 #include "content/public/browser/site_instance.h" 16 #include "content/public/browser/site_instance.h"
17 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "content/public/common/renderer_preferences.h" 18 #include "content/public/common/renderer_preferences.h"
19 #include "extensions/browser/app_window/native_app_window.h" 19 #include "extensions/browser/app_window/native_app_window.h"
20 #include "extensions/common/extension_messages.h" 20 #include "extensions/common/extension_messages.h"
21 21
22 namespace extensions { 22 namespace extensions {
23 23
24 AppWindowContentsImpl::AppWindowContentsImpl(AppWindow* host) 24 AppWindowContentsImpl::AppWindowContentsImpl(AppWindow* host)
25 : host_(host), is_blocking_requests_(false), is_window_ready_(false) {} 25 : host_(host), is_blocking_requests_(false), is_window_ready_(false) {}
26 26
27 AppWindowContentsImpl::~AppWindowContentsImpl() {} 27 AppWindowContentsImpl::~AppWindowContentsImpl() {}
28 28
29 void AppWindowContentsImpl::Initialize(content::BrowserContext* context, 29 void AppWindowContentsImpl::Initialize(content::BrowserContext* context,
30 content::RenderFrameHost* creator_frame,
30 const GURL& url) { 31 const GURL& url) {
31 url_ = url; 32 url_ = url;
32 33
33 web_contents_.reset( 34 content::WebContents::CreateParams create_params(
34 content::WebContents::Create(content::WebContents::CreateParams( 35 context, creator_frame->GetSiteInstance());
35 context, content::SiteInstance::CreateForURL(context, url_)))); 36 create_params.opener_render_process_id = creator_frame->GetProcess()->GetID();
37 create_params.opener_render_frame_id = creator_frame->GetRoutingID();
38 web_contents_.reset(content::WebContents::Create(create_params));
36 39
37 Observe(web_contents_.get()); 40 Observe(web_contents_.get());
38 web_contents_->GetMutableRendererPrefs()-> 41 web_contents_->GetMutableRendererPrefs()->
39 browser_handles_all_top_level_requests = true; 42 browser_handles_all_top_level_requests = true;
40 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); 43 web_contents_->GetRenderViewHost()->SyncRendererPrefs();
41 } 44 }
42 45
43 void AppWindowContentsImpl::LoadContents(int32_t creator_process_id) { 46 void AppWindowContentsImpl::LoadContents(int32_t creator_process_id) {
44 // If the new view is in the same process as the creator, block the created 47 // 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 48 // RVH from loading anything until the background page has had a chance to
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 content::RenderFrameHost* rfh) { 130 content::RenderFrameHost* rfh) {
128 DCHECK(rfh); 131 DCHECK(rfh);
129 // Don't bother blocking requests if the renderer side is already good to go. 132 // Don't bother blocking requests if the renderer side is already good to go.
130 if (is_window_ready_) 133 if (is_window_ready_)
131 return; 134 return;
132 is_blocking_requests_ = true; 135 is_blocking_requests_ = true;
133 content::ResourceDispatcherHost::BlockRequestsForFrameFromUI(rfh); 136 content::ResourceDispatcherHost::BlockRequestsForFrameFromUI(rfh);
134 } 137 }
135 138
136 } // namespace extensions 139 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698