summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_plugin/browser_plugin_embedder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'content/browser/browser_plugin/browser_plugin_embedder.cc')
-rw-r--r--content/browser/browser_plugin/browser_plugin_embedder.cc75
1 files changed, 1 insertions, 74 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_embedder.cc b/content/browser/browser_plugin/browser_plugin_embedder.cc
index 7031f47..ccd53e5 100644
--- a/content/browser/browser_plugin/browser_plugin_embedder.cc
+++ b/content/browser/browser_plugin/browser_plugin_embedder.cc
@@ -12,10 +12,6 @@
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/browser_plugin_messages.h"
#include "content/common/gpu/gpu_messages.h"
-#include "content/public/browser/notification_details.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_source.h"
-#include "content/public/browser/notification_types.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.h"
@@ -32,14 +28,8 @@ BrowserPluginEmbedder::BrowserPluginEmbedder(
RenderViewHost* render_view_host)
: WebContentsObserver(web_contents),
render_view_host_(render_view_host),
- visible_(true),
next_get_render_view_request_id_(0),
next_instance_id_(0) {
- // Listen to visibility changes so that an embedder hides its guests
- // as well.
- registrar_.Add(this,
- NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED,
- Source<WebContents>(web_contents));
}
BrowserPluginEmbedder::~BrowserPluginEmbedder() {
@@ -138,52 +128,15 @@ void BrowserPluginEmbedder::CreateGuest(
web_contents()->GetBrowserContext(),
guest_site_instance,
routing_id,
+ static_cast<WebContentsImpl*>(web_contents()),
opener_web_contents,
instance_id,
params);
guest = guest_web_contents->GetBrowserPluginGuest();
- guest->set_embedder_web_contents(
- static_cast<WebContentsImpl*>(web_contents()));
-
- RendererPreferences* guest_renderer_prefs =
- guest_web_contents->GetMutableRendererPrefs();
- // Copy renderer preferences (and nothing else) from the embedder's
- // TabContents to the guest.
- //
- // For GTK and Aura this is necessary to get proper renderer configuration
- // values for caret blinking interval, colors related to selection and
- // focus.
- *guest_renderer_prefs = *web_contents()->GetMutableRendererPrefs();
-
- guest_renderer_prefs->throttle_input_events = false;
- // We would like the guest to report changes to frame names so that we can
- // update the BrowserPlugin's corresponding 'name' attribute.
- // TODO(fsamuel): Remove this once http://crbug.com/169110 is addressed.
- guest_renderer_prefs->report_frame_name_changes = true;
- // Navigation is disabled in Chrome Apps. We want to make sure guest-initiated
- // navigations still continue to function inside the app.
- guest_renderer_prefs->browser_handles_all_top_level_requests = false;
AddGuest(instance_id, guest_web_contents);
- guest_web_contents->SetDelegate(guest);
-
- // Create a swapped out RenderView for the guest in the embedder render
- // process, so that the embedder can access the guest's window object.
- int guest_routing_id =
- static_cast<WebContentsImpl*>(guest->GetWebContents())->
- CreateSwappedOutRenderView(web_contents()->GetSiteInstance());
- render_view_host_->Send(new BrowserPluginMsg_GuestContentWindowReady(
- render_view_host_->GetRoutingID(), instance_id, guest_routing_id));
guest->Initialize(params, guest_web_contents->GetRenderViewHost());
-
- if (params.src.empty())
- return;
-
- BrowserPluginHostMsg_NavigateGuest navigate_msg(
- render_view_host_->GetRoutingID(), instance_id, params.src);
- GetGuestByInstanceID(instance_id)->
- OnMessageReceivedFromEmbedder(navigate_msg);
}
BrowserPluginGuest* BrowserPluginEmbedder::GetGuestByInstanceID(
@@ -255,20 +208,6 @@ bool BrowserPluginEmbedder::OnMessageReceived(const IPC::Message& message) {
return handled;
}
-void BrowserPluginEmbedder::Observe(int type,
- const NotificationSource& source,
- const NotificationDetails& details) {
- switch (type) {
- case NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED: {
- bool visible = *Details<bool>(details).ptr();
- WebContentsVisibilityChanged(visible);
- break;
- }
- default:
- NOTREACHED() << "Unexpected notification type: " << type;
- }
-}
-
void BrowserPluginEmbedder::AddGuest(int instance_id,
WebContents* guest_web_contents) {
DCHECK(guest_web_contents_by_instance_id_.find(instance_id) ==
@@ -289,18 +228,6 @@ void BrowserPluginEmbedder::CleanUp() {
pending_get_render_view_callbacks_.clear();
}
-void BrowserPluginEmbedder::WebContentsVisibilityChanged(bool visible) {
- visible_ = visible;
- // If the embedder is hidden we need to hide the guests as well.
- for (ContainerInstanceMap::const_iterator it =
- guest_web_contents_by_instance_id_.begin();
- it != guest_web_contents_by_instance_id_.end(); ++it) {
- WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(it->second);
- BrowserPluginGuest* guest = web_contents->GetBrowserPluginGuest();
- guest->UpdateVisibility();
- }
-}
-
// static
bool BrowserPluginEmbedder::ShouldForwardToBrowserPluginGuest(
const IPC::Message& message) {