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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_embedder.cc

Issue 10978028: Propagate storage partition id and persistence to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
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 "content/browser/browser_plugin/browser_plugin_embedder.h" 5 #include "content/browser/browser_plugin/browser_plugin_embedder.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 void BrowserPluginEmbedder::AddGuest(int instance_id, 72 void BrowserPluginEmbedder::AddGuest(int instance_id,
73 WebContents* guest_web_contents, 73 WebContents* guest_web_contents,
74 int64 frame_id) { 74 int64 frame_id) {
75 DCHECK(guest_web_contents_by_instance_id_.find(instance_id) == 75 DCHECK(guest_web_contents_by_instance_id_.find(instance_id) ==
76 guest_web_contents_by_instance_id_.end()); 76 guest_web_contents_by_instance_id_.end());
77 guest_web_contents_by_instance_id_[instance_id] = guest_web_contents; 77 guest_web_contents_by_instance_id_[instance_id] = guest_web_contents;
78 } 78 }
79 79
80 void BrowserPluginEmbedder::CreateGuest(RenderViewHost* render_view_host,
81 int instance_id,
82 int64 frame_id,
83 std::string storage_partition_id,
84 bool persist_storage) {
Fady Samuel 2012/09/25 19:22:40 Hmm, this isn't actually used yet?
nasko 2012/09/25 22:57:22 Yes, as per our discussion, this will be a smaller
Fady Samuel 2012/09/25 23:04:38 sgtm.
85 WebContentsImpl* guest_web_contents = NULL;
86 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id);
87 CHECK(!guest);
88
89 const std::string& host =
90 render_view_host->GetSiteInstance()->GetSite().host();
91 guest_web_contents = WebContentsImpl::CreateGuest(
92 web_contents()->GetBrowserContext(),
93 host,
94 instance_id);
95
96 guest = guest_web_contents->GetBrowserPluginGuest();
97 guest->set_embedder_render_process_host(render_view_host->GetProcess());
98
99 guest_web_contents->GetMutableRendererPrefs()->throttle_input_events = false;
100 AddGuest(instance_id, guest_web_contents, frame_id);
101 guest_web_contents->SetDelegate(guest);
102 }
103
80 void BrowserPluginEmbedder::NavigateGuest(RenderViewHost* render_view_host, 104 void BrowserPluginEmbedder::NavigateGuest(RenderViewHost* render_view_host,
81 int instance_id, 105 int instance_id,
82 int64 frame_id, 106 int64 frame_id,
83 const std::string& src, 107 const std::string& src,
84 const gfx::Size& size) { 108 const gfx::Size& size) {
109 GURL url(src);
85 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); 110 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id);
86 WebContentsImpl* guest_web_contents = NULL; 111 CHECK(guest);
87 GURL url(src); 112 WebContentsImpl* guest_web_contents =
88 if (!guest) { 113 static_cast<WebContentsImpl*>(guest->GetWebContents());
89 const std::string& host =
90 render_view_host->GetSiteInstance()->GetSite().host();
91 guest_web_contents = WebContentsImpl::CreateGuest(
92 web_contents()->GetBrowserContext(),
93 host,
94 instance_id);
95
96 guest = guest_web_contents->GetBrowserPluginGuest();
97 guest->set_embedder_render_process_host(
98 render_view_host->GetProcess());
99
100 guest_web_contents->GetMutableRendererPrefs()->
101 throttle_input_events = false;
102 AddGuest(instance_id, guest_web_contents, frame_id);
103 guest_web_contents->SetDelegate(guest);
104 } else {
105 guest_web_contents =
106 static_cast<WebContentsImpl*>(guest->GetWebContents());
107 }
108 114
109 // We ignore loading empty urls in web_contents. 115 // We ignore loading empty urls in web_contents.
110 // If a guest sets empty src attribute after it has navigated to some 116 // If a guest sets empty src attribute after it has navigated to some
111 // non-empty page, the action is considered no-op. 117 // non-empty page, the action is considered no-op.
112 // TODO(lazyboy): The js shim for browser-plugin might need to reflect empty 118 // TODO(lazyboy): The js shim for browser-plugin might need to reflect empty
113 // src ignoring in the shadow DOM element: http://crbug.com/149001. 119 // src ignoring in the shadow DOM element: http://crbug.com/149001.
114 if (!src.empty()) { 120 if (!src.empty()) {
115 guest_web_contents->GetController().LoadURL(url, 121 guest_web_contents->GetController().LoadURL(url,
116 Referrer(), 122 Referrer(),
117 PAGE_TRANSITION_AUTO_SUBFRAME, 123 PAGE_TRANSITION_AUTO_SUBFRAME,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 bool visible = *Details<bool>(details).ptr(); 241 bool visible = *Details<bool>(details).ptr();
236 WebContentsVisibilityChanged(visible); 242 WebContentsVisibilityChanged(visible);
237 break; 243 break;
238 } 244 }
239 default: 245 default:
240 NOTREACHED() << "Unexpected notification type: " << type; 246 NOTREACHED() << "Unexpected notification type: " << type;
241 } 247 }
242 } 248 }
243 249
244 } // namespace content 250 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698