Chromium Code Reviews| 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_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" |
| 11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "content/browser/browser_plugin/browser_plugin_embedder_helper.h" | 12 #include "content/browser/browser_plugin/browser_plugin_embedder_helper.h" |
| 13 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 13 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| 14 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" | 14 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" |
| 15 #include "content/browser/renderer_host/render_view_host_impl.h" | 15 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 16 #include "content/browser/web_contents/web_contents_impl.h" | 16 #include "content/browser/web_contents/web_contents_impl.h" |
| 17 #include "content/common/browser_plugin_messages.h" | 17 #include "content/common/browser_plugin_messages.h" |
| 18 #include "content/public/browser/notification_details.h" | 18 #include "content/public/browser/notification_details.h" |
| 19 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
| 20 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
| 21 #include "content/public/browser/notification_types.h" | 21 #include "content/public/browser/notification_types.h" |
| 22 #include "content/public/browser/web_contents_view.h" | 22 #include "content/public/browser/web_contents_view.h" |
| 23 #include "content/public/common/url_constants.h" | 23 #include "content/public/common/url_constants.h" |
| 24 #include "net/base/escape.h" | |
| 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 25 #include "ui/gfx/size.h" | 26 #include "ui/gfx/size.h" |
| 26 #include "ui/surface/transport_dib.h" | 27 #include "ui/surface/transport_dib.h" |
| 27 | 28 |
| 28 namespace content { | 29 namespace content { |
| 29 | 30 |
| 30 // static | 31 // static |
| 31 BrowserPluginHostFactory* BrowserPluginEmbedder::factory_ = NULL; | 32 BrowserPluginHostFactory* BrowserPluginEmbedder::factory_ = NULL; |
| 32 | 33 |
| 33 BrowserPluginEmbedder::BrowserPluginEmbedder( | 34 BrowserPluginEmbedder::BrowserPluginEmbedder( |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 std::string storage_partition_id, | 84 std::string storage_partition_id, |
| 84 bool persist_storage, | 85 bool persist_storage, |
| 85 bool focused, | 86 bool focused, |
| 86 bool visible) { | 87 bool visible) { |
| 87 WebContentsImpl* guest_web_contents = NULL; | 88 WebContentsImpl* guest_web_contents = NULL; |
| 88 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); | 89 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); |
| 89 CHECK(!guest); | 90 CHECK(!guest); |
| 90 | 91 |
| 91 const std::string& host = | 92 const std::string& host = |
| 92 render_view_host->GetSiteInstance()->GetSiteURL().host(); | 93 render_view_host->GetSiteInstance()->GetSiteURL().host(); |
| 94 std::string url_encoded_partition = | |
| 95 net::EscapeQueryParamValue(storage_partition_id, false); | |
| 96 | |
| 97 // The SiteInstance of a given webview tag is based on the fact that it's a | |
| 98 // guest process in addition to which platform application the tag belongs to | |
| 99 // and what storage partition is in use, rather than the URL that the tag is | |
| 100 // being navigated to. | |
|
awong
2012/11/02 21:56:13
Is this logic better here, or in a SiteInstance::C
nasko
2012/11/03 00:36:24
Since we use it only here, I'd rather not introduc
| |
| 101 GURL guest_site( | |
| 102 base::StringPrintf("%s://%s/%s?%s", chrome::kGuestScheme, | |
| 103 host.c_str(), persist_storage ? "persist" : "", | |
|
awong
2012/11/02 21:56:13
put persist into constant?
nasko
2012/11/03 00:36:24
If I put it into a constant, I have to do a lookup
| |
| 104 url_encoded_partition.c_str())); | |
| 105 SiteInstance* guest_site_instance = SiteInstance::CreateForURL( | |
| 106 web_contents()->GetBrowserContext(), guest_site); | |
| 107 | |
| 93 guest_web_contents = WebContentsImpl::CreateGuest( | 108 guest_web_contents = WebContentsImpl::CreateGuest( |
| 94 web_contents()->GetBrowserContext(), | 109 web_contents()->GetBrowserContext(), |
| 95 host, | 110 guest_site_instance, |
| 96 instance_id, | 111 instance_id, |
| 97 focused, | 112 focused, |
| 98 visible); | 113 visible); |
| 99 | 114 |
| 100 guest = guest_web_contents->GetBrowserPluginGuest(); | 115 guest = guest_web_contents->GetBrowserPluginGuest(); |
| 101 guest->set_embedder_web_contents( | 116 guest->set_embedder_web_contents( |
| 102 static_cast<WebContentsImpl*>(web_contents())); | 117 static_cast<WebContentsImpl*>(web_contents())); |
| 103 | 118 |
| 104 RendererPreferences* guest_renderer_prefs = | 119 RendererPreferences* guest_renderer_prefs = |
| 105 guest_web_contents->GetMutableRendererPrefs(); | 120 guest_web_contents->GetMutableRendererPrefs(); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 bool visible = *Details<bool>(details).ptr(); | 349 bool visible = *Details<bool>(details).ptr(); |
| 335 WebContentsVisibilityChanged(visible); | 350 WebContentsVisibilityChanged(visible); |
| 336 break; | 351 break; |
| 337 } | 352 } |
| 338 default: | 353 default: |
| 339 NOTREACHED() << "Unexpected notification type: " << type; | 354 NOTREACHED() << "Unexpected notification type: " << type; |
| 340 } | 355 } |
| 341 } | 356 } |
| 342 | 357 |
| 343 } // namespace content | 358 } // namespace content |
| OLD | NEW |