OLD | NEW |
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_guest.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 Initialize(embedder_web_contents, params); | 745 Initialize(embedder_web_contents, params); |
746 | 746 |
747 // We initialize the RenderViewHost after a BrowserPlugin has been attached | 747 // We initialize the RenderViewHost after a BrowserPlugin has been attached |
748 // to it and is ready to receive pixels. Until a RenderViewHost is | 748 // to it and is ready to receive pixels. Until a RenderViewHost is |
749 // initialized, it will not allow any resize requests. | 749 // initialized, it will not allow any resize requests. |
750 if (!GetWebContents()->GetRenderViewHost()->IsRenderViewLive()) { | 750 if (!GetWebContents()->GetRenderViewHost()->IsRenderViewLive()) { |
751 static_cast<RenderViewHostImpl*>( | 751 static_cast<RenderViewHostImpl*>( |
752 GetWebContents()->GetRenderViewHost())->Init(); | 752 GetWebContents()->GetRenderViewHost())->Init(); |
753 } | 753 } |
754 | 754 |
755 // Inform the embedder BrowserPlugin of the attached guest. | 755 // Inform the embedder of the guest's information. |
756 if (!name_.empty()) { | 756 // We pull the partition information from the site's URL, which is of the form |
757 SendMessageToEmbedder( | 757 // guest://site/{persist}?{partition_name}. |
758 new BrowserPluginMsg_UpdatedName(instance_id_, name_)); | 758 const GURL& site_url = GetWebContents()->GetSiteInstance()->GetSiteURL(); |
759 } | 759 BrowserPluginMsg_Attach_ACK_Params ack_params; |
| 760 ack_params.storage_partition_id = site_url.query(); |
| 761 ack_params.persist_storage = |
| 762 site_url.path().find("persist") != std::string::npos; |
| 763 ack_params.name = name_; |
| 764 SendMessageToEmbedder( |
| 765 new BrowserPluginMsg_Attach_ACK(instance_id_, ack_params)); |
760 } | 766 } |
761 | 767 |
762 void BrowserPluginGuest::OnCompositorFrameACK( | 768 void BrowserPluginGuest::OnCompositorFrameACK( |
763 int instance_id, | 769 int instance_id, |
764 int route_id, | 770 int route_id, |
765 int renderer_host_id, | 771 int renderer_host_id, |
766 const cc::CompositorFrameAck& ack) { | 772 const cc::CompositorFrameAck& ack) { |
767 RenderWidgetHostImpl::SendSwapCompositorFrameAck(route_id, | 773 RenderWidgetHostImpl::SendSwapCompositorFrameAck(route_id, |
768 renderer_host_id, | 774 renderer_host_id, |
769 ack); | 775 ack); |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 base::Value::CreateStringValue(request_method)); | 1323 base::Value::CreateStringValue(request_method)); |
1318 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); | 1324 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); |
1319 | 1325 |
1320 SendMessageToEmbedder( | 1326 SendMessageToEmbedder( |
1321 new BrowserPluginMsg_RequestPermission(instance_id(), | 1327 new BrowserPluginMsg_RequestPermission(instance_id(), |
1322 BrowserPluginPermissionTypeDownload, permission_request_id, | 1328 BrowserPluginPermissionTypeDownload, permission_request_id, |
1323 request_info)); | 1329 request_info)); |
1324 } | 1330 } |
1325 | 1331 |
1326 } // namespace content | 1332 } // namespace content |
OLD | NEW |