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

Unified Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 13032003: Browser Plugin: <webview> should inherit partition attribute of opener on attachment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/browser_plugin/browser_plugin_guest.cc
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index 973408fbd476f1fa1a1d651c24368d9a7ca8a06c..b3f4dfec0cf7e7d499e2f4afe010a1c357fecb79 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -120,7 +120,8 @@ BrowserPluginGuest::BrowserPluginGuest(
pending_lock_request_(false),
embedder_visible_(true),
opener_(NULL),
- next_permission_request_id_(0) {
+ next_permission_request_id_(0),
+ persist_storage_(false) {
DCHECK(web_contents);
web_contents->SetDelegate(this);
GetWebContents()->GetBrowserPluginGuestManager()->AddGuest(instance_id_,
@@ -191,6 +192,10 @@ void BrowserPluginGuest::Initialize(
auto_size_enabled_ = params.auto_size_params.enable;
max_auto_size_ = params.auto_size_params.max_size;
min_auto_size_ = params.auto_size_params.min_size;
+ if (!params.storage_partition_id.empty()) {
+ storage_partition_id_ = params.storage_partition_id;
+ persist_storage_ = params.persist_storage;
+ }
// Once a BrowserPluginGuest has an embedder WebContents, it's considered to
// be attached.
@@ -697,6 +702,10 @@ void BrowserPluginGuest::Attach(
// lifetime of the new guest is no longer managed by the opener guest.
opener()->pending_new_windows_.erase(this);
+ // The new window inherits the opener's storage partition.
+ storage_partition_id_ = opener()->storage_partition_id_;
+ persist_storage_ = opener()->persist_storage_;
Charlie Reis 2013/03/26 17:02:32 The partition name and whether it is persistent is
Fady Samuel 2013/03/26 17:15:40 I thought about that. The issue is BrowserPluginGu
Charlie Reis 2013/03/26 17:49:30 I'm not happy with having a separate copy of these
+
// The guest's frame name takes precedence over the BrowserPlugin's name.
// The guest's frame name is assigned in
// BrowserPluginGuest::WebContentsCreated.
@@ -713,11 +722,13 @@ void BrowserPluginGuest::Attach(
GetWebContents()->GetRenderViewHost())->Init();
}
- // Inform the embedder BrowserPlugin of the attached guest.
- if (!name_.empty()) {
- SendMessageToEmbedder(
- new BrowserPluginMsg_UpdatedName(instance_id_, name_));
- }
+ // Inform the embedder of the guest's information.
+ BrowserPluginMsg_Attach_ACK_Params ack_params;
+ ack_params.storage_partition_id = storage_partition_id_;
+ ack_params.persist_storage = persist_storage_;
+ ack_params.name = name_;
+ SendMessageToEmbedder(
+ new BrowserPluginMsg_Attach_ACK(instance_id_, ack_params));
Charlie Reis 2013/03/26 17:02:32 I don't understand why we need to send these in th
Fady Samuel 2013/03/26 17:15:40 No, the BrowserPlugin is a pre-existing BrowserPlu
Charlie Reis 2013/03/26 17:49:30 So the guest is already created in the correct par
}
void BrowserPluginGuest::OnDragStatusUpdate(int instance_id,

Powered by Google App Engine
This is Rietveld 408576698