Chromium Code Reviews| Index: content/browser/browser_plugin/browser_plugin_embedder.cc |
| diff --git a/content/browser/browser_plugin/browser_plugin_embedder.cc b/content/browser/browser_plugin/browser_plugin_embedder.cc |
| index abdde143de2e21e2cbeac70838a506ff710fb414..7e283fe4e2ec92c3a93bda09912d34cb80c8e98f 100644 |
| --- a/content/browser/browser_plugin/browser_plugin_embedder.cc |
| +++ b/content/browser/browser_plugin/browser_plugin_embedder.cc |
| @@ -21,6 +21,7 @@ |
| #include "content/public/browser/notification_types.h" |
| #include "content/public/browser/web_contents_view.h" |
| #include "content/public/common/url_constants.h" |
| +#include "net/base/escape.h" |
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| #include "ui/gfx/size.h" |
| #include "ui/surface/transport_dib.h" |
| @@ -88,11 +89,30 @@ void BrowserPluginEmbedder::CreateGuest(RenderViewHost* render_view_host, |
| BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); |
| CHECK(!guest); |
| + // Validate that the partition id coming from the renderer is valid UTF-8, |
| + // since we depend on this in other parts of the code, such as FilePath |
| + // creation. |
| + CHECK(IsStringUTF8(storage_partition_id)); |
|
Charlie Reis
2012/11/06 00:17:18
Sanity check: Is crashing the browser process the
nasko
2012/11/07 00:33:57
Done.
|
| + |
| const std::string& host = |
| render_view_host->GetSiteInstance()->GetSiteURL().host(); |
| + std::string url_encoded_partition = |
| + net::EscapeQueryParamValue(storage_partition_id, false); |
| + |
| + // The SiteInstance of a given webview tag is based on the fact that it's a |
| + // guest process in addition to which platform application the tag belongs to |
| + // and what storage partition is in use, rather than the URL that the tag is |
| + // being navigated to. |
| + GURL guest_site( |
| + base::StringPrintf("%s://%s/%s?%s", chrome::kGuestScheme, |
| + host.c_str(), persist_storage ? "persist" : "", |
| + url_encoded_partition.c_str())); |
| + SiteInstance* guest_site_instance = SiteInstance::CreateForURL( |
|
Charlie Reis
2012/11/06 00:17:18
Not important for this CL, but if I understand cor
nasko
2012/11/06 01:21:52
Yes. It is not done yet, I will do it in a follow
|
| + web_contents()->GetBrowserContext(), guest_site); |
| + |
| guest_web_contents = WebContentsImpl::CreateGuest( |
| web_contents()->GetBrowserContext(), |
| - host, |
| + guest_site_instance, |
| instance_id, |
| focused, |
| visible); |