Commit 0d05a158 authored by fsamuel@chromium.org's avatar fsamuel@chromium.org

Remove BrowserPluginGuestManager

This CL removes BrowserPluginGuestManager entirely, leaving BrowserPlugin relying on the BrowserPluginGuestManagerDelegate interface. This CL significantly reduces complexity in content.

In a subsequent patch, BrowserPluginGuestManagerDelegate will be renamed BrowserPluginGuestManager. I am leaving that separate so it is clear what's going on.

BUG=364141, 330264

Review URL: https://codereview.chromium.org/269113002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269680 0039d316-1c4b-4281-b951-d872f2087c98
parent d1b5295d
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "base/values.h" #include "base/values.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h" #include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/browser_plugin/browser_plugin_guest_manager.h"
#include "content/browser/browser_plugin/browser_plugin_host_factory.h" #include "content/browser/browser_plugin/browser_plugin_host_factory.h"
#include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_contents_impl.h"
...@@ -15,6 +14,7 @@ ...@@ -15,6 +14,7 @@
#include "content/common/drag_messages.h" #include "content/common/drag_messages.h"
#include "content/common/gpu/gpu_messages.h" #include "content/common/gpu/gpu_messages.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_plugin_guest_manager_delegate.h"
#include "content/public/browser/content_browser_client.h" #include "content/public/browser/content_browser_client.h"
#include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
...@@ -66,23 +66,21 @@ WebContentsImpl* BrowserPluginEmbedder::GetWebContents() const { ...@@ -66,23 +66,21 @@ WebContentsImpl* BrowserPluginEmbedder::GetWebContents() const {
return static_cast<WebContentsImpl*>(web_contents()); return static_cast<WebContentsImpl*>(web_contents());
} }
BrowserPluginGuestManager* BrowserPluginGuestManagerDelegate*
BrowserPluginEmbedder::GetBrowserPluginGuestManager() const { BrowserPluginEmbedder::GetBrowserPluginGuestManager() const {
return BrowserPluginGuestManager::FromBrowserContext( return GetWebContents()->GetBrowserContext()->GetGuestManagerDelegate();
GetWebContents()->GetBrowserContext());
} }
bool BrowserPluginEmbedder::DidSendScreenRectsCallback( bool BrowserPluginEmbedder::DidSendScreenRectsCallback(
BrowserPluginGuest* guest) { WebContents* guest_web_contents) {
static_cast<RenderViewHostImpl*>( static_cast<RenderViewHostImpl*>(
guest->GetWebContents()->GetRenderViewHost())->SendScreenRects(); guest_web_contents->GetRenderViewHost())->SendScreenRects();
// Not handled => Iterate over all guests. // Not handled => Iterate over all guests.
return false; return false;
} }
void BrowserPluginEmbedder::DidSendScreenRects() { void BrowserPluginEmbedder::DidSendScreenRects() {
BrowserPluginGuestManager::FromBrowserContext( GetBrowserPluginGuestManager()->ForEachGuest(
GetWebContents()->GetBrowserContext())->ForEachGuest(
GetWebContents(), base::Bind( GetWebContents(), base::Bind(
&BrowserPluginEmbedder::DidSendScreenRectsCallback, &BrowserPluginEmbedder::DidSendScreenRectsCallback,
base::Unretained(this))); base::Unretained(this)));
...@@ -90,8 +88,9 @@ void BrowserPluginEmbedder::DidSendScreenRects() { ...@@ -90,8 +88,9 @@ void BrowserPluginEmbedder::DidSendScreenRects() {
bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback( bool BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback(
const NativeWebKeyboardEvent& event, const NativeWebKeyboardEvent& event,
BrowserPluginGuest* guest) { WebContents* guest_web_contents) {
return guest->UnlockMouseIfNecessary(event); return static_cast<WebContentsImpl*>(guest_web_contents)->
GetBrowserPluginGuest()->UnlockMouseIfNecessary(event);
} }
bool BrowserPluginEmbedder::HandleKeyboardEvent( bool BrowserPluginEmbedder::HandleKeyboardEvent(
...@@ -110,9 +109,10 @@ bool BrowserPluginEmbedder::HandleKeyboardEvent( ...@@ -110,9 +109,10 @@ bool BrowserPluginEmbedder::HandleKeyboardEvent(
} }
bool BrowserPluginEmbedder::SetZoomLevelCallback( bool BrowserPluginEmbedder::SetZoomLevelCallback(
double level, BrowserPluginGuest* guest) { double level, WebContents* guest_web_contents) {
double zoom_factor = content::ZoomLevelToZoomFactor(level); double zoom_factor = content::ZoomLevelToZoomFactor(level);
guest->SetZoom(zoom_factor); static_cast<WebContentsImpl*>(guest_web_contents)->GetBrowserPluginGuest()->
SetZoom(zoom_factor);
// Not handled => Iterate over all guests. // Not handled => Iterate over all guests.
return false; return false;
} }
...@@ -172,8 +172,10 @@ void BrowserPluginEmbedder::OnGuestCallback( ...@@ -172,8 +172,10 @@ void BrowserPluginEmbedder::OnGuestCallback(
int instance_id, int instance_id,
const BrowserPluginHostMsg_Attach_Params& params, const BrowserPluginHostMsg_Attach_Params& params,
const base::DictionaryValue* extra_params, const base::DictionaryValue* extra_params,
BrowserPluginGuest* guest) { WebContents* guest_web_contents) {
BrowserPluginGuestManager* guest_manager = GetBrowserPluginGuestManager(); BrowserPluginGuest* guest = guest_web_contents ?
static_cast<WebContentsImpl*>(guest_web_contents)->
GetBrowserPluginGuest() : NULL;
if (guest) { if (guest) {
// There is an implicit order expectation here: // There is an implicit order expectation here:
// 1. The content embedder is made aware of the attachment. // 1. The content embedder is made aware of the attachment.
...@@ -189,11 +191,15 @@ void BrowserPluginEmbedder::OnGuestCallback( ...@@ -189,11 +191,15 @@ void BrowserPluginEmbedder::OnGuestCallback(
} }
scoped_ptr<base::DictionaryValue> copy_extra_params(extra_params->DeepCopy()); scoped_ptr<base::DictionaryValue> copy_extra_params(extra_params->DeepCopy());
guest = guest_manager->CreateGuest(GetWebContents()->GetSiteInstance(), guest_web_contents = GetBrowserPluginGuestManager()->CreateGuest(
instance_id, GetWebContents()->GetSiteInstance(),
params.storage_partition_id, instance_id,
params.persist_storage, params.storage_partition_id,
copy_extra_params.Pass()); params.persist_storage,
copy_extra_params.Pass());
guest = guest_web_contents ?
static_cast<WebContentsImpl*>(guest_web_contents)->
GetBrowserPluginGuest() : NULL;
if (guest) { if (guest) {
GetContentClient()->browser()->GuestWebContentsAttached( GetContentClient()->browser()->GuestWebContentsAttached(
guest->GetWebContents(), guest->GetWebContents(),
......
...@@ -32,7 +32,7 @@ class Point; ...@@ -32,7 +32,7 @@ class Point;
namespace content { namespace content {
class BrowserPluginGuest; class BrowserPluginGuest;
class BrowserPluginGuestManager; class BrowserPluginGuestManagerDelegate;
class BrowserPluginHostFactory; class BrowserPluginHostFactory;
class RenderWidgetHostImpl; class RenderWidgetHostImpl;
class WebContentsImpl; class WebContentsImpl;
...@@ -88,21 +88,21 @@ class CONTENT_EXPORT BrowserPluginEmbedder : public WebContentsObserver { ...@@ -88,21 +88,21 @@ class CONTENT_EXPORT BrowserPluginEmbedder : public WebContentsObserver {
explicit BrowserPluginEmbedder(WebContentsImpl* web_contents); explicit BrowserPluginEmbedder(WebContentsImpl* web_contents);
BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; BrowserPluginGuestManagerDelegate* GetBrowserPluginGuestManager() const;
bool DidSendScreenRectsCallback(BrowserPluginGuest* guest); bool DidSendScreenRectsCallback(WebContents* guest_web_contents);
bool SetZoomLevelCallback(double level, BrowserPluginGuest* guest); bool SetZoomLevelCallback(double level, WebContents* guest_web_contents);
bool UnlockMouseIfNecessaryCallback(const NativeWebKeyboardEvent& event, bool UnlockMouseIfNecessaryCallback(const NativeWebKeyboardEvent& event,
BrowserPluginGuest* guest); WebContents* guest);
// Called by the content embedder when a guest exists with the provided // Called by the content embedder when a guest exists with the provided
// |instance_id|. // |instance_id|.
void OnGuestCallback(int instance_id, void OnGuestCallback(int instance_id,
const BrowserPluginHostMsg_Attach_Params& params, const BrowserPluginHostMsg_Attach_Params& params,
const base::DictionaryValue* extra_params, const base::DictionaryValue* extra_params,
BrowserPluginGuest* guest); WebContents* guest_web_contents);
// Message handlers. // Message handlers.
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "content/browser/browser_plugin/browser_plugin_embedder.h" #include "content/browser/browser_plugin/browser_plugin_embedder.h"
#include "content/browser/browser_plugin/browser_plugin_guest_manager.h"
#include "content/browser/browser_plugin/browser_plugin_host_factory.h" #include "content/browser/browser_plugin/browser_plugin_host_factory.h"
#include "content/browser/browser_thread_impl.h" #include "content/browser/browser_thread_impl.h"
#include "content/browser/child_process_security_policy_impl.h" #include "content/browser/child_process_security_policy_impl.h"
...@@ -30,6 +29,7 @@ ...@@ -30,6 +29,7 @@
#include "content/common/input_messages.h" #include "content/common/input_messages.h"
#include "content/common/view_messages.h" #include "content/common/view_messages.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_plugin_guest_manager_delegate.h"
#include "content/public/browser/content_browser_client.h" #include "content/public/browser/content_browser_client.h"
#include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_controller.h"
#include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/render_widget_host_view.h"
...@@ -111,12 +111,16 @@ class BrowserPluginGuest::NewWindowRequest : public PermissionRequest { ...@@ -111,12 +111,16 @@ class BrowserPluginGuest::NewWindowRequest : public PermissionRequest {
virtual ~NewWindowRequest() {} virtual ~NewWindowRequest() {}
void RespondInternal(bool should_allow, void RespondInternal(bool should_allow,
BrowserPluginGuest* guest) { WebContents* guest_web_contents) {
if (!guest) { if (!guest_web_contents) {
VLOG(0) << "Guest not found. Instance ID: " << instance_id_; VLOG(0) << "Guest not found. Instance ID: " << instance_id_;
return; return;
} }
BrowserPluginGuest* guest =
static_cast<WebContentsImpl*>(guest_web_contents)->
GetBrowserPluginGuest();
DCHECK(guest);
// If we do not destroy the guest then we allow the new window. // If we do not destroy the guest then we allow the new window.
if (!should_allow) if (!should_allow)
guest->Destroy(); guest->Destroy();
...@@ -306,7 +310,8 @@ void BrowserPluginGuest::RequestPermission( ...@@ -306,7 +310,8 @@ void BrowserPluginGuest::RequestPermission(
BrowserPluginGuest* BrowserPluginGuest::CreateNewGuestWindow( BrowserPluginGuest* BrowserPluginGuest::CreateNewGuestWindow(
const OpenURLParams& params) { const OpenURLParams& params) {
BrowserPluginGuestManager* guest_manager = GetBrowserPluginGuestManager(); BrowserPluginGuestManagerDelegate* guest_manager =
GetBrowserPluginGuestManager();
// Allocate a new instance ID for the new guest. // Allocate a new instance ID for the new guest.
int instance_id = guest_manager->GetNextInstanceID(); int instance_id = guest_manager->GetNextInstanceID();
...@@ -323,12 +328,15 @@ BrowserPluginGuest* BrowserPluginGuest::CreateNewGuestWindow( ...@@ -323,12 +328,15 @@ BrowserPluginGuest* BrowserPluginGuest::CreateNewGuestWindow(
const std::string& storage_partition_id = site_url.query(); const std::string& storage_partition_id = site_url.query();
bool persist_storage = bool persist_storage =
site_url.path().find("persist") != std::string::npos; site_url.path().find("persist") != std::string::npos;
BrowserPluginGuest* new_guest = WebContents* new_guest_web_contents =
guest_manager->CreateGuest(GetWebContents()->GetSiteInstance(), guest_manager->CreateGuest(GetWebContents()->GetSiteInstance(),
instance_id, instance_id,
storage_partition_id, storage_partition_id,
persist_storage, persist_storage,
extra_params.Pass()); extra_params.Pass());
BrowserPluginGuest* new_guest =
static_cast<WebContentsImpl*>(new_guest_web_contents)->
GetBrowserPluginGuest();
if (new_guest->delegate_) if (new_guest->delegate_)
new_guest->delegate_->SetOpener(GetWebContents()); new_guest->delegate_->SetOpener(GetWebContents());
...@@ -574,10 +582,9 @@ void BrowserPluginGuest::CopyFromCompositingSurface( ...@@ -574,10 +582,9 @@ void BrowserPluginGuest::CopyFromCompositingSurface(
copy_request_id_, src_subrect, dst_size)); copy_request_id_, src_subrect, dst_size));
} }
BrowserPluginGuestManager* BrowserPluginGuestManagerDelegate*
BrowserPluginGuest::GetBrowserPluginGuestManager() const { BrowserPluginGuest::GetBrowserPluginGuestManager() const {
return BrowserPluginGuestManager::FromBrowserContext( return GetWebContents()->GetBrowserContext()->GetGuestManagerDelegate();
GetWebContents()->GetBrowserContext());
} }
// screen. // screen.
......
...@@ -59,7 +59,7 @@ class Range; ...@@ -59,7 +59,7 @@ class Range;
namespace content { namespace content {
class BrowserPluginGuestManager; class BrowserPluginGuestManagerDelegate;
class BrowserPluginHostFactory; class BrowserPluginHostFactory;
class RenderWidgetHostView; class RenderWidgetHostView;
class SiteInstance; class SiteInstance;
...@@ -150,7 +150,7 @@ class CONTENT_EXPORT BrowserPluginGuest ...@@ -150,7 +150,7 @@ class CONTENT_EXPORT BrowserPluginGuest
gfx::Size dst_size, gfx::Size dst_size,
const base::Callback<void(bool, const SkBitmap&)>& callback); const base::Callback<void(bool, const SkBitmap&)>& callback);
BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; BrowserPluginGuestManagerDelegate* GetBrowserPluginGuestManager() const;
// WebContentsObserver implementation. // WebContentsObserver implementation.
virtual void DidCommitProvisionalLoadForFrame( virtual void DidCommitProvisionalLoadForFrame(
......
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/browser_plugin/browser_plugin_guest_manager.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/browser_plugin/browser_plugin_host_factory.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/browser_plugin/browser_plugin_constants.h"
#include "content/common/browser_plugin/browser_plugin_messages.h"
#include "content/common/content_export.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_plugin_guest_manager_delegate.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/common/content_client.h"
#include "content/public/common/result_codes.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/url_utils.h"
namespace content {
// static
BrowserPluginHostFactory* BrowserPluginGuestManager::factory_ = NULL;
BrowserPluginGuestManager::BrowserPluginGuestManager(BrowserContext* context)
: context_(context) {}
BrowserPluginGuestManagerDelegate*
BrowserPluginGuestManager::GetDelegate() const {
return context_->GetGuestManagerDelegate();
}
BrowserPluginGuestManager::~BrowserPluginGuestManager() {
}
// static.
BrowserPluginGuestManager* BrowserPluginGuestManager::FromBrowserContext(
BrowserContext* context) {
BrowserPluginGuestManager* guest_manager =
static_cast<BrowserPluginGuestManager*>(
context->GetUserData(
browser_plugin::kBrowserPluginGuestManagerKeyName));
if (!guest_manager) {
guest_manager = BrowserPluginGuestManager::Create(context);
context->SetUserData(browser_plugin::kBrowserPluginGuestManagerKeyName,
guest_manager);
}
return guest_manager;
}
// static
BrowserPluginGuestManager* BrowserPluginGuestManager::Create(
BrowserContext* context) {
if (factory_)
return factory_->CreateBrowserPluginGuestManager(context);
return new BrowserPluginGuestManager(context);
}
int BrowserPluginGuestManager::GetNextInstanceID() {
if (!GetDelegate())
return 0;
return GetDelegate()->GetNextInstanceID();
}
BrowserPluginGuest* BrowserPluginGuestManager::CreateGuest(
SiteInstance* embedder_site_instance,
int instance_id,
const std::string& storage_partition_id,
bool persist_storage,
scoped_ptr<base::DictionaryValue> extra_params) {
if (!GetDelegate())
return NULL;
WebContents* guest_web_contents =
GetDelegate()->CreateGuest(embedder_site_instance,
instance_id,
storage_partition_id,
persist_storage,
extra_params.Pass());
return static_cast<WebContentsImpl*>(guest_web_contents)->
GetBrowserPluginGuest();
}
static void BrowserPluginGuestByInstanceIDCallback(
const BrowserPluginGuestManager::GuestByInstanceIDCallback& callback,
WebContents* guest_web_contents) {
if (!guest_web_contents) {
callback.Run(NULL);
return;
}
callback.Run(static_cast<WebContentsImpl*>(guest_web_contents)->
GetBrowserPluginGuest());
}
void BrowserPluginGuestManager::MaybeGetGuestByInstanceIDOrKill(
int instance_id,
int embedder_render_process_id,
const GuestByInstanceIDCallback& callback) const {
if (!GetDelegate()) {
callback.Run(NULL);
return;
}
GetDelegate()->MaybeGetGuestByInstanceIDOrKill(
instance_id,
embedder_render_process_id,
base::Bind(&BrowserPluginGuestByInstanceIDCallback,
callback));
}
static void BrowserPluginGuestMessageCallback(const IPC::Message& message,
BrowserPluginGuest* guest) {
if (!guest)
return;
guest->OnMessageReceivedFromEmbedder(message);
}
void BrowserPluginGuestManager::OnMessageReceived(const IPC::Message& message,
int render_process_id) {
DCHECK(BrowserPluginGuest::ShouldForwardToBrowserPluginGuest(message));
int instance_id = 0;
// All allowed messages must have instance_id as their first parameter.
PickleIterator iter(message);
bool success = iter.ReadInt(&instance_id);
DCHECK(success);
MaybeGetGuestByInstanceIDOrKill(instance_id,
render_process_id,
base::Bind(&BrowserPluginGuestMessageCallback,
message));
}
static bool BrowserPluginGuestCallback(
const BrowserPluginGuestManager::GuestCallback& callback,
WebContents* guest_web_contents) {
return callback.Run(static_cast<WebContentsImpl*>(guest_web_contents)
->GetBrowserPluginGuest());
}
bool BrowserPluginGuestManager::ForEachGuest(
WebContents* embedder_web_contents, const GuestCallback& callback) {
if (!GetDelegate())
return false;
return GetDelegate()->ForEachGuest(embedder_web_contents,
base::Bind(&BrowserPluginGuestCallback,
callback));
}
} // namespace content
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// A BrowserPluginGuestManager serves as a message router to BrowserPluginGuests
// for all guests within a given profile.
// Messages are routed to a particular guest instance based on an instance_id.
#ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_MANAGER_H_
#define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_MANAGER_H_
#include "base/basictypes.h"
#include "base/supports_user_data.h"
#include "base/values.h"
#include "content/common/content_export.h"
#include "content/public/browser/browser_plugin_guest_manager_delegate.h"
#include "ipc/ipc_message.h"
struct BrowserPluginHostMsg_Attach_Params;
struct BrowserPluginHostMsg_ResizeGuest_Params;
class GURL;
namespace gfx {
class Point;
}
namespace IPC {
class Message;
} // namespace IPC
namespace content {
class BrowserContext;
class BrowserPluginGuest;
class BrowserPluginHostFactory;
class RenderWidgetHostImpl;
class SiteInstance;
class WebContents;
// WARNING: All APIs should be guarded with a process ID check like
// CanEmbedderAccessInstanceIDMaybeKill, to prevent abuse by normal renderer
// processes.
class CONTENT_EXPORT BrowserPluginGuestManager :
public base::SupportsUserData::Data {
public:
virtual ~BrowserPluginGuestManager();
static BrowserPluginGuestManager* FromBrowserContext(BrowserContext* context);
BrowserPluginGuestManagerDelegate* GetDelegate() const;
static BrowserPluginGuestManager* Create(BrowserContext* context);
// Overrides factory for testing. Default (NULL) value indicates regular
// (non-test) environment.
static void set_factory_for_testing(BrowserPluginHostFactory* factory) {
content::BrowserPluginGuestManager::factory_ = factory;
}
// Gets the next available instance id. 0 is considered an invalid instance
// ID.
int GetNextInstanceID();
// Creates a guest WebContents with the provided |instance_id| and |params|.
// If params.src is present, the new guest will also be navigated to the
// provided URL. Optionally, the new guest may be attached to a
// |guest_opener|, and may be attached to a pre-selected |routing_id|.
virtual BrowserPluginGuest* CreateGuest(
SiteInstance* embedder_site_instance,
int instance_id,
const std::string& storage_partition_id,
bool persist_storage,
scoped_ptr<base::DictionaryValue> extra_params);
typedef base::Callback<void(BrowserPluginGuest*)> GuestByInstanceIDCallback;
void MaybeGetGuestByInstanceIDOrKill(
int instance_id,
int embedder_render_process_id,
const GuestByInstanceIDCallback& callback) const;
typedef base::Callback<bool(BrowserPluginGuest*)> GuestCallback;
bool ForEachGuest(WebContents* embedder_web_contents,
const GuestCallback& callback);
void OnMessageReceived(const IPC::Message& message, int render_process_id);
private:
friend class TestBrowserPluginGuestManager;
explicit BrowserPluginGuestManager(BrowserContext* context);
// Static factory instance (always NULL outside of tests).
static BrowserPluginHostFactory* factory_;
// The BrowserContext in which this manager this stored.
BrowserContext* context_;
// Contains guests' WebContents, mapping from their instance ids.
typedef std::map<int, WebContents*> GuestInstanceMap;
GuestInstanceMap guest_web_contents_by_instance_id_;
int next_instance_id_;
DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuestManager);
};
} // namespace content
#endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_MANAGER_H_
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "content/browser/browser_plugin/browser_plugin_host_factory.h" #include "content/browser/browser_plugin/browser_plugin_host_factory.h"
#include "content/browser/browser_plugin/test_browser_plugin_guest.h" #include "content/browser/browser_plugin/test_browser_plugin_guest.h"
#include "content/browser/browser_plugin/test_browser_plugin_guest_delegate.h" #include "content/browser/browser_plugin/test_browser_plugin_guest_delegate.h"
#include "content/browser/browser_plugin/test_browser_plugin_guest_manager.h"
#include "content/browser/browser_plugin/test_guest_manager_delegate.h" #include "content/browser/browser_plugin/test_guest_manager_delegate.h"
#include "content/browser/child_process_security_policy_impl.h" #include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/frame_host/render_frame_host_impl.h" #include "content/browser/frame_host/render_frame_host_impl.h"
...@@ -103,14 +102,6 @@ class TestBrowserPluginEmbedder : public BrowserPluginEmbedder { ...@@ -103,14 +102,6 @@ class TestBrowserPluginEmbedder : public BrowserPluginEmbedder {
// BrowserPluginGuest. // BrowserPluginGuest.
class TestBrowserPluginHostFactory : public BrowserPluginHostFactory { class TestBrowserPluginHostFactory : public BrowserPluginHostFactory {
public: public:
virtual BrowserPluginGuestManager*
CreateBrowserPluginGuestManager(BrowserContext* context) OVERRIDE {
guest_manager_instance_count_++;
if (message_loop_runner_)
message_loop_runner_->Quit();
return new TestBrowserPluginGuestManager(context);
}
virtual BrowserPluginGuest* CreateBrowserPluginGuest( virtual BrowserPluginGuest* CreateBrowserPluginGuest(
int instance_id, int instance_id,
WebContentsImpl* web_contents) OVERRIDE { WebContentsImpl* web_contents) OVERRIDE {
...@@ -129,19 +120,8 @@ class TestBrowserPluginHostFactory : public BrowserPluginHostFactory { ...@@ -129,19 +120,8 @@ class TestBrowserPluginHostFactory : public BrowserPluginHostFactory {
return Singleton<TestBrowserPluginHostFactory>::get(); return Singleton<TestBrowserPluginHostFactory>::get();
} }
// Waits for at least one embedder to be created in the test. Returns true if
// we have a guest, false if waiting times out.
void WaitForGuestManagerCreation() {
// Check if already have created an instance.
if (guest_manager_instance_count_ > 0)
return;
// Wait otherwise.
message_loop_runner_ = new MessageLoopRunner();
message_loop_runner_->Run();
}
protected: protected:
TestBrowserPluginHostFactory() : guest_manager_instance_count_(0) {} TestBrowserPluginHostFactory() {}
virtual ~TestBrowserPluginHostFactory() {} virtual ~TestBrowserPluginHostFactory() {}
private: private:
...@@ -149,7 +129,6 @@ class TestBrowserPluginHostFactory : public BrowserPluginHostFactory { ...@@ -149,7 +129,6 @@ class TestBrowserPluginHostFactory : public BrowserPluginHostFactory {
friend struct DefaultSingletonTraits<TestBrowserPluginHostFactory>; friend struct DefaultSingletonTraits<TestBrowserPluginHostFactory>;
scoped_refptr<MessageLoopRunner> message_loop_runner_; scoped_refptr<MessageLoopRunner> message_loop_runner_;
int guest_manager_instance_count_;
DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginHostFactory); DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginHostFactory);
}; };
...@@ -236,8 +215,6 @@ class BrowserPluginHostTest : public ContentBrowserTest { ...@@ -236,8 +215,6 @@ class BrowserPluginHostTest : public ContentBrowserTest {
TestBrowserPluginHostFactory::GetInstance()); TestBrowserPluginHostFactory::GetInstance());
BrowserPluginGuest::set_factory_for_testing( BrowserPluginGuest::set_factory_for_testing(
TestBrowserPluginHostFactory::GetInstance()); TestBrowserPluginHostFactory::GetInstance());
BrowserPluginGuestManager::set_factory_for_testing(
TestBrowserPluginHostFactory::GetInstance());
ContentBrowserTest::SetUp(); ContentBrowserTest::SetUp();
} }
virtual void TearDown() OVERRIDE { virtual void TearDown() OVERRIDE {
...@@ -313,20 +290,17 @@ class BrowserPluginHostTest : public ContentBrowserTest { ...@@ -313,20 +290,17 @@ class BrowserPluginHostTest : public ContentBrowserTest {
rfh, base::StringPrintf("SetSrc('%s');", guest_url.c_str())); rfh, base::StringPrintf("SetSrc('%s');", guest_url.c_str()));
} }
// Wait to make sure embedder is created/attached to WebContents.
TestBrowserPluginHostFactory::GetInstance()->WaitForGuestManagerCreation();
test_embedder_ = static_cast<TestBrowserPluginEmbedder*>( test_embedder_ = static_cast<TestBrowserPluginEmbedder*>(
embedder_web_contents->GetBrowserPluginEmbedder()); embedder_web_contents->GetBrowserPluginEmbedder());
ASSERT_TRUE(test_embedder_); ASSERT_TRUE(test_embedder_);
test_guest_manager_ = static_cast<TestBrowserPluginGuestManager*>( test_guest_manager_ =
BrowserPluginGuestManager::FromBrowserContext( static_cast<TestGuestManagerDelegate*>(
test_embedder_->GetWebContents()->GetBrowserContext())); embedder_web_contents->GetBrowserContext()->
ASSERT_TRUE(test_guest_manager_); GetGuestManagerDelegate());
WebContentsImpl* test_guest_web_contents = static_cast<WebContentsImpl*>( WebContentsImpl* test_guest_web_contents =
test_guest_manager_->WaitForGuestAdded()); test_guest_manager_->WaitForGuestAdded();
test_guest_ = static_cast<TestBrowserPluginGuest*>( test_guest_ = static_cast<TestBrowserPluginGuest*>(
test_guest_web_contents->GetBrowserPluginGuest()); test_guest_web_contents->GetBrowserPluginGuest());
...@@ -335,14 +309,14 @@ class BrowserPluginHostTest : public ContentBrowserTest { ...@@ -335,14 +309,14 @@ class BrowserPluginHostTest : public ContentBrowserTest {
TestBrowserPluginEmbedder* test_embedder() const { return test_embedder_; } TestBrowserPluginEmbedder* test_embedder() const { return test_embedder_; }
TestBrowserPluginGuest* test_guest() const { return test_guest_; } TestBrowserPluginGuest* test_guest() const { return test_guest_; }
TestBrowserPluginGuestManager* test_guest_manager() const { TestGuestManagerDelegate* test_guest_manager() const {
return test_guest_manager_; return test_guest_manager_;
} }
private: private:
TestBrowserPluginEmbedder* test_embedder_; TestBrowserPluginEmbedder* test_embedder_;
TestBrowserPluginGuest* test_guest_; TestBrowserPluginGuest* test_guest_;
TestBrowserPluginGuestManager* test_guest_manager_; TestGuestManagerDelegate* test_guest_manager_;
DISALLOW_COPY_AND_ASSIGN(BrowserPluginHostTest); DISALLOW_COPY_AND_ASSIGN(BrowserPluginHostTest);
}; };
......
...@@ -23,9 +23,6 @@ class WebContentsImpl; ...@@ -23,9 +23,6 @@ class WebContentsImpl;
// Factory to create BrowserPlugin embedder and guest. // Factory to create BrowserPlugin embedder and guest.
class CONTENT_EXPORT BrowserPluginHostFactory { class CONTENT_EXPORT BrowserPluginHostFactory {
public: public:
virtual BrowserPluginGuestManager* CreateBrowserPluginGuestManager(
BrowserContext* context) = 0;
virtual BrowserPluginGuest* CreateBrowserPluginGuest( virtual BrowserPluginGuest* CreateBrowserPluginGuest(
int instance_id, int instance_id,
WebContentsImpl* web_contents) = 0; WebContentsImpl* web_contents) = 0;
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "base/supports_user_data.h" #include "base/supports_user_data.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h" #include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/browser_plugin/browser_plugin_guest_manager.h"
#include "content/browser/gpu/gpu_process_host.h" #include "content/browser/gpu/gpu_process_host.h"
#include "content/browser/web_contents/web_contents_impl.h" #include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/browser_plugin/browser_plugin_constants.h" #include "content/common/browser_plugin/browser_plugin_constants.h"
...@@ -14,6 +13,7 @@ ...@@ -14,6 +13,7 @@
#include "content/common/gpu/gpu_messages.h" #include "content/common/gpu/gpu_messages.h"
#include "content/common/view_messages.h" #include "content/common/view_messages.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_plugin_guest_manager_delegate.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
...@@ -36,10 +36,7 @@ bool BrowserPluginMessageFilter::OnMessageReceived( ...@@ -36,10 +36,7 @@ bool BrowserPluginMessageFilter::OnMessageReceived(
// Any message requested by a BrowserPluginGuest should be routed through // Any message requested by a BrowserPluginGuest should be routed through
// a BrowserPluginGuestManager. // a BrowserPluginGuestManager.
if (BrowserPluginGuest::ShouldForwardToBrowserPluginGuest(message)) { if (BrowserPluginGuest::ShouldForwardToBrowserPluginGuest(message)) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); ForwardMessageToGuest(message);
BrowserPluginGuestManager* guest_manager = GetBrowserPluginGuestManager();
if (guest_manager)
guest_manager->OnMessageReceived(message, render_process_id_);
// We always swallow messages destined for BrowserPluginGuestManager because // We always swallow messages destined for BrowserPluginGuestManager because
// we're on the UI thread and fallback code is expected to be run on the IO // we're on the UI thread and fallback code is expected to be run on the IO
// thread. // thread.
...@@ -65,18 +62,33 @@ void BrowserPluginMessageFilter::OverrideThreadForMessage( ...@@ -65,18 +62,33 @@ void BrowserPluginMessageFilter::OverrideThreadForMessage(
*thread = BrowserThread::UI; *thread = BrowserThread::UI;
} }
BrowserPluginGuestManager* static void BrowserPluginGuestMessageCallback(const IPC::Message& message,
BrowserPluginMessageFilter::GetBrowserPluginGuestManager() { WebContents* guest_web_contents) {
if (!guest_web_contents)
return;
static_cast<WebContentsImpl*>(guest_web_contents)->GetBrowserPluginGuest()->
OnMessageReceivedFromEmbedder(message);
}
void BrowserPluginMessageFilter::ForwardMessageToGuest(
const IPC::Message& message) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
RenderProcessHostImpl* host = static_cast<RenderProcessHostImpl*>( RenderProcessHostImpl* host = static_cast<RenderProcessHostImpl*>(
RenderProcessHost::FromID(render_process_id_)); RenderProcessHost::FromID(render_process_id_));
if (!host) if (!host)
return NULL; return;
BrowserContext* browser_context = host->GetBrowserContext(); int instance_id = 0;
return static_cast<BrowserPluginGuestManager*>( // All allowed messages must have instance_id as their first parameter.
browser_context->GetUserData( PickleIterator iter(message);
browser_plugin::kBrowserPluginGuestManagerKeyName)); bool success = iter.ReadInt(&instance_id);
DCHECK(success);
host->GetBrowserContext()->GetGuestManagerDelegate()->
MaybeGetGuestByInstanceIDOrKill(
instance_id,
render_process_id_,
base::Bind(&BrowserPluginGuestMessageCallback,
message));
} }
void BrowserPluginMessageFilter::OnSwapBuffersACK( void BrowserPluginMessageFilter::OnSwapBuffersACK(
......
...@@ -12,7 +12,6 @@ struct FrameHostMsg_BuffersSwappedACK_Params; ...@@ -12,7 +12,6 @@ struct FrameHostMsg_BuffersSwappedACK_Params;
namespace content { namespace content {
class BrowserContext; class BrowserContext;
class BrowserPluginGuestManager;
// This class filters out incoming IPC messages for the guest renderer process // This class filters out incoming IPC messages for the guest renderer process
// on the IPC thread before other message filters handle them. // on the IPC thread before other message filters handle them.
...@@ -34,7 +33,7 @@ class BrowserPluginMessageFilter : public BrowserMessageFilter { ...@@ -34,7 +33,7 @@ class BrowserPluginMessageFilter : public BrowserMessageFilter {
virtual ~BrowserPluginMessageFilter(); virtual ~BrowserPluginMessageFilter();
BrowserPluginGuestManager* GetBrowserPluginGuestManager(); void ForwardMessageToGuest(const IPC::Message& message);
void OnSwapBuffersACK(const FrameHostMsg_BuffersSwappedACK_Params& params); void OnSwapBuffersACK(const FrameHostMsg_BuffersSwappedACK_Params& params);
......
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/browser_plugin/test_browser_plugin_guest_manager.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/test/test_utils.h"
namespace content {
TestBrowserPluginGuestManager::TestBrowserPluginGuestManager(
BrowserContext* context)
: BrowserPluginGuestManager(context),
last_guest_added_(NULL) {
}
TestBrowserPluginGuestManager::~TestBrowserPluginGuestManager() {
}
BrowserPluginGuest* TestBrowserPluginGuestManager::CreateGuest(
SiteInstance* embedder_site_instance,
int instance_id,
const std::string& storage_partition_id,
bool persist_storage,
scoped_ptr<base::DictionaryValue> extra_params) {
BrowserPluginGuest* guest = BrowserPluginGuestManager::CreateGuest(
embedder_site_instance,
instance_id,
storage_partition_id,
persist_storage,
extra_params.Pass());
last_guest_added_ = guest->GetWebContents();
if (message_loop_runner_.get())
message_loop_runner_->Quit();
return guest;
}
WebContents* TestBrowserPluginGuestManager::WaitForGuestAdded() {
// Check if guests were already created.
if (last_guest_added_) {
WebContents* last_guest_added = last_guest_added_;
last_guest_added_ = NULL;
return last_guest_added;
}
// Wait otherwise.
message_loop_runner_ = new MessageLoopRunner();
message_loop_runner_->Run();
WebContents* last_guest_added = last_guest_added_;
last_guest_added_ = NULL;
return last_guest_added;
}
} // namespace content
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_MANAGER_H_
#define CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_MANAGER_H_
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "content/browser/browser_plugin/browser_plugin_guest_manager.h"
#include "content/public/test/test_utils.h"
FORWARD_DECLARE_TEST(BrowserPluginHostTest, ReloadEmbedder);
namespace content {
class WebContentsImpl;
// Test class for BrowserPluginGuestManager.
//
// Provides utilities to wait for certain state/messages in
// BrowserPluginGuestManager to be used in tests.
class TestBrowserPluginGuestManager : public BrowserPluginGuestManager {
public:
explicit TestBrowserPluginGuestManager(BrowserContext* context);
virtual ~TestBrowserPluginGuestManager();
// Overriden to intercept in test.
virtual BrowserPluginGuest* CreateGuest(
SiteInstance* embedder_site_instance,
int instance_id,
const std::string& storage_partition_id,
bool persist_storage,
scoped_ptr<base::DictionaryValue> extra_params) OVERRIDE;
// Waits until at least one guest is added to the guest manager.
WebContents* WaitForGuestAdded();
private:
// BrowserPluginHostTest.ReloadEmbedder needs access to the GuestInstanceMap.
FRIEND_TEST_ALL_PREFIXES(BrowserPluginHostTest, ReloadEmbedder);
WebContents* last_guest_added_;
scoped_refptr<MessageLoopRunner> message_loop_runner_;
DISALLOW_COPY_AND_ASSIGN(TestBrowserPluginGuestManager);
};
} // namespace content
#endif // CONTENT_BROWSER_BROWSER_PLUGIN_TEST_BROWSER_PLUGIN_GUEST_MANAGER_H_
...@@ -8,10 +8,12 @@ ...@@ -8,10 +8,12 @@
#include "base/memory/singleton.h" #include "base/memory/singleton.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/values.h" #include "base/values.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/site_instance.h" #include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "content/public/common/url_constants.h" #include "content/public/common/url_constants.h"
#include "content/public/test/test_utils.h"
#include "net/base/escape.h" #include "net/base/escape.h"
namespace content { namespace content {
...@@ -38,7 +40,8 @@ class GuestWebContentsObserver ...@@ -38,7 +40,8 @@ class GuestWebContentsObserver
}; };
TestGuestManagerDelegate::TestGuestManagerDelegate() TestGuestManagerDelegate::TestGuestManagerDelegate()
: next_instance_id_(0) { : last_guest_added_(NULL),
next_instance_id_(0) {
} }
TestGuestManagerDelegate::~TestGuestManagerDelegate() { TestGuestManagerDelegate::~TestGuestManagerDelegate() {
...@@ -49,6 +52,21 @@ TestGuestManagerDelegate* TestGuestManagerDelegate::GetInstance() { ...@@ -49,6 +52,21 @@ TestGuestManagerDelegate* TestGuestManagerDelegate::GetInstance() {
return Singleton<TestGuestManagerDelegate>::get(); return Singleton<TestGuestManagerDelegate>::get();
} }
WebContentsImpl* TestGuestManagerDelegate::WaitForGuestAdded() {
// Check if guests were already created.
if (last_guest_added_) {
WebContentsImpl* last_guest_added = last_guest_added_;
last_guest_added_ = NULL;
return last_guest_added;
}
// Wait otherwise.
message_loop_runner_ = new MessageLoopRunner();
message_loop_runner_->Run();
WebContentsImpl* last_guest_added = last_guest_added_;
last_guest_added_ = NULL;
return last_guest_added;
}
content::WebContents* TestGuestManagerDelegate::CreateGuest( content::WebContents* TestGuestManagerDelegate::CreateGuest(
SiteInstance* embedder_site_instance, SiteInstance* embedder_site_instance,
int instance_id, int instance_id,
...@@ -98,6 +116,9 @@ void TestGuestManagerDelegate::AddGuest( ...@@ -98,6 +116,9 @@ void TestGuestManagerDelegate::AddGuest(
guest_web_contents_by_instance_id_.end()); guest_web_contents_by_instance_id_.end());
guest_web_contents_by_instance_id_[guest_instance_id] = guest_web_contents; guest_web_contents_by_instance_id_[guest_instance_id] = guest_web_contents;
new GuestWebContentsObserver(guest_web_contents); new GuestWebContentsObserver(guest_web_contents);
last_guest_added_ = static_cast<WebContentsImpl*>(guest_web_contents);
if (message_loop_runner_)
message_loop_runner_->Quit();
} }
void TestGuestManagerDelegate::RemoveGuest( void TestGuestManagerDelegate::RemoveGuest(
......
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
namespace content { namespace content {
class MessageLoopRunner;
class WebContentsImpl;
// This class is temporary until BrowserPluginHostTest.* tests are entirely // This class is temporary until BrowserPluginHostTest.* tests are entirely
// moved out of content. // moved out of content.
class TestGuestManagerDelegate : public BrowserPluginGuestManagerDelegate { class TestGuestManagerDelegate : public BrowserPluginGuestManagerDelegate {
...@@ -24,6 +27,9 @@ class TestGuestManagerDelegate : public BrowserPluginGuestManagerDelegate { ...@@ -24,6 +27,9 @@ class TestGuestManagerDelegate : public BrowserPluginGuestManagerDelegate {
void RemoveGuest(int guest_instance_id); void RemoveGuest(int guest_instance_id);
SiteInstance* GetGuestSiteInstance(const GURL& guest_site); SiteInstance* GetGuestSiteInstance(const GURL& guest_site);
// Waits until at least one guest is added to this guest manager.
WebContentsImpl* WaitForGuestAdded();
// BrowserPluginGuestManagerDelegate implementation. // BrowserPluginGuestManagerDelegate implementation.
virtual content::WebContents* CreateGuest( virtual content::WebContents* CreateGuest(
content::SiteInstance* embedder_site_instance, content::SiteInstance* embedder_site_instance,
...@@ -42,11 +48,13 @@ class TestGuestManagerDelegate : public BrowserPluginGuestManagerDelegate { ...@@ -42,11 +48,13 @@ class TestGuestManagerDelegate : public BrowserPluginGuestManagerDelegate {
private: private:
friend struct DefaultSingletonTraits<TestGuestManagerDelegate>; friend struct DefaultSingletonTraits<TestGuestManagerDelegate>;
TestGuestManagerDelegate(); TestGuestManagerDelegate();
// Contains guests' WebContents, mapping from their instance ids. // Contains guests' WebContents, mapping from their instance ids.
typedef std::map<int, WebContents*> GuestInstanceMap; typedef std::map<int, WebContents*> GuestInstanceMap;
GuestInstanceMap guest_web_contents_by_instance_id_; GuestInstanceMap guest_web_contents_by_instance_id_;
WebContentsImpl* last_guest_added_;
int next_instance_id_; int next_instance_id_;
scoped_refptr<MessageLoopRunner> message_loop_runner_;
DISALLOW_COPY_AND_ASSIGN(TestGuestManagerDelegate); DISALLOW_COPY_AND_ASSIGN(TestGuestManagerDelegate);
}; };
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "base/time/time.h" #include "base/time/time.h"
#include "content/browser/browser_plugin/browser_plugin_embedder.h" #include "content/browser/browser_plugin/browser_plugin_embedder.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h" #include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/browser_plugin/browser_plugin_guest_manager.h"
#include "content/browser/child_process_security_policy_impl.h" #include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/devtools/render_view_devtools_agent_host.h" #include "content/browser/devtools/render_view_devtools_agent_host.h"
#include "content/browser/dom_storage/dom_storage_context_wrapper.h" #include "content/browser/dom_storage/dom_storage_context_wrapper.h"
...@@ -58,6 +57,7 @@ ...@@ -58,6 +57,7 @@
#include "content/common/view_messages.h" #include "content/common/view_messages.h"
#include "content/public/browser/ax_event_notification_details.h" #include "content/public/browser/ax_event_notification_details.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_plugin_guest_manager_delegate.h"
#include "content/public/browser/content_browser_client.h" #include "content/public/browser/content_browser_client.h"
#include "content/public/browser/devtools_agent_host.h" #include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/download_manager.h" #include "content/public/browser/download_manager.h"
...@@ -1414,8 +1414,7 @@ void WebContentsImpl::CreateNewWindow( ...@@ -1414,8 +1414,7 @@ void WebContentsImpl::CreateNewWindow(
// This makes |new_contents| act as a guest. // This makes |new_contents| act as a guest.
// For more info, see comment above class BrowserPluginGuest. // For more info, see comment above class BrowserPluginGuest.
int instance_id = int instance_id =
BrowserPluginGuestManager::FromBrowserContext(GetBrowserContext())-> GetBrowserContext()->GetGuestManagerDelegate()->GetNextInstanceID();
GetNextInstanceID();
WebContentsImpl* new_contents_impl = WebContentsImpl* new_contents_impl =
static_cast<WebContentsImpl*>(new_contents); static_cast<WebContentsImpl*>(new_contents);
BrowserPluginGuest::CreateWithOpener(instance_id, BrowserPluginGuest::CreateWithOpener(instance_id,
......
...@@ -327,8 +327,6 @@ ...@@ -327,8 +327,6 @@
'browser/browser_plugin/browser_plugin_embedder.h', 'browser/browser_plugin/browser_plugin_embedder.h',
'browser/browser_plugin/browser_plugin_guest.cc', 'browser/browser_plugin/browser_plugin_guest.cc',
'browser/browser_plugin/browser_plugin_guest.h', 'browser/browser_plugin/browser_plugin_guest.h',
'browser/browser_plugin/browser_plugin_guest_manager.cc',
'browser/browser_plugin/browser_plugin_guest_manager.h',
'browser/browser_plugin/browser_plugin_host_factory.h', 'browser/browser_plugin/browser_plugin_host_factory.h',
'browser/browser_plugin/browser_plugin_message_filter.cc', 'browser/browser_plugin/browser_plugin_message_filter.cc',
'browser/browser_plugin/browser_plugin_message_filter.h', 'browser/browser_plugin/browser_plugin_message_filter.h',
......
...@@ -1070,8 +1070,6 @@ ...@@ -1070,8 +1070,6 @@
'browser/browser_plugin/test_browser_plugin_guest.h', 'browser/browser_plugin/test_browser_plugin_guest.h',
'browser/browser_plugin/test_browser_plugin_guest_delegate.cc', 'browser/browser_plugin/test_browser_plugin_guest_delegate.cc',
'browser/browser_plugin/test_browser_plugin_guest_delegate.h', 'browser/browser_plugin/test_browser_plugin_guest_delegate.h',
'browser/browser_plugin/test_browser_plugin_guest_manager.cc',
'browser/browser_plugin/test_browser_plugin_guest_manager.h',
'browser/browser_plugin/test_guest_manager_delegate.cc', 'browser/browser_plugin/test_guest_manager_delegate.cc',
'browser/browser_plugin/test_guest_manager_delegate.h', 'browser/browser_plugin/test_guest_manager_delegate.h',
'browser/child_process_security_policy_browsertest.cc', 'browser/child_process_security_policy_browsertest.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment