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

Side by Side Diff: chrome/browser/background/background_contents.cc

Issue 2882513005: Propagate opener to BackgroundsContents. (Closed)
Patch Set: Tweaked the comment in DriveWebContentsManager::ShouldCreateWebContents Created 3 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/background/background_contents.h" 5 #include "chrome/browser/background/background_contents.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/profiler/scoped_tracker.h" 9 #include "base/profiler/scoped_tracker.h"
10 #include "chrome/browser/background/background_contents_service.h" 10 #include "chrome/browser/background/background_contents_service.h"
11 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/data_use_measurement/data_use_web_contents_observer.h" 12 #include "chrome/browser/data_use_measurement/data_use_web_contents_observer.h"
13 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 13 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/renderer_preferences_util.h" 15 #include "chrome/browser/renderer_preferences_util.h"
16 #include "chrome/browser/task_manager/web_contents_tags.h" 16 #include "chrome/browser/task_manager/web_contents_tags.h"
17 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" 17 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
18 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
19 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
20 #include "content/public/browser/render_frame_host.h"
21 #include "content/public/browser/render_process_host.h"
20 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
21 #include "content/public/browser/session_storage_namespace.h" 23 #include "content/public/browser/session_storage_namespace.h"
22 #include "content/public/browser/site_instance.h" 24 #include "content/public/browser/site_instance.h"
23 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
24 #include "extensions/browser/deferred_start_render_host_observer.h" 26 #include "extensions/browser/deferred_start_render_host_observer.h"
25 #include "extensions/browser/extension_host_delegate.h" 27 #include "extensions/browser/extension_host_delegate.h"
26 #include "extensions/browser/extension_host_queue.h" 28 #include "extensions/browser/extension_host_queue.h"
27 #include "extensions/browser/extensions_browser_client.h" 29 #include "extensions/browser/extensions_browser_client.h"
28 #include "extensions/browser/view_type_utils.h" 30 #include "extensions/browser/view_type_utils.h"
29 #include "ui/gfx/geometry/rect.h" 31 #include "ui/gfx/geometry/rect.h"
30 32
31 using content::SiteInstance; 33 using content::SiteInstance;
32 using content::WebContents; 34 using content::WebContents;
33 35
34 BackgroundContents::BackgroundContents( 36 BackgroundContents::BackgroundContents(
35 scoped_refptr<SiteInstance> site_instance, 37 scoped_refptr<SiteInstance> site_instance,
38 content::RenderFrameHost* opener,
36 int32_t routing_id, 39 int32_t routing_id,
37 int32_t main_frame_routing_id, 40 int32_t main_frame_routing_id,
38 int32_t main_frame_widget_routing_id, 41 int32_t main_frame_widget_routing_id,
39 Delegate* delegate, 42 Delegate* delegate,
40 const std::string& partition_id, 43 const std::string& partition_id,
41 content::SessionStorageNamespace* session_storage_namespace) 44 content::SessionStorageNamespace* session_storage_namespace)
42 : delegate_(delegate), 45 : delegate_(delegate),
43 extension_host_delegate_(extensions::ExtensionsBrowserClient::Get() 46 extension_host_delegate_(extensions::ExtensionsBrowserClient::Get()
44 ->CreateExtensionHostDelegate()) { 47 ->CreateExtensionHostDelegate()) {
45 profile_ = Profile::FromBrowserContext( 48 profile_ = Profile::FromBrowserContext(
46 site_instance->GetBrowserContext()); 49 site_instance->GetBrowserContext());
47 50
48 WebContents::CreateParams create_params(profile_, std::move(site_instance)); 51 WebContents::CreateParams create_params(profile_, std::move(site_instance));
52 create_params.opener_render_process_id =
53 opener ? opener->GetProcess()->GetID() : MSG_ROUTING_NONE;
54 create_params.opener_render_frame_id =
55 opener ? opener->GetRoutingID() : MSG_ROUTING_NONE;
49 create_params.routing_id = routing_id; 56 create_params.routing_id = routing_id;
50 create_params.main_frame_routing_id = main_frame_routing_id; 57 create_params.main_frame_routing_id = main_frame_routing_id;
51 create_params.main_frame_widget_routing_id = main_frame_widget_routing_id; 58 create_params.main_frame_widget_routing_id = main_frame_widget_routing_id;
52 create_params.renderer_initiated_creation = routing_id != MSG_ROUTING_NONE; 59 create_params.renderer_initiated_creation = routing_id != MSG_ROUTING_NONE;
53 if (session_storage_namespace) { 60 if (session_storage_namespace) {
54 content::SessionStorageNamespaceMap session_storage_namespace_map; 61 content::SessionStorageNamespaceMap session_storage_namespace_map;
55 session_storage_namespace_map.insert( 62 session_storage_namespace_map.insert(
56 std::make_pair(partition_id, session_storage_namespace)); 63 std::make_pair(partition_id, session_storage_namespace));
57 web_contents_.reset(WebContents::CreateWithSessionStorage( 64 web_contents_.reset(WebContents::CreateWithSessionStorage(
58 create_params, session_storage_namespace_map)); 65 create_params, session_storage_namespace_map));
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 223
217 void BackgroundContents::AddDeferredStartRenderHostObserver( 224 void BackgroundContents::AddDeferredStartRenderHostObserver(
218 extensions::DeferredStartRenderHostObserver* observer) { 225 extensions::DeferredStartRenderHostObserver* observer) {
219 deferred_start_render_host_observer_list_.AddObserver(observer); 226 deferred_start_render_host_observer_list_.AddObserver(observer);
220 } 227 }
221 228
222 void BackgroundContents::RemoveDeferredStartRenderHostObserver( 229 void BackgroundContents::RemoveDeferredStartRenderHostObserver(
223 extensions::DeferredStartRenderHostObserver* observer) { 230 extensions::DeferredStartRenderHostObserver* observer) {
224 deferred_start_render_host_observer_list_.RemoveObserver(observer); 231 deferred_start_render_host_observer_list_.RemoveObserver(observer);
225 } 232 }
OLDNEW
« no previous file with comments | « chrome/browser/background/background_contents.h ('k') | chrome/browser/background/background_contents_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698