1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675
|
// Copyright 2012 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/renderer/browser_plugin/browser_plugin.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "content/common/browser_plugin/browser_plugin_constants.h"
#include "content/common/browser_plugin/browser_plugin_messages.h"
#include "content/common/view_messages.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "content/public/renderer/browser_plugin_delegate.h"
#include "content/public/renderer/content_renderer_client.h"
#include "content/renderer/browser_plugin/browser_plugin_manager.h"
#include "content/renderer/child_frame_compositing_helper.h"
#include "content/renderer/cursor_utils.h"
#include "content/renderer/drop_data_builder.h"
#include "content/renderer/render_thread_impl.h"
#include "content/renderer/sad_plugin.h"
#include "third_party/WebKit/public/platform/WebRect.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebElement.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebPluginContainer.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "ui/events/keycodes/keyboard_codes.h"
using blink::WebCanvas;
using blink::WebPluginContainer;
using blink::WebPoint;
using blink::WebRect;
using blink::WebURL;
using blink::WebVector;
namespace {
typedef std::map<blink::WebPluginContainer*, content::BrowserPlugin*>
PluginContainerMap;
static base::LazyInstance<PluginContainerMap> g_plugin_container_map =
LAZY_INSTANCE_INITIALIZER;
} // namespace
namespace content {
// static
BrowserPlugin* BrowserPlugin::GetFromNode(blink::WebNode& node) {
blink::WebPluginContainer* container = node.pluginContainer();
if (!container)
return NULL;
PluginContainerMap* browser_plugins = g_plugin_container_map.Pointer();
PluginContainerMap::iterator it = browser_plugins->find(container);
return it == browser_plugins->end() ? NULL : it->second;
}
BrowserPlugin::BrowserPlugin(RenderFrame* render_frame,
scoped_ptr<BrowserPluginDelegate> delegate)
: attached_(false),
render_view_routing_id_(render_frame->GetRenderView()->GetRoutingID()),
container_(NULL),
last_device_scale_factor_(GetDeviceScaleFactor()),
sad_guest_(NULL),
guest_crashed_(false),
plugin_focused_(false),
visible_(true),
mouse_locked_(false),
ready_(false),
browser_plugin_instance_id_(browser_plugin::kInstanceIDNone),
contents_opaque_(true),
delegate_(delegate.Pass()),
weak_ptr_factory_(this) {
browser_plugin_instance_id_ =
BrowserPluginManager::Get()->GetNextInstanceID();
if (delegate_)
delegate_->SetElementInstanceID(browser_plugin_instance_id_);
}
BrowserPlugin::~BrowserPlugin() {
if (compositing_helper_.get())
compositing_helper_->OnContainerDestroy();
BrowserPluginManager::Get()->RemoveBrowserPlugin(browser_plugin_instance_id_);
}
bool BrowserPlugin::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(BrowserPlugin, message)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_AdvanceFocus, OnAdvanceFocus)
IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginMsg_CompositorFrameSwapped,
OnCompositorFrameSwapped(message))
IPC_MESSAGE_HANDLER(BrowserPluginMsg_GuestGone, OnGuestGone)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetContentsOpaque, OnSetContentsOpaque)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetCursor, OnSetCursor)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetMouseLock, OnSetMouseLock)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_SetTooltipText, OnSetTooltipText)
IPC_MESSAGE_HANDLER(BrowserPluginMsg_ShouldAcceptTouchEvents,
OnShouldAcceptTouchEvents)
IPC_MESSAGE_UNHANDLED(
handled = delegate_ && delegate_->OnMessageReceived(message))
IPC_END_MESSAGE_MAP()
return handled;
}
void BrowserPlugin::UpdateDOMAttribute(const std::string& attribute_name,
const base::string16& attribute_value) {
if (!container())
return;
blink::WebElement element = container()->element();
blink::WebString web_attribute_name =
blink::WebString::fromUTF8(attribute_name);
element.setAttribute(web_attribute_name, attribute_value);
}
void BrowserPlugin::Attach() {
Detach();
// TODO(fsamuel): Add support for reattachment.
BrowserPluginHostMsg_Attach_Params attach_params;
attach_params.focused = ShouldGuestBeFocused();
attach_params.visible = visible_;
attach_params.origin = plugin_rect().origin();
attach_params.is_full_page_plugin = false;
if (container()) {
blink::WebLocalFrame* frame = container()->element().document().frame();
attach_params.is_full_page_plugin =
frame->view()->mainFrame()->document().isPluginDocument();
}
gfx::Size view_size(width(), height());
if (!view_size.IsEmpty()) {
PopulateResizeGuestParameters(view_size,
&attach_params.resize_guest_params);
}
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_Attach(
render_view_routing_id_,
browser_plugin_instance_id_,
attach_params));
attached_ = true;
}
void BrowserPlugin::Detach() {
if (!attached())
return;
attached_ = false;
guest_crashed_ = false;
EnableCompositing(false);
if (compositing_helper_.get()) {
compositing_helper_->OnContainerDestroy();
compositing_helper_ = NULL;
}
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_Detach(
render_view_routing_id_, browser_plugin_instance_id_));
}
void BrowserPlugin::DidCommitCompositorFrame() {
if (compositing_helper_.get())
compositing_helper_->DidCommitCompositorFrame();
}
void BrowserPlugin::OnAdvanceFocus(int browser_plugin_instance_id,
bool reverse) {
RenderViewImpl* render_view =
RenderViewImpl::FromRoutingID(render_view_routing_id());
if (!render_view)
return;
render_view->GetWebView()->advanceFocus(reverse);
}
void BrowserPlugin::OnCompositorFrameSwapped(const IPC::Message& message) {
if (!attached())
return;
BrowserPluginMsg_CompositorFrameSwapped::Param param;
if (!BrowserPluginMsg_CompositorFrameSwapped::Read(&message, ¶m))
return;
// Note that there is no need to send ACK for this message.
// If the guest has updated pixels then it is no longer crashed.
guest_crashed_ = false;
scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame);
get<1>(param).frame.AssignTo(frame.get());
EnableCompositing(true);
compositing_helper_->OnCompositorFrameSwapped(
frame.Pass(),
get<1>(param).producing_route_id,
get<1>(param).output_surface_id,
get<1>(param).producing_host_id,
get<1>(param).shared_memory_handle);
}
void BrowserPlugin::OnGuestGone(int browser_plugin_instance_id) {
guest_crashed_ = true;
// Turn off compositing so we can display the sad graphic. Changes to
// compositing state will show up at a later time after a layout and commit.
EnableCompositing(false);
// Queue up showing the sad graphic to give content embedders an opportunity
// to fire their listeners and potentially overlay the webview with custom
// behavior. If the BrowserPlugin is destroyed in the meantime, then the
// task will not be executed.
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&BrowserPlugin::ShowSadGraphic,
weak_ptr_factory_.GetWeakPtr()));
}
void BrowserPlugin::OnSetContentsOpaque(int browser_plugin_instance_id,
bool opaque) {
if (contents_opaque_ == opaque)
return;
contents_opaque_ = opaque;
if (compositing_helper_.get())
compositing_helper_->SetContentsOpaque(opaque);
}
void BrowserPlugin::OnSetCursor(int browser_plugin_instance_id,
const WebCursor& cursor) {
cursor_ = cursor;
}
void BrowserPlugin::OnSetMouseLock(int browser_plugin_instance_id,
bool enable) {
RenderViewImpl* render_view =
RenderViewImpl::FromRoutingID(render_view_routing_id());
if (enable) {
if (mouse_locked_ || !render_view)
return;
render_view->mouse_lock_dispatcher()->LockMouse(this);
} else {
if (!mouse_locked_) {
OnLockMouseACK(false);
return;
}
if (!render_view)
return;
render_view->mouse_lock_dispatcher()->UnlockMouse(this);
}
}
void BrowserPlugin::OnSetTooltipText(int instance_id,
const base::string16& tooltip_text) {
// Show tooltip text by setting the BrowserPlugin's |title| attribute.
UpdateDOMAttribute("title", tooltip_text);
}
void BrowserPlugin::OnShouldAcceptTouchEvents(int browser_plugin_instance_id,
bool accept) {
if (container()) {
container()->requestTouchEventType(
accept ? WebPluginContainer::TouchEventRequestTypeRaw
: WebPluginContainer::TouchEventRequestTypeNone);
}
}
void BrowserPlugin::ShowSadGraphic() {
// If the BrowserPlugin is scheduled to be deleted, then container_ will be
// NULL so we shouldn't attempt to access it.
if (container_)
container_->invalidate();
}
float BrowserPlugin::GetDeviceScaleFactor() const {
RenderViewImpl* render_view =
RenderViewImpl::FromRoutingID(render_view_routing_id());
if (!render_view)
return 1.0f;
return render_view->GetWebView()->deviceScaleFactor();
}
void BrowserPlugin::UpdateDeviceScaleFactor() {
if (last_device_scale_factor_ == GetDeviceScaleFactor())
return;
BrowserPluginHostMsg_ResizeGuest_Params params;
PopulateResizeGuestParameters(plugin_size(), ¶ms);
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ResizeGuest(
render_view_routing_id_,
browser_plugin_instance_id_,
params));
}
void BrowserPlugin::UpdateGuestFocusState() {
if (!attached())
return;
bool should_be_focused = ShouldGuestBeFocused();
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SetFocus(
render_view_routing_id_,
browser_plugin_instance_id_,
should_be_focused));
}
bool BrowserPlugin::ShouldGuestBeFocused() const {
bool embedder_focused = false;
RenderViewImpl* render_view =
RenderViewImpl::FromRoutingID(render_view_routing_id());
if (render_view)
embedder_focused = render_view->has_focus();
return plugin_focused_ && embedder_focused;
}
WebPluginContainer* BrowserPlugin::container() const {
return container_;
}
bool BrowserPlugin::initialize(WebPluginContainer* container) {
if (!container)
return false;
container_ = container;
container_->setWantsWheelEvents(true);
g_plugin_container_map.Get().insert(std::make_pair(container_, this));
BrowserPluginManager::Get()->AddBrowserPlugin(
browser_plugin_instance_id_, this);
// This is a way to notify observers of our attributes that this plugin is
// available in render tree.
// TODO(lazyboy): This should be done through the delegate instead. Perhaps
// by firing an event from there.
UpdateDOMAttribute(
"internalinstanceid",
base::UTF8ToUTF16(base::IntToString(browser_plugin_instance_id_)));
return true;
}
void BrowserPlugin::EnableCompositing(bool enable) {
bool enabled = !!compositing_helper_.get();
if (enabled == enable)
return;
if (enable) {
DCHECK(!compositing_helper_.get());
if (!compositing_helper_.get()) {
compositing_helper_ = ChildFrameCompositingHelper::CreateForBrowserPlugin(
weak_ptr_factory_.GetWeakPtr());
}
}
compositing_helper_->EnableCompositing(enable);
compositing_helper_->SetContentsOpaque(contents_opaque_);
if (!enable) {
DCHECK(compositing_helper_.get());
compositing_helper_->OnContainerDestroy();
compositing_helper_ = NULL;
}
}
void BrowserPlugin::destroy() {
if (container_) {
// The BrowserPlugin's WebPluginContainer is deleted immediately after this
// call returns, so let's not keep a reference to it around.
g_plugin_container_map.Get().erase(container_);
}
container_ = NULL;
// Will be a no-op if the mouse is not currently locked.
RenderViewImpl* render_view =
RenderViewImpl::FromRoutingID(render_view_routing_id());
if (render_view)
render_view->mouse_lock_dispatcher()->OnLockTargetDestroyed(this);
base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}
v8::Local<v8::Object> BrowserPlugin::v8ScriptableObject(v8::Isolate* isolate) {
return delegate_->V8ScriptableObject(isolate);
}
bool BrowserPlugin::supportsKeyboardFocus() const {
return true;
}
bool BrowserPlugin::supportsEditCommands() const {
return true;
}
bool BrowserPlugin::supportsInputMethod() const {
return true;
}
bool BrowserPlugin::canProcessDrag() const {
return true;
}
void BrowserPlugin::paint(WebCanvas* canvas, const WebRect& rect) {
if (guest_crashed_) {
if (!sad_guest_) // Lazily initialize bitmap.
sad_guest_ = content::GetContentClient()->renderer()->
GetSadWebViewBitmap();
// content_shell does not have the sad plugin bitmap, so we'll paint black
// instead to make it clear that something went wrong.
if (sad_guest_) {
PaintSadPlugin(canvas, plugin_rect_, *sad_guest_);
return;
}
}
SkAutoCanvasRestore auto_restore(canvas, true);
canvas->translate(plugin_rect_.x(), plugin_rect_.y());
SkRect image_data_rect = SkRect::MakeXYWH(
SkIntToScalar(0),
SkIntToScalar(0),
SkIntToScalar(plugin_rect_.width()),
SkIntToScalar(plugin_rect_.height()));
canvas->clipRect(image_data_rect);
// Paint black or white in case we have nothing in our backing store or we
// need to show a gutter.
SkPaint paint;
paint.setStyle(SkPaint::kFill_Style);
paint.setColor(guest_crashed_ ? SK_ColorBLACK : SK_ColorWHITE);
canvas->drawRect(image_data_rect, paint);
}
// static
bool BrowserPlugin::ShouldForwardToBrowserPlugin(
const IPC::Message& message) {
switch (message.type()) {
case BrowserPluginMsg_AdvanceFocus::ID:
case BrowserPluginMsg_CompositorFrameSwapped::ID:
case BrowserPluginMsg_GuestGone::ID:
case BrowserPluginMsg_SetContentsOpaque::ID:
case BrowserPluginMsg_SetCursor::ID:
case BrowserPluginMsg_SetMouseLock::ID:
case BrowserPluginMsg_SetTooltipText::ID:
case BrowserPluginMsg_ShouldAcceptTouchEvents::ID:
return true;
default:
break;
}
return false;
}
void BrowserPlugin::updateGeometry(
const WebRect& window_rect,
const WebRect& clip_rect,
const WebVector<WebRect>& cut_outs_rects,
bool is_visible) {
int old_width = width();
int old_height = height();
plugin_rect_ = window_rect;
if (!ready_) {
if (delegate_)
delegate_->Ready();
ready_ = true;
}
if (!attached())
return;
if (old_width == window_rect.width && old_height == window_rect.height) {
// Let the browser know about the updated view rect.
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_UpdateGeometry(
render_view_routing_id_, browser_plugin_instance_id_, plugin_rect_));
return;
}
BrowserPluginHostMsg_ResizeGuest_Params params;
PopulateResizeGuestParameters(plugin_size(), ¶ms);
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ResizeGuest(
render_view_routing_id_,
browser_plugin_instance_id_,
params));
}
void BrowserPlugin::PopulateResizeGuestParameters(
const gfx::Size& view_size,
BrowserPluginHostMsg_ResizeGuest_Params* params) {
params->view_size = view_size;
params->scale_factor = GetDeviceScaleFactor();
if (last_device_scale_factor_ != params->scale_factor) {
last_device_scale_factor_ = params->scale_factor;
params->repaint = true;
}
}
void BrowserPlugin::updateFocus(bool focused) {
plugin_focused_ = focused;
UpdateGuestFocusState();
}
void BrowserPlugin::updateVisibility(bool visible) {
if (visible_ == visible)
return;
visible_ = visible;
if (!attached())
return;
if (compositing_helper_.get())
compositing_helper_->UpdateVisibility(visible);
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_SetVisibility(
render_view_routing_id_,
browser_plugin_instance_id_,
visible));
}
bool BrowserPlugin::acceptsInputEvents() {
return true;
}
bool BrowserPlugin::handleInputEvent(const blink::WebInputEvent& event,
blink::WebCursorInfo& cursor_info) {
if (guest_crashed_ || !attached())
return false;
if (event.type == blink::WebInputEvent::ContextMenu)
return true;
if (blink::WebInputEvent::isKeyboardEventType(event.type) &&
!edit_commands_.empty()) {
BrowserPluginManager::Get()->Send(
new BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent(
render_view_routing_id_,
browser_plugin_instance_id_,
edit_commands_));
edit_commands_.clear();
}
BrowserPluginManager::Get()->Send(
new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
browser_plugin_instance_id_,
plugin_rect_,
&event));
GetWebKitCursorInfo(cursor_, &cursor_info);
return true;
}
bool BrowserPlugin::handleDragStatusUpdate(blink::WebDragStatus drag_status,
const blink::WebDragData& drag_data,
blink::WebDragOperationsMask mask,
const blink::WebPoint& position,
const blink::WebPoint& screen) {
if (guest_crashed_ || !attached())
return false;
BrowserPluginManager::Get()->Send(
new BrowserPluginHostMsg_DragStatusUpdate(
render_view_routing_id_,
browser_plugin_instance_id_,
drag_status,
DropDataBuilder::Build(drag_data),
mask,
position));
return true;
}
void BrowserPlugin::didReceiveResponse(
const blink::WebURLResponse& response) {
}
void BrowserPlugin::didReceiveData(const char* data, int data_length) {
if (delegate_)
delegate_->DidReceiveData(data, data_length);
}
void BrowserPlugin::didFinishLoading() {
if (delegate_)
delegate_->DidFinishLoading();
}
void BrowserPlugin::didFailLoading(const blink::WebURLError& error) {
}
void BrowserPlugin::didFinishLoadingFrameRequest(const blink::WebURL& url,
void* notify_data) {
}
void BrowserPlugin::didFailLoadingFrameRequest(
const blink::WebURL& url,
void* notify_data,
const blink::WebURLError& error) {
}
bool BrowserPlugin::executeEditCommand(const blink::WebString& name) {
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ExecuteEditCommand(
render_view_routing_id_,
browser_plugin_instance_id_,
name.utf8()));
// BrowserPlugin swallows edit commands.
return true;
}
bool BrowserPlugin::executeEditCommand(const blink::WebString& name,
const blink::WebString& value) {
edit_commands_.push_back(EditCommand(name.utf8(), value.utf8()));
// BrowserPlugin swallows edit commands.
return true;
}
bool BrowserPlugin::setComposition(
const blink::WebString& text,
const blink::WebVector<blink::WebCompositionUnderline>& underlines,
int selectionStart,
int selectionEnd) {
if (!attached())
return false;
std::vector<blink::WebCompositionUnderline> std_underlines;
for (size_t i = 0; i < underlines.size(); ++i) {
std_underlines.push_back(underlines[i]);
}
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_ImeSetComposition(
render_view_routing_id_,
browser_plugin_instance_id_,
text.utf8(),
std_underlines,
selectionStart,
selectionEnd));
// TODO(kochi): This assumes the IPC handling always succeeds.
return true;
}
bool BrowserPlugin::confirmComposition(
const blink::WebString& text,
blink::WebWidget::ConfirmCompositionBehavior selectionBehavior) {
if (!attached())
return false;
bool keep_selection = (selectionBehavior == blink::WebWidget::KeepSelection);
BrowserPluginManager::Get()->Send(
new BrowserPluginHostMsg_ImeConfirmComposition(
render_view_routing_id_,
browser_plugin_instance_id_,
text.utf8(),
keep_selection));
// TODO(kochi): This assumes the IPC handling always succeeds.
return true;
}
void BrowserPlugin::extendSelectionAndDelete(int before, int after) {
if (!attached())
return;
BrowserPluginManager::Get()->Send(
new BrowserPluginHostMsg_ExtendSelectionAndDelete(
render_view_routing_id_,
browser_plugin_instance_id_,
before,
after));
}
void BrowserPlugin::OnLockMouseACK(bool succeeded) {
mouse_locked_ = succeeded;
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_LockMouse_ACK(
render_view_routing_id_,
browser_plugin_instance_id_,
succeeded));
}
void BrowserPlugin::OnMouseLockLost() {
mouse_locked_ = false;
BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_UnlockMouse_ACK(
render_view_routing_id_,
browser_plugin_instance_id_));
}
bool BrowserPlugin::HandleMouseLockedInputEvent(
const blink::WebMouseEvent& event) {
BrowserPluginManager::Get()->Send(
new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
browser_plugin_instance_id_,
plugin_rect_,
&event));
return true;
}
} // namespace content
|