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

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

Issue 261013005: BrowserPlugin: Move CreateGuest to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@guestview_manager_simplify_api
Patch Set: Created 6 years, 8 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_manager.cc
diff --git a/content/browser/browser_plugin/browser_plugin_guest_manager.cc b/content/browser/browser_plugin/browser_plugin_guest_manager.cc
index 5c9fa9f7608a75d8087ae9a2b5902f7a89b026c4..62d01e38469f890288a68b5a4035590f4d2ff39c 100644
--- a/content/browser/browser_plugin/browser_plugin_guest_manager.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest_manager.cc
@@ -70,55 +70,18 @@ int BrowserPluginGuestManager::GetNextInstanceID() {
BrowserPluginGuest* BrowserPluginGuestManager::CreateGuest(
SiteInstance* embedder_site_instance,
int instance_id,
- const BrowserPluginHostMsg_Attach_Params& params,
+ const StorageInfo& storage_info,
scoped_ptr<base::DictionaryValue> extra_params) {
- RenderProcessHost* embedder_process_host =
- embedder_site_instance->GetProcess();
- // 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. If the validation fails, treat it as a bad message and kill the
- // renderer process.
- if (!IsStringUTF8(params.storage_partition_id)) {
- content::RecordAction(
- base::UserMetricsAction("BadMessageTerminate_BPGM"));
- base::KillProcess(
- embedder_process_host->GetHandle(),
- content::RESULT_CODE_KILLED_BAD_MESSAGE, false);
+ if (!GetDelegate())
return NULL;
- }
-
- const GURL& embedder_site_url = embedder_site_instance->GetSiteURL();
- const std::string& host = embedder_site_url.host();
-
- std::string url_encoded_partition = net::EscapeQueryParamValue(
- params.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",
- kGuestScheme,
- host.c_str(),
- params.persist_storage ? "persist" : "",
- url_encoded_partition.c_str()));
-
- // If we already have a webview tag in the same app using the same storage
- // partition, we should use the same SiteInstance so the existing tag and
- // the new tag can script each other.
- SiteInstance* guest_site_instance = GetGuestSiteInstance(guest_site);
- if (!guest_site_instance) {
- // Create the SiteInstance in a new BrowsingInstance, which will ensure
- // that webview tags are also not allowed to send messages across
- // different partitions.
- guest_site_instance = SiteInstance::CreateForURL(
- embedder_site_instance->GetBrowserContext(), guest_site);
- }
-
- return WebContentsImpl::CreateGuest(
- embedder_site_instance->GetBrowserContext(),
- guest_site_instance,
- instance_id,
- extra_params.Pass());
+ WebContents* guest_web_contents =
+ GetDelegate()->CreateGuest(embedder_site_instance,
+ instance_id,
+ storage_info,
+ extra_params.Pass());
+
+ return static_cast<WebContentsImpl*>(guest_web_contents)->
+ GetBrowserPluginGuest();
}
static void BrowserPluginGuestByInstanceIDCallback(
@@ -180,13 +143,6 @@ void BrowserPluginGuestManager::OnMessageReceived(const IPC::Message& message,
message));
}
-SiteInstance* BrowserPluginGuestManager::GetGuestSiteInstance(
- const GURL& guest_site) {
- if (!GetDelegate())
- return NULL;
- return GetDelegate()->GetGuestSiteInstance(guest_site);
-}
-
static bool BrowserPluginGuestCallback(
const BrowserPluginGuestManager::GuestCallback& callback,
WebContents* guest_web_contents) {
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest_manager.h ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698