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_guest.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 extra_params.Pass()); | 324 extra_params.Pass()); |
325 if (delegate) { | 325 if (delegate) { |
326 delegate->RegisterDestructionCallback( | 326 delegate->RegisterDestructionCallback( |
327 base::Bind(&BrowserPluginGuest::WillDestroy, | 327 base::Bind(&BrowserPluginGuest::WillDestroy, |
328 base::Unretained(guest))); | 328 base::Unretained(guest))); |
329 guest->SetDelegate(delegate); | 329 guest->SetDelegate(delegate); |
330 } | 330 } |
331 return guest; | 331 return guest; |
332 } | 332 } |
333 | 333 |
| 334 // static |
| 335 bool BrowserPluginGuest::IsGuest(WebContentsImpl* web_contents) { |
| 336 return web_contents && web_contents->GetBrowserPluginGuest(); |
| 337 } |
| 338 |
| 339 // static |
| 340 bool BrowserPluginGuest::IsGuest(RenderViewHostImpl* render_view_host) { |
| 341 return render_view_host && IsGuest( |
| 342 static_cast<WebContentsImpl*>(WebContents::FromRenderViewHost( |
| 343 render_view_host))); |
| 344 } |
| 345 |
334 RenderWidgetHostView* BrowserPluginGuest::GetEmbedderRenderWidgetHostView() { | 346 RenderWidgetHostView* BrowserPluginGuest::GetEmbedderRenderWidgetHostView() { |
335 if (!attached()) | 347 if (!attached()) |
336 return NULL; | 348 return NULL; |
337 return embedder_web_contents_->GetRenderWidgetHostView(); | 349 return embedder_web_contents_->GetRenderWidgetHostView(); |
338 } | 350 } |
339 | 351 |
340 void BrowserPluginGuest::UpdateVisibility() { | 352 void BrowserPluginGuest::UpdateVisibility() { |
341 OnSetVisibility(instance_id_, visible()); | 353 OnSetVisibility(instance_id_, visible()); |
342 } | 354 } |
343 | 355 |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 void BrowserPluginGuest::OnImeCompositionRangeChanged( | 1159 void BrowserPluginGuest::OnImeCompositionRangeChanged( |
1148 const gfx::Range& range, | 1160 const gfx::Range& range, |
1149 const std::vector<gfx::Rect>& character_bounds) { | 1161 const std::vector<gfx::Rect>& character_bounds) { |
1150 static_cast<RenderWidgetHostViewBase*>( | 1162 static_cast<RenderWidgetHostViewBase*>( |
1151 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( | 1163 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( |
1152 range, character_bounds); | 1164 range, character_bounds); |
1153 } | 1165 } |
1154 #endif | 1166 #endif |
1155 | 1167 |
1156 } // namespace content | 1168 } // namespace content |
OLD | NEW |