| 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 18bfc25c3b46eb5620ac4ee50593d0136052c676..2160f236b528c178518eac684c321dc6b871ec91 100644
|
| --- a/content/browser/browser_plugin/browser_plugin_embedder.cc
|
| +++ b/content/browser/browser_plugin/browser_plugin_embedder.cc
|
| @@ -81,6 +81,10 @@ void BrowserPluginEmbedder::GetRenderViewHostAtPosition(
|
| ++next_get_render_view_request_id_;
|
| }
|
|
|
| +WebContentsImpl* BrowserPluginEmbedder::GetWebContents() {
|
| + return static_cast<WebContentsImpl*>(web_contents());
|
| +}
|
| +
|
| bool BrowserPluginEmbedder::DidSendScreenRectsCallback(
|
| BrowserPluginGuest* guest) {
|
| static_cast<RenderViewHostImpl*>(
|
| @@ -90,9 +94,7 @@ bool BrowserPluginEmbedder::DidSendScreenRectsCallback(
|
| }
|
|
|
| void BrowserPluginEmbedder::DidSendScreenRects() {
|
| - WebContentsImpl* embedder =
|
| - static_cast<WebContentsImpl*>(web_contents());
|
| - GetBrowserPluginGuestManager()->ForEachGuest(embedder, base::Bind(
|
| + GetBrowserPluginGuestManager()->ForEachGuest(GetWebContents(), base::Bind(
|
| &BrowserPluginEmbedder::DidSendScreenRectsCallback,
|
| base::Unretained(this)));
|
| }
|
| @@ -111,12 +113,10 @@ bool BrowserPluginEmbedder::HandleKeyboardEvent(
|
| return false;
|
| }
|
|
|
| - WebContentsImpl* embedder =
|
| - static_cast<WebContentsImpl*>(web_contents());
|
| - return GetBrowserPluginGuestManager()->ForEachGuest(embedder, base::Bind(
|
| - &BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback,
|
| - base::Unretained(this),
|
| - event));
|
| + return GetBrowserPluginGuestManager()->ForEachGuest(GetWebContents(),
|
| + base::Bind(&BrowserPluginEmbedder::UnlockMouseIfNecessaryCallback,
|
| + base::Unretained(this),
|
| + event));
|
| }
|
|
|
| bool BrowserPluginEmbedder::SetZoomLevelCallback(
|
| @@ -127,9 +127,7 @@ bool BrowserPluginEmbedder::SetZoomLevelCallback(
|
| }
|
|
|
| void BrowserPluginEmbedder::SetZoomLevel(double level) {
|
| - WebContentsImpl* embedder =
|
| - static_cast<WebContentsImpl*>(web_contents());
|
| - GetBrowserPluginGuestManager()->ForEachGuest(embedder, base::Bind(
|
| + GetBrowserPluginGuestManager()->ForEachGuest(GetWebContents(), base::Bind(
|
| &BrowserPluginEmbedder::SetZoomLevelCallback,
|
| base::Unretained(this),
|
| level));
|
| @@ -195,11 +193,11 @@ void BrowserPluginEmbedder::CleanUp() {
|
|
|
| BrowserPluginGuestManager*
|
| BrowserPluginEmbedder::GetBrowserPluginGuestManager() {
|
| - BrowserPluginGuestManager* guest_manager = static_cast<WebContentsImpl*>(
|
| - web_contents())->GetBrowserPluginGuestManager();
|
| + BrowserPluginGuestManager* guest_manager =
|
| + GetWebContents()->GetBrowserPluginGuestManager();
|
| if (!guest_manager) {
|
| guest_manager = BrowserPluginGuestManager::Create();
|
| - web_contents()->GetBrowserContext()->SetUserData(
|
| + GetWebContents()->GetBrowserContext()->SetUserData(
|
| browser_plugin::kBrowserPluginGuestManagerKeyName, guest_manager);
|
| }
|
| return guest_manager;
|
| @@ -216,12 +214,12 @@ void BrowserPluginEmbedder::OnAttach(
|
| const BrowserPluginHostMsg_Attach_Params& params,
|
| const base::DictionaryValue& extra_params) {
|
| if (!GetBrowserPluginGuestManager()->CanEmbedderAccessInstanceIDMaybeKill(
|
| - web_contents()->GetRenderProcessHost()->GetID(), instance_id))
|
| + GetWebContents()->GetRenderProcessHost()->GetID(), instance_id))
|
| return;
|
|
|
| BrowserPluginGuest* guest =
|
| GetBrowserPluginGuestManager()->GetGuestByInstanceID(
|
| - instance_id, web_contents()->GetRenderProcessHost()->GetID());
|
| + instance_id, GetWebContents()->GetRenderProcessHost()->GetID());
|
|
|
| if (guest) {
|
| // There is an implicit order expectation here:
|
| @@ -231,24 +229,23 @@ void BrowserPluginEmbedder::OnAttach(
|
| // prior to attachment.
|
| GetContentClient()->browser()->GuestWebContentsAttached(
|
| guest->GetWebContents(),
|
| - web_contents(),
|
| + GetWebContents(),
|
| extra_params);
|
| - guest->Attach(
|
| - static_cast<WebContentsImpl*>(web_contents()), params, extra_params);
|
| + guest->Attach(GetWebContents(), params, extra_params);
|
| return;
|
| }
|
|
|
| scoped_ptr<base::DictionaryValue> copy_extra_params(extra_params.DeepCopy());
|
| guest = GetBrowserPluginGuestManager()->CreateGuest(
|
| - web_contents()->GetSiteInstance(),
|
| + GetWebContents()->GetSiteInstance(),
|
| instance_id, params,
|
| copy_extra_params.Pass());
|
| if (guest) {
|
| GetContentClient()->browser()->GuestWebContentsAttached(
|
| guest->GetWebContents(),
|
| - web_contents(),
|
| + GetWebContents(),
|
| extra_params);
|
| - guest->Initialize(params, static_cast<WebContentsImpl*>(web_contents()));
|
| + guest->Initialize(params, GetWebContents());
|
| }
|
| }
|
|
|
| @@ -263,13 +260,13 @@ void BrowserPluginEmbedder::OnPluginAtPositionResponse(
|
| BrowserPluginGuest* guest = NULL;
|
| if (instance_id != browser_plugin::kInstanceIDNone) {
|
| guest = GetBrowserPluginGuestManager()->GetGuestByInstanceID(
|
| - instance_id, web_contents()->GetRenderProcessHost()->GetID());
|
| + instance_id, GetWebContents()->GetRenderProcessHost()->GetID());
|
| }
|
|
|
| if (guest)
|
| render_view_host = guest->GetWebContents()->GetRenderViewHost();
|
| else // No plugin, use embedder's RenderViewHost.
|
| - render_view_host = web_contents()->GetRenderViewHost();
|
| + render_view_host = GetWebContents()->GetRenderViewHost();
|
|
|
| callback_iter->second.Run(render_view_host, position.x(), position.y());
|
| pending_get_render_view_callbacks_.erase(callback_iter);
|
|
|