| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" |
| 12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 13 #include "base/pickle.h" | 14 #include "base/pickle.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 16 #include "cc/surfaces/surface.h" | 17 #include "cc/surfaces/surface.h" |
| 17 #include "cc/surfaces/surface_manager.h" | 18 #include "cc/surfaces/surface_manager.h" |
| 18 #include "content/browser/browser_plugin/browser_plugin_embedder.h" | 19 #include "content/browser/browser_plugin/browser_plugin_embedder.h" |
| 19 #include "content/browser/browser_thread_impl.h" | 20 #include "content/browser/browser_thread_impl.h" |
| 20 #include "content/browser/child_process_security_policy_impl.h" | 21 #include "content/browser/child_process_security_policy_impl.h" |
| 21 #include "content/browser/compositor/surface_utils.h" | 22 #include "content/browser/compositor/surface_utils.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 RenderWidgetHostViewBase* rwhv = static_cast<RenderWidgetHostViewBase*>( | 211 RenderWidgetHostViewBase* rwhv = static_cast<RenderWidgetHostViewBase*>( |
| 211 rwh->GetView()); | 212 rwh->GetView()); |
| 212 SendTextInputTypeChangedToView(rwhv); | 213 SendTextInputTypeChangedToView(rwhv); |
| 213 } | 214 } |
| 214 | 215 |
| 215 void BrowserPluginGuest::SetTooltipText(const base::string16& tooltip_text) { | 216 void BrowserPluginGuest::SetTooltipText(const base::string16& tooltip_text) { |
| 216 if (tooltip_text == current_tooltip_text_) | 217 if (tooltip_text == current_tooltip_text_) |
| 217 return; | 218 return; |
| 218 current_tooltip_text_ = tooltip_text; | 219 current_tooltip_text_ = tooltip_text; |
| 219 | 220 |
| 220 SendMessageToEmbedder(new BrowserPluginMsg_SetTooltipText( | 221 SendMessageToEmbedder(base::MakeUnique<BrowserPluginMsg_SetTooltipText>( |
| 221 browser_plugin_instance_id_, tooltip_text)); | 222 browser_plugin_instance_id_, tooltip_text)); |
| 222 } | 223 } |
| 223 | 224 |
| 224 bool BrowserPluginGuest::LockMouse(bool allowed) { | 225 bool BrowserPluginGuest::LockMouse(bool allowed) { |
| 225 if (!attached() || (mouse_locked_ == allowed)) | 226 if (!attached() || (mouse_locked_ == allowed)) |
| 226 return false; | 227 return false; |
| 227 | 228 |
| 228 return embedder_web_contents()->GotResponseToLockMouseRequest(allowed); | 229 return embedder_web_contents()->GotResponseToLockMouseRequest(allowed); |
| 229 } | 230 } |
| 230 | 231 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 BrowserPluginGuest::GetBrowserPluginGuestManager() const { | 387 BrowserPluginGuest::GetBrowserPluginGuestManager() const { |
| 387 return GetWebContents()->GetBrowserContext()->GetGuestManager(); | 388 return GetWebContents()->GetBrowserContext()->GetGuestManager(); |
| 388 } | 389 } |
| 389 | 390 |
| 390 void BrowserPluginGuest::EmbedderVisibilityChanged(bool visible) { | 391 void BrowserPluginGuest::EmbedderVisibilityChanged(bool visible) { |
| 391 embedder_visible_ = visible; | 392 embedder_visible_ = visible; |
| 392 UpdateVisibility(); | 393 UpdateVisibility(); |
| 393 } | 394 } |
| 394 | 395 |
| 395 void BrowserPluginGuest::PointerLockPermissionResponse(bool allow) { | 396 void BrowserPluginGuest::PointerLockPermissionResponse(bool allow) { |
| 396 SendMessageToEmbedder( | 397 SendMessageToEmbedder(base::MakeUnique<BrowserPluginMsg_SetMouseLock>( |
| 397 new BrowserPluginMsg_SetMouseLock(browser_plugin_instance_id(), allow)); | 398 browser_plugin_instance_id(), allow)); |
| 398 } | 399 } |
| 399 | 400 |
| 400 void BrowserPluginGuest::SetChildFrameSurface( | 401 void BrowserPluginGuest::SetChildFrameSurface( |
| 401 const cc::SurfaceId& surface_id, | 402 const cc::SurfaceId& surface_id, |
| 402 const gfx::Size& frame_size, | 403 const gfx::Size& frame_size, |
| 403 float scale_factor, | 404 float scale_factor, |
| 404 const cc::SurfaceSequence& sequence) { | 405 const cc::SurfaceSequence& sequence) { |
| 405 has_attached_since_surface_set_ = false; | 406 has_attached_since_surface_set_ = false; |
| 406 SendMessageToEmbedder(new BrowserPluginMsg_SetChildFrameSurface( | 407 SendMessageToEmbedder(base::MakeUnique<BrowserPluginMsg_SetChildFrameSurface>( |
| 407 browser_plugin_instance_id(), surface_id, frame_size, scale_factor, | 408 browser_plugin_instance_id(), surface_id, frame_size, scale_factor, |
| 408 sequence)); | 409 sequence)); |
| 409 } | 410 } |
| 410 | 411 |
| 411 void BrowserPluginGuest::OnSatisfySequence( | 412 void BrowserPluginGuest::OnSatisfySequence( |
| 412 int instance_id, | 413 int instance_id, |
| 413 const cc::SurfaceSequence& sequence) { | 414 const cc::SurfaceSequence& sequence) { |
| 414 std::vector<uint32_t> sequences; | 415 std::vector<uint32_t> sequences; |
| 415 sequences.push_back(sequence.sequence); | 416 sequences.push_back(sequence.sequence); |
| 416 cc::SurfaceManager* manager = GetSurfaceManager(); | 417 cc::SurfaceManager* manager = GetSurfaceManager(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 gfx::Point BrowserPluginGuest::GetScreenCoordinates( | 486 gfx::Point BrowserPluginGuest::GetScreenCoordinates( |
| 486 const gfx::Point& relative_position) const { | 487 const gfx::Point& relative_position) const { |
| 487 if (!attached()) | 488 if (!attached()) |
| 488 return relative_position; | 489 return relative_position; |
| 489 | 490 |
| 490 gfx::Point screen_pos(relative_position); | 491 gfx::Point screen_pos(relative_position); |
| 491 screen_pos += guest_window_rect_.OffsetFromOrigin(); | 492 screen_pos += guest_window_rect_.OffsetFromOrigin(); |
| 492 return screen_pos; | 493 return screen_pos; |
| 493 } | 494 } |
| 494 | 495 |
| 495 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { | 496 void BrowserPluginGuest::SendMessageToEmbedder( |
| 497 std::unique_ptr<IPC::Message> msg) { |
| 496 // During tests, attache() may be true when there is no owner_web_contents_; | 498 // During tests, attache() may be true when there is no owner_web_contents_; |
| 497 // in this case just queue any messages we receive. | 499 // in this case just queue any messages we receive. |
| 498 if (!attached() || !owner_web_contents_) { | 500 if (!attached() || !owner_web_contents_) { |
| 499 // Some pages such as data URLs, javascript URLs, and about:blank | 501 // Some pages such as data URLs, javascript URLs, and about:blank |
| 500 // do not load external resources and so they load prior to attachment. | 502 // do not load external resources and so they load prior to attachment. |
| 501 // As a result, we must save all these IPCs until attachment and then | 503 // As a result, we must save all these IPCs until attachment and then |
| 502 // forward them so that the embedder gets a chance to see and process | 504 // forward them so that the embedder gets a chance to see and process |
| 503 // the load events. | 505 // the load events. |
| 504 pending_messages_.push_back(linked_ptr<IPC::Message>(msg)); | 506 pending_messages_.push_back(std::move(msg)); |
| 505 return; | 507 return; |
| 506 } | 508 } |
| 507 owner_web_contents_->Send(msg); | 509 owner_web_contents_->Send(msg.release()); |
| 508 } | 510 } |
| 509 | 511 |
| 510 void BrowserPluginGuest::DragSourceEndedAt(int client_x, int client_y, | 512 void BrowserPluginGuest::DragSourceEndedAt(int client_x, int client_y, |
| 511 int screen_x, int screen_y, blink::WebDragOperation operation) { | 513 int screen_x, int screen_y, blink::WebDragOperation operation) { |
| 512 web_contents()->GetRenderViewHost()->DragSourceEndedAt(client_x, client_y, | 514 web_contents()->GetRenderViewHost()->DragSourceEndedAt(client_x, client_y, |
| 513 screen_x, screen_y, operation); | 515 screen_x, screen_y, operation); |
| 514 seen_embedder_drag_source_ended_at_ = true; | 516 seen_embedder_drag_source_ended_at_ = true; |
| 515 EndSystemDragIfApplicable(); | 517 EndSystemDragIfApplicable(); |
| 516 } | 518 } |
| 517 | 519 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 548 } | 550 } |
| 549 | 551 |
| 550 void BrowserPluginGuest::EmbedderSystemDragEnded() { | 552 void BrowserPluginGuest::EmbedderSystemDragEnded() { |
| 551 seen_embedder_system_drag_ended_ = true; | 553 seen_embedder_system_drag_ended_ = true; |
| 552 EndSystemDragIfApplicable(); | 554 EndSystemDragIfApplicable(); |
| 553 } | 555 } |
| 554 | 556 |
| 555 // TODO(wjmaclean): Replace this approach with ones based on std::function | 557 // TODO(wjmaclean): Replace this approach with ones based on std::function |
| 556 // as in https://codereview.chromium.org/1404353004/ once all Chrome platforms | 558 // as in https://codereview.chromium.org/1404353004/ once all Chrome platforms |
| 557 // support this. https://crbug.com/544212 | 559 // support this. https://crbug.com/544212 |
| 558 IPC::Message* BrowserPluginGuest::UpdateInstanceIdIfNecessary( | 560 std::unique_ptr<IPC::Message> BrowserPluginGuest::UpdateInstanceIdIfNecessary( |
| 559 IPC::Message* msg) const { | 561 std::unique_ptr<IPC::Message> msg) const { |
| 560 DCHECK(msg); | 562 DCHECK(msg.get()); |
| 561 | 563 |
| 562 int msg_browser_plugin_instance_id = browser_plugin::kInstanceIDNone; | 564 int msg_browser_plugin_instance_id = browser_plugin::kInstanceIDNone; |
| 563 base::PickleIterator iter(*msg); | 565 base::PickleIterator iter(*msg.get()); |
| 564 if (!iter.ReadInt(&msg_browser_plugin_instance_id) || | 566 if (!iter.ReadInt(&msg_browser_plugin_instance_id) || |
| 565 msg_browser_plugin_instance_id != browser_plugin::kInstanceIDNone) { | 567 msg_browser_plugin_instance_id != browser_plugin::kInstanceIDNone) { |
| 566 return msg; | 568 return msg; |
| 567 } | 569 } |
| 568 | 570 |
| 569 // This method may be called with no browser_plugin_instance_id in tests. | 571 // This method may be called with no browser_plugin_instance_id in tests. |
| 570 if (!browser_plugin_instance_id()) | 572 if (!browser_plugin_instance_id()) |
| 571 return msg; | 573 return msg; |
| 572 | 574 |
| 573 std::unique_ptr<IPC::Message> new_msg( | 575 std::unique_ptr<IPC::Message> new_msg( |
| 574 new IPC::Message(msg->routing_id(), msg->type(), msg->priority())); | 576 new IPC::Message(msg->routing_id(), msg->type(), msg->priority())); |
| 575 new_msg->WriteInt(browser_plugin_instance_id()); | 577 new_msg->WriteInt(browser_plugin_instance_id()); |
| 576 | 578 |
| 577 // Copy remaining payload from original message. | 579 // Copy remaining payload from original message. |
| 578 // TODO(wjmaclean): it would be nice if IPC::PickleIterator had a method | 580 // TODO(wjmaclean): it would be nice if IPC::PickleIterator had a method |
| 579 // like 'RemainingBytes()' so that we don't have to include implementation- | 581 // like 'RemainingBytes()' so that we don't have to include implementation- |
| 580 // specific details like sizeof() in the next line. | 582 // specific details like sizeof() in the next line. |
| 581 DCHECK(msg->payload_size() > sizeof(int)); | 583 DCHECK(msg->payload_size() > sizeof(int)); |
| 582 size_t remaining_bytes = msg->payload_size() - sizeof(int); | 584 size_t remaining_bytes = msg->payload_size() - sizeof(int); |
| 583 const char* data = nullptr; | 585 const char* data = nullptr; |
| 584 bool read_success = iter.ReadBytes(&data, remaining_bytes); | 586 bool read_success = iter.ReadBytes(&data, remaining_bytes); |
| 585 CHECK(read_success) | 587 CHECK(read_success) |
| 586 << "Unexpected failure reading remaining IPC::Message payload."; | 588 << "Unexpected failure reading remaining IPC::Message payload."; |
| 587 bool write_success = new_msg->WriteBytes(data, remaining_bytes); | 589 bool write_success = new_msg->WriteBytes(data, remaining_bytes); |
| 588 CHECK(write_success) | 590 CHECK(write_success) |
| 589 << "Unexpected failure writing remaining IPC::Message payload."; | 591 << "Unexpected failure writing remaining IPC::Message payload."; |
| 590 | 592 |
| 591 delete msg; | 593 return new_msg; |
| 592 return new_msg.release(); | |
| 593 } | 594 } |
| 594 | 595 |
| 595 void BrowserPluginGuest::SendQueuedMessages() { | 596 void BrowserPluginGuest::SendQueuedMessages() { |
| 596 if (!attached()) | 597 if (!attached()) |
| 597 return; | 598 return; |
| 598 | 599 |
| 599 while (!pending_messages_.empty()) { | 600 while (!pending_messages_.empty()) { |
| 600 linked_ptr<IPC::Message> message_ptr = pending_messages_.front(); | 601 std::unique_ptr<IPC::Message> message_ptr = |
| 602 std::move(pending_messages_.front()); |
| 601 pending_messages_.pop_front(); | 603 pending_messages_.pop_front(); |
| 602 SendMessageToEmbedder( | 604 SendMessageToEmbedder(UpdateInstanceIdIfNecessary(std::move(message_ptr))); |
| 603 UpdateInstanceIdIfNecessary(message_ptr.release())); | |
| 604 } | 605 } |
| 605 } | 606 } |
| 606 | 607 |
| 607 void BrowserPluginGuest::SendTextInputTypeChangedToView( | 608 void BrowserPluginGuest::SendTextInputTypeChangedToView( |
| 608 RenderWidgetHostViewBase* guest_rwhv) { | 609 RenderWidgetHostViewBase* guest_rwhv) { |
| 609 if (!guest_rwhv) | 610 if (!guest_rwhv) |
| 610 return; | 611 return; |
| 611 | 612 |
| 612 if (!owner_web_contents_) { | 613 if (!owner_web_contents_) { |
| 613 // If we were showing an interstitial, then we can end up here during | 614 // If we were showing an interstitial, then we can end up here during |
| (...skipping 22 matching lines...) Expand all Loading... |
| 636 RenderViewHost* rvh = GetWebContents()->GetRenderViewHost(); | 637 RenderViewHost* rvh = GetWebContents()->GetRenderViewHost(); |
| 637 // TODO(fsamuel): Investigate whether it's possible to update state earlier | 638 // TODO(fsamuel): Investigate whether it's possible to update state earlier |
| 638 // here (see http://crbug.com/158151). | 639 // here (see http://crbug.com/158151). |
| 639 Send(new InputMsg_SetFocus(routing_id(), focused_)); | 640 Send(new InputMsg_SetFocus(routing_id(), focused_)); |
| 640 UpdateVisibility(); | 641 UpdateVisibility(); |
| 641 | 642 |
| 642 // In case we've created a new guest render process after a crash, let the | 643 // In case we've created a new guest render process after a crash, let the |
| 643 // associated BrowserPlugin know. We only need to send this if we're attached, | 644 // associated BrowserPlugin know. We only need to send this if we're attached, |
| 644 // as guest_crashed_ is cleared automatically on attach anyways. | 645 // as guest_crashed_ is cleared automatically on attach anyways. |
| 645 if (attached()) { | 646 if (attached()) { |
| 646 SendMessageToEmbedder( | 647 SendMessageToEmbedder(base::MakeUnique<BrowserPluginMsg_GuestReady>( |
| 647 new BrowserPluginMsg_GuestReady(browser_plugin_instance_id())); | 648 browser_plugin_instance_id())); |
| 648 } | 649 } |
| 649 | 650 |
| 650 RenderWidgetHostImpl::From(rvh->GetWidget()) | 651 RenderWidgetHostImpl::From(rvh->GetWidget()) |
| 651 ->set_hung_renderer_delay( | 652 ->set_hung_renderer_delay( |
| 652 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)); | 653 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)); |
| 653 } | 654 } |
| 654 | 655 |
| 655 void BrowserPluginGuest::RenderProcessGone(base::TerminationStatus status) { | 656 void BrowserPluginGuest::RenderProcessGone(base::TerminationStatus status) { |
| 656 SendMessageToEmbedder( | 657 SendMessageToEmbedder(base::MakeUnique<BrowserPluginMsg_GuestGone>( |
| 657 new BrowserPluginMsg_GuestGone(browser_plugin_instance_id())); | 658 browser_plugin_instance_id())); |
| 658 switch (status) { | 659 switch (status) { |
| 659 #if defined(OS_CHROMEOS) | 660 #if defined(OS_CHROMEOS) |
| 660 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM: | 661 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM: |
| 661 #endif | 662 #endif |
| 662 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: | 663 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: |
| 663 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Killed")); | 664 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Killed")); |
| 664 break; | 665 break; |
| 665 case base::TERMINATION_STATUS_PROCESS_CRASHED: | 666 case base::TERMINATION_STATUS_PROCESS_CRASHED: |
| 666 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Crashed")); | 667 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Crashed")); |
| 667 break; | 668 break; |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 return; | 949 return; |
| 949 | 950 |
| 950 guest_visible_ = visible; | 951 guest_visible_ = visible; |
| 951 if (embedder_visible_ && guest_visible_) | 952 if (embedder_visible_ && guest_visible_) |
| 952 GetWebContents()->WasShown(); | 953 GetWebContents()->WasShown(); |
| 953 else | 954 else |
| 954 GetWebContents()->WasHidden(); | 955 GetWebContents()->WasHidden(); |
| 955 } | 956 } |
| 956 | 957 |
| 957 void BrowserPluginGuest::OnUnlockMouse() { | 958 void BrowserPluginGuest::OnUnlockMouse() { |
| 958 SendMessageToEmbedder( | 959 SendMessageToEmbedder(base::MakeUnique<BrowserPluginMsg_SetMouseLock>( |
| 959 new BrowserPluginMsg_SetMouseLock(browser_plugin_instance_id(), false)); | 960 browser_plugin_instance_id(), false)); |
| 960 } | 961 } |
| 961 | 962 |
| 962 void BrowserPluginGuest::OnUnlockMouseAck(int browser_plugin_instance_id) { | 963 void BrowserPluginGuest::OnUnlockMouseAck(int browser_plugin_instance_id) { |
| 963 // mouse_locked_ could be false here if the lock attempt was cancelled due | 964 // mouse_locked_ could be false here if the lock attempt was cancelled due |
| 964 // to window focus, or for various other reasons before the guest was informed | 965 // to window focus, or for various other reasons before the guest was informed |
| 965 // of the lock's success. | 966 // of the lock's success. |
| 966 if (mouse_locked_) | 967 if (mouse_locked_) |
| 967 Send(new ViewMsg_MouseLockLost(routing_id())); | 968 Send(new ViewMsg_MouseLockLost(routing_id())); |
| 968 mouse_locked_ = false; | 969 mouse_locked_ = false; |
| 969 } | 970 } |
| 970 | 971 |
| 971 void BrowserPluginGuest::OnUpdateGeometry(int browser_plugin_instance_id, | 972 void BrowserPluginGuest::OnUpdateGeometry(int browser_plugin_instance_id, |
| 972 const gfx::Rect& view_rect) { | 973 const gfx::Rect& view_rect) { |
| 973 // The plugin has moved within the embedder without resizing or the | 974 // The plugin has moved within the embedder without resizing or the |
| 974 // embedder/container's view rect changing. | 975 // embedder/container's view rect changing. |
| 975 guest_window_rect_ = view_rect; | 976 guest_window_rect_ = view_rect; |
| 976 GetWebContents()->SendScreenRects(); | 977 GetWebContents()->SendScreenRects(); |
| 977 } | 978 } |
| 978 | 979 |
| 979 void BrowserPluginGuest::OnHasTouchEventHandlers(bool accept) { | 980 void BrowserPluginGuest::OnHasTouchEventHandlers(bool accept) { |
| 980 SendMessageToEmbedder( | 981 SendMessageToEmbedder( |
| 981 new BrowserPluginMsg_ShouldAcceptTouchEvents( | 982 base::MakeUnique<BrowserPluginMsg_ShouldAcceptTouchEvents>( |
| 982 browser_plugin_instance_id(), accept)); | 983 browser_plugin_instance_id(), accept)); |
| 983 } | 984 } |
| 984 | 985 |
| 985 #if defined(OS_MACOSX) | 986 #if defined(OS_MACOSX) |
| 986 void BrowserPluginGuest::OnShowPopup( | 987 void BrowserPluginGuest::OnShowPopup( |
| 987 RenderFrameHost* render_frame_host, | 988 RenderFrameHost* render_frame_host, |
| 988 const FrameHostMsg_ShowPopup_Params& params) { | 989 const FrameHostMsg_ShowPopup_Params& params) { |
| 989 gfx::Rect translated_bounds(params.bounds); | 990 gfx::Rect translated_bounds(params.bounds); |
| 990 translated_bounds.Offset(guest_window_rect_.OffsetFromOrigin()); | 991 translated_bounds.Offset(guest_window_rect_.OffsetFromOrigin()); |
| 991 BrowserPluginPopupMenuHelper popup_menu_helper( | 992 BrowserPluginPopupMenuHelper popup_menu_helper( |
| 992 owner_web_contents_->GetMainFrame(), render_frame_host); | 993 owner_web_contents_->GetMainFrame(), render_frame_host); |
| 993 popup_menu_helper.ShowPopupMenu(translated_bounds, | 994 popup_menu_helper.ShowPopupMenu(translated_bounds, |
| 994 params.item_height, | 995 params.item_height, |
| 995 params.item_font_size, | 996 params.item_font_size, |
| 996 params.selected_item, | 997 params.selected_item, |
| 997 params.popup_items, | 998 params.popup_items, |
| 998 params.right_aligned, | 999 params.right_aligned, |
| 999 params.allow_multiple_selection); | 1000 params.allow_multiple_selection); |
| 1000 } | 1001 } |
| 1001 #endif | 1002 #endif |
| 1002 | 1003 |
| 1003 void BrowserPluginGuest::OnShowWidget(int route_id, | 1004 void BrowserPluginGuest::OnShowWidget(int route_id, |
| 1004 const gfx::Rect& initial_rect) { | 1005 const gfx::Rect& initial_rect) { |
| 1005 int process_id = GetWebContents()->GetRenderProcessHost()->GetID(); | 1006 int process_id = GetWebContents()->GetRenderProcessHost()->GetID(); |
| 1006 GetWebContents()->ShowCreatedWidget(process_id, route_id, initial_rect); | 1007 GetWebContents()->ShowCreatedWidget(process_id, route_id, initial_rect); |
| 1007 } | 1008 } |
| 1008 | 1009 |
| 1009 void BrowserPluginGuest::OnTakeFocus(bool reverse) { | 1010 void BrowserPluginGuest::OnTakeFocus(bool reverse) { |
| 1010 SendMessageToEmbedder( | 1011 SendMessageToEmbedder(base::MakeUnique<BrowserPluginMsg_AdvanceFocus>( |
| 1011 new BrowserPluginMsg_AdvanceFocus(browser_plugin_instance_id(), reverse)); | 1012 browser_plugin_instance_id(), reverse)); |
| 1012 } | 1013 } |
| 1013 | 1014 |
| 1014 void BrowserPluginGuest::OnTextInputStateChanged(const TextInputState& params) { | 1015 void BrowserPluginGuest::OnTextInputStateChanged(const TextInputState& params) { |
| 1015 // Save the state of text input so we can restore it on focus. | 1016 // Save the state of text input so we can restore it on focus. |
| 1016 last_text_input_state_.reset(new TextInputState(params)); | 1017 last_text_input_state_.reset(new TextInputState(params)); |
| 1017 | 1018 |
| 1018 SendTextInputTypeChangedToView( | 1019 SendTextInputTypeChangedToView( |
| 1019 static_cast<RenderWidgetHostViewBase*>( | 1020 static_cast<RenderWidgetHostViewBase*>( |
| 1020 web_contents()->GetRenderWidgetHostView())); | 1021 web_contents()->GetRenderWidgetHostView())); |
| 1021 } | 1022 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1034 range, character_bounds); | 1035 range, character_bounds); |
| 1035 } | 1036 } |
| 1036 #endif | 1037 #endif |
| 1037 | 1038 |
| 1038 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { | 1039 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { |
| 1039 if (delegate_) | 1040 if (delegate_) |
| 1040 delegate_->SetContextMenuPosition(position); | 1041 delegate_->SetContextMenuPosition(position); |
| 1041 } | 1042 } |
| 1042 | 1043 |
| 1043 } // namespace content | 1044 } // namespace content |
| OLD | NEW |