Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 2426423004: Remove some linked_ptr from /content (Closed)
Patch Set: return owned pointer Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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::WrapUnique(new BrowserPluginMsg_SetTooltipText(
Avi (use Gerrit) 2016/10/20 15:08:12 SendMessageToEmbedder(base::MakeUnique<BrowserPlug
limasdf 2016/10/20 15:56:19 Done.
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
231 WebContentsImpl* BrowserPluginGuest::CreateNewGuestWindow( 232 WebContentsImpl* BrowserPluginGuest::CreateNewGuestWindow(
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::WrapUnique(
397 new BrowserPluginMsg_SetMouseLock(browser_plugin_instance_id(), allow)); 398 new BrowserPluginMsg_SetMouseLock(browser_plugin_instance_id(), allow)));
Avi (use Gerrit) 2016/10/20 15:08:12 base::MakeUnique here too
limasdf 2016/10/20 15:56:19 Done.
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(
407 browser_plugin_instance_id(), surface_id, frame_size, scale_factor, 408 base::WrapUnique(new BrowserPluginMsg_SetChildFrameSurface(
Avi (use Gerrit) 2016/10/20 15:08:12 base::MakeUnique here too
limasdf 2016/10/20 15:56:19 Done.
408 sequence)); 409 browser_plugin_instance_id(), surface_id, frame_size, scale_factor,
410 sequence)));
409 } 411 }
410 412
411 void BrowserPluginGuest::OnSatisfySequence( 413 void BrowserPluginGuest::OnSatisfySequence(
412 int instance_id, 414 int instance_id,
413 const cc::SurfaceSequence& sequence) { 415 const cc::SurfaceSequence& sequence) {
414 std::vector<uint32_t> sequences; 416 std::vector<uint32_t> sequences;
415 sequences.push_back(sequence.sequence); 417 sequences.push_back(sequence.sequence);
416 cc::SurfaceManager* manager = GetSurfaceManager(); 418 cc::SurfaceManager* manager = GetSurfaceManager();
417 manager->DidSatisfySequences(sequence.frame_sink_id, &sequences); 419 manager->DidSatisfySequences(sequence.frame_sink_id, &sequences);
418 } 420 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 gfx::Point BrowserPluginGuest::GetScreenCoordinates( 487 gfx::Point BrowserPluginGuest::GetScreenCoordinates(
486 const gfx::Point& relative_position) const { 488 const gfx::Point& relative_position) const {
487 if (!attached()) 489 if (!attached())
488 return relative_position; 490 return relative_position;
489 491
490 gfx::Point screen_pos(relative_position); 492 gfx::Point screen_pos(relative_position);
491 screen_pos += guest_window_rect_.OffsetFromOrigin(); 493 screen_pos += guest_window_rect_.OffsetFromOrigin();
492 return screen_pos; 494 return screen_pos;
493 } 495 }
494 496
495 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { 497 void BrowserPluginGuest::SendMessageToEmbedder(
498 std::unique_ptr<IPC::Message> msg) {
496 // During tests, attache() may be true when there is no owner_web_contents_; 499 // During tests, attache() may be true when there is no owner_web_contents_;
497 // in this case just queue any messages we receive. 500 // in this case just queue any messages we receive.
498 if (!attached() || !owner_web_contents_) { 501 if (!attached() || !owner_web_contents_) {
499 // Some pages such as data URLs, javascript URLs, and about:blank 502 // Some pages such as data URLs, javascript URLs, and about:blank
500 // do not load external resources and so they load prior to attachment. 503 // 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 504 // 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 505 // forward them so that the embedder gets a chance to see and process
503 // the load events. 506 // the load events.
504 pending_messages_.push_back(linked_ptr<IPC::Message>(msg)); 507 pending_messages_.push_back(std::move(msg));
505 return; 508 return;
506 } 509 }
507 owner_web_contents_->Send(msg); 510 owner_web_contents_->Send(msg.release());
508 } 511 }
509 512
510 void BrowserPluginGuest::DragSourceEndedAt(int client_x, int client_y, 513 void BrowserPluginGuest::DragSourceEndedAt(int client_x, int client_y,
511 int screen_x, int screen_y, blink::WebDragOperation operation) { 514 int screen_x, int screen_y, blink::WebDragOperation operation) {
512 web_contents()->GetRenderViewHost()->DragSourceEndedAt(client_x, client_y, 515 web_contents()->GetRenderViewHost()->DragSourceEndedAt(client_x, client_y,
513 screen_x, screen_y, operation); 516 screen_x, screen_y, operation);
514 seen_embedder_drag_source_ended_at_ = true; 517 seen_embedder_drag_source_ended_at_ = true;
515 EndSystemDragIfApplicable(); 518 EndSystemDragIfApplicable();
516 } 519 }
517 520
(...skipping 30 matching lines...) Expand all
548 } 551 }
549 552
550 void BrowserPluginGuest::EmbedderSystemDragEnded() { 553 void BrowserPluginGuest::EmbedderSystemDragEnded() {
551 seen_embedder_system_drag_ended_ = true; 554 seen_embedder_system_drag_ended_ = true;
552 EndSystemDragIfApplicable(); 555 EndSystemDragIfApplicable();
553 } 556 }
554 557
555 // TODO(wjmaclean): Replace this approach with ones based on std::function 558 // TODO(wjmaclean): Replace this approach with ones based on std::function
556 // as in https://codereview.chromium.org/1404353004/ once all Chrome platforms 559 // as in https://codereview.chromium.org/1404353004/ once all Chrome platforms
557 // support this. https://crbug.com/544212 560 // support this. https://crbug.com/544212
558 IPC::Message* BrowserPluginGuest::UpdateInstanceIdIfNecessary( 561 std::unique_ptr<IPC::Message> BrowserPluginGuest::UpdateInstanceIdIfNecessary(
559 IPC::Message* msg) const { 562 std::unique_ptr<IPC::Message> msg) const {
560 DCHECK(msg); 563 DCHECK(msg.get());
561 564
562 int msg_browser_plugin_instance_id = browser_plugin::kInstanceIDNone; 565 int msg_browser_plugin_instance_id = browser_plugin::kInstanceIDNone;
563 base::PickleIterator iter(*msg); 566 base::PickleIterator iter(*msg.get());
564 if (!iter.ReadInt(&msg_browser_plugin_instance_id) || 567 if (!iter.ReadInt(&msg_browser_plugin_instance_id) ||
565 msg_browser_plugin_instance_id != browser_plugin::kInstanceIDNone) { 568 msg_browser_plugin_instance_id != browser_plugin::kInstanceIDNone) {
566 return msg; 569 return msg;
567 } 570 }
568 571
569 // This method may be called with no browser_plugin_instance_id in tests. 572 // This method may be called with no browser_plugin_instance_id in tests.
570 if (!browser_plugin_instance_id()) 573 if (!browser_plugin_instance_id())
571 return msg; 574 return msg;
572 575
573 std::unique_ptr<IPC::Message> new_msg( 576 std::unique_ptr<IPC::Message> new_msg(
574 new IPC::Message(msg->routing_id(), msg->type(), msg->priority())); 577 new IPC::Message(msg->routing_id(), msg->type(), msg->priority()));
575 new_msg->WriteInt(browser_plugin_instance_id()); 578 new_msg->WriteInt(browser_plugin_instance_id());
576 579
577 // Copy remaining payload from original message. 580 // Copy remaining payload from original message.
578 // TODO(wjmaclean): it would be nice if IPC::PickleIterator had a method 581 // TODO(wjmaclean): it would be nice if IPC::PickleIterator had a method
579 // like 'RemainingBytes()' so that we don't have to include implementation- 582 // like 'RemainingBytes()' so that we don't have to include implementation-
580 // specific details like sizeof() in the next line. 583 // specific details like sizeof() in the next line.
581 DCHECK(msg->payload_size() > sizeof(int)); 584 DCHECK(msg->payload_size() > sizeof(int));
582 size_t remaining_bytes = msg->payload_size() - sizeof(int); 585 size_t remaining_bytes = msg->payload_size() - sizeof(int);
583 const char* data = nullptr; 586 const char* data = nullptr;
584 bool read_success = iter.ReadBytes(&data, remaining_bytes); 587 bool read_success = iter.ReadBytes(&data, remaining_bytes);
585 CHECK(read_success) 588 CHECK(read_success)
586 << "Unexpected failure reading remaining IPC::Message payload."; 589 << "Unexpected failure reading remaining IPC::Message payload.";
587 bool write_success = new_msg->WriteBytes(data, remaining_bytes); 590 bool write_success = new_msg->WriteBytes(data, remaining_bytes);
588 CHECK(write_success) 591 CHECK(write_success)
589 << "Unexpected failure writing remaining IPC::Message payload."; 592 << "Unexpected failure writing remaining IPC::Message payload.";
590 593
591 delete msg; 594 return new_msg;
592 return new_msg.release();
593 } 595 }
594 596
595 void BrowserPluginGuest::SendQueuedMessages() { 597 void BrowserPluginGuest::SendQueuedMessages() {
596 if (!attached()) 598 if (!attached())
597 return; 599 return;
598 600
599 while (!pending_messages_.empty()) { 601 while (!pending_messages_.empty()) {
600 linked_ptr<IPC::Message> message_ptr = pending_messages_.front(); 602 std::unique_ptr<IPC::Message> message_ptr =
603 std::move(pending_messages_.front());
601 pending_messages_.pop_front(); 604 pending_messages_.pop_front();
602 SendMessageToEmbedder( 605 SendMessageToEmbedder(UpdateInstanceIdIfNecessary(std::move(message_ptr)));
603 UpdateInstanceIdIfNecessary(message_ptr.release()));
604 } 606 }
605 } 607 }
606 608
607 void BrowserPluginGuest::SendTextInputTypeChangedToView( 609 void BrowserPluginGuest::SendTextInputTypeChangedToView(
608 RenderWidgetHostViewBase* guest_rwhv) { 610 RenderWidgetHostViewBase* guest_rwhv) {
609 if (!guest_rwhv) 611 if (!guest_rwhv)
610 return; 612 return;
611 613
612 if (!owner_web_contents_) { 614 if (!owner_web_contents_) {
613 // If we were showing an interstitial, then we can end up here during 615 // If we were showing an interstitial, then we can end up here during
(...skipping 22 matching lines...) Expand all
636 RenderViewHost* rvh = GetWebContents()->GetRenderViewHost(); 638 RenderViewHost* rvh = GetWebContents()->GetRenderViewHost();
637 // TODO(fsamuel): Investigate whether it's possible to update state earlier 639 // TODO(fsamuel): Investigate whether it's possible to update state earlier
638 // here (see http://crbug.com/158151). 640 // here (see http://crbug.com/158151).
639 Send(new InputMsg_SetFocus(routing_id(), focused_)); 641 Send(new InputMsg_SetFocus(routing_id(), focused_));
640 UpdateVisibility(); 642 UpdateVisibility();
641 643
642 // In case we've created a new guest render process after a crash, let the 644 // 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, 645 // associated BrowserPlugin know. We only need to send this if we're attached,
644 // as guest_crashed_ is cleared automatically on attach anyways. 646 // as guest_crashed_ is cleared automatically on attach anyways.
645 if (attached()) { 647 if (attached()) {
646 SendMessageToEmbedder( 648 SendMessageToEmbedder(base::WrapUnique(
647 new BrowserPluginMsg_GuestReady(browser_plugin_instance_id())); 649 new BrowserPluginMsg_GuestReady(browser_plugin_instance_id())));
Avi (use Gerrit) 2016/10/20 15:08:12 MakeUnique
limasdf 2016/10/20 15:56:19 Done.
648 } 650 }
649 651
650 RenderWidgetHostImpl::From(rvh->GetWidget()) 652 RenderWidgetHostImpl::From(rvh->GetWidget())
651 ->set_hung_renderer_delay( 653 ->set_hung_renderer_delay(
652 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)); 654 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs));
653 } 655 }
654 656
655 void BrowserPluginGuest::RenderProcessGone(base::TerminationStatus status) { 657 void BrowserPluginGuest::RenderProcessGone(base::TerminationStatus status) {
656 SendMessageToEmbedder( 658 SendMessageToEmbedder(base::WrapUnique(
657 new BrowserPluginMsg_GuestGone(browser_plugin_instance_id())); 659 new BrowserPluginMsg_GuestGone(browser_plugin_instance_id())));
Avi (use Gerrit) 2016/10/20 15:08:12 MakeUnique
limasdf 2016/10/20 15:56:20 Done.
658 switch (status) { 660 switch (status) {
659 #if defined(OS_CHROMEOS) 661 #if defined(OS_CHROMEOS)
660 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM: 662 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM:
661 #endif 663 #endif
662 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED: 664 case base::TERMINATION_STATUS_PROCESS_WAS_KILLED:
663 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Killed")); 665 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Killed"));
664 break; 666 break;
665 case base::TERMINATION_STATUS_PROCESS_CRASHED: 667 case base::TERMINATION_STATUS_PROCESS_CRASHED:
666 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Crashed")); 668 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Crashed"));
667 break; 669 break;
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 return; 950 return;
949 951
950 guest_visible_ = visible; 952 guest_visible_ = visible;
951 if (embedder_visible_ && guest_visible_) 953 if (embedder_visible_ && guest_visible_)
952 GetWebContents()->WasShown(); 954 GetWebContents()->WasShown();
953 else 955 else
954 GetWebContents()->WasHidden(); 956 GetWebContents()->WasHidden();
955 } 957 }
956 958
957 void BrowserPluginGuest::OnUnlockMouse() { 959 void BrowserPluginGuest::OnUnlockMouse() {
958 SendMessageToEmbedder( 960 SendMessageToEmbedder(base::WrapUnique(
959 new BrowserPluginMsg_SetMouseLock(browser_plugin_instance_id(), false)); 961 new BrowserPluginMsg_SetMouseLock(browser_plugin_instance_id(), false)));
Avi (use Gerrit) 2016/10/20 15:08:12 MakeUnique
limasdf 2016/10/20 15:56:19 Done.
960 } 962 }
961 963
962 void BrowserPluginGuest::OnUnlockMouseAck(int browser_plugin_instance_id) { 964 void BrowserPluginGuest::OnUnlockMouseAck(int browser_plugin_instance_id) {
963 // mouse_locked_ could be false here if the lock attempt was cancelled due 965 // 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 966 // to window focus, or for various other reasons before the guest was informed
965 // of the lock's success. 967 // of the lock's success.
966 if (mouse_locked_) 968 if (mouse_locked_)
967 Send(new ViewMsg_MouseLockLost(routing_id())); 969 Send(new ViewMsg_MouseLockLost(routing_id()));
968 mouse_locked_ = false; 970 mouse_locked_ = false;
969 } 971 }
970 972
971 void BrowserPluginGuest::OnUpdateGeometry(int browser_plugin_instance_id, 973 void BrowserPluginGuest::OnUpdateGeometry(int browser_plugin_instance_id,
972 const gfx::Rect& view_rect) { 974 const gfx::Rect& view_rect) {
973 // The plugin has moved within the embedder without resizing or the 975 // The plugin has moved within the embedder without resizing or the
974 // embedder/container's view rect changing. 976 // embedder/container's view rect changing.
975 guest_window_rect_ = view_rect; 977 guest_window_rect_ = view_rect;
976 GetWebContents()->SendScreenRects(); 978 GetWebContents()->SendScreenRects();
977 } 979 }
978 980
979 void BrowserPluginGuest::OnHasTouchEventHandlers(bool accept) { 981 void BrowserPluginGuest::OnHasTouchEventHandlers(bool accept) {
980 SendMessageToEmbedder( 982 SendMessageToEmbedder(
981 new BrowserPluginMsg_ShouldAcceptTouchEvents( 983 base::WrapUnique(new BrowserPluginMsg_ShouldAcceptTouchEvents(
982 browser_plugin_instance_id(), accept)); 984 browser_plugin_instance_id(), accept)));
Avi (use Gerrit) 2016/10/20 15:08:12 MakeUnique
limasdf 2016/10/20 15:56:19 Done.
983 } 985 }
984 986
985 #if defined(OS_MACOSX) 987 #if defined(OS_MACOSX)
986 void BrowserPluginGuest::OnShowPopup( 988 void BrowserPluginGuest::OnShowPopup(
987 RenderFrameHost* render_frame_host, 989 RenderFrameHost* render_frame_host,
988 const FrameHostMsg_ShowPopup_Params& params) { 990 const FrameHostMsg_ShowPopup_Params& params) {
989 gfx::Rect translated_bounds(params.bounds); 991 gfx::Rect translated_bounds(params.bounds);
990 translated_bounds.Offset(guest_window_rect_.OffsetFromOrigin()); 992 translated_bounds.Offset(guest_window_rect_.OffsetFromOrigin());
991 BrowserPluginPopupMenuHelper popup_menu_helper( 993 BrowserPluginPopupMenuHelper popup_menu_helper(
992 owner_web_contents_->GetMainFrame(), render_frame_host); 994 owner_web_contents_->GetMainFrame(), render_frame_host);
993 popup_menu_helper.ShowPopupMenu(translated_bounds, 995 popup_menu_helper.ShowPopupMenu(translated_bounds,
994 params.item_height, 996 params.item_height,
995 params.item_font_size, 997 params.item_font_size,
996 params.selected_item, 998 params.selected_item,
997 params.popup_items, 999 params.popup_items,
998 params.right_aligned, 1000 params.right_aligned,
999 params.allow_multiple_selection); 1001 params.allow_multiple_selection);
1000 } 1002 }
1001 #endif 1003 #endif
1002 1004
1003 void BrowserPluginGuest::OnShowWidget(int route_id, 1005 void BrowserPluginGuest::OnShowWidget(int route_id,
1004 const gfx::Rect& initial_rect) { 1006 const gfx::Rect& initial_rect) {
1005 int process_id = GetWebContents()->GetRenderProcessHost()->GetID(); 1007 int process_id = GetWebContents()->GetRenderProcessHost()->GetID();
1006 GetWebContents()->ShowCreatedWidget(process_id, route_id, initial_rect); 1008 GetWebContents()->ShowCreatedWidget(process_id, route_id, initial_rect);
1007 } 1009 }
1008 1010
1009 void BrowserPluginGuest::OnTakeFocus(bool reverse) { 1011 void BrowserPluginGuest::OnTakeFocus(bool reverse) {
1010 SendMessageToEmbedder( 1012 SendMessageToEmbedder(base::WrapUnique(new BrowserPluginMsg_AdvanceFocus(
Avi (use Gerrit) 2016/10/20 15:08:12 MakeUnique
limasdf 2016/10/20 15:56:19 Done.
1011 new BrowserPluginMsg_AdvanceFocus(browser_plugin_instance_id(), reverse)); 1013 browser_plugin_instance_id(), reverse)));
1012 } 1014 }
1013 1015
1014 void BrowserPluginGuest::OnTextInputStateChanged(const TextInputState& params) { 1016 void BrowserPluginGuest::OnTextInputStateChanged(const TextInputState& params) {
1015 // Save the state of text input so we can restore it on focus. 1017 // Save the state of text input so we can restore it on focus.
1016 last_text_input_state_.reset(new TextInputState(params)); 1018 last_text_input_state_.reset(new TextInputState(params));
1017 1019
1018 SendTextInputTypeChangedToView( 1020 SendTextInputTypeChangedToView(
1019 static_cast<RenderWidgetHostViewBase*>( 1021 static_cast<RenderWidgetHostViewBase*>(
1020 web_contents()->GetRenderWidgetHostView())); 1022 web_contents()->GetRenderWidgetHostView()));
1021 } 1023 }
(...skipping 12 matching lines...) Expand all
1034 range, character_bounds); 1036 range, character_bounds);
1035 } 1037 }
1036 #endif 1038 #endif
1037 1039
1038 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { 1040 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) {
1039 if (delegate_) 1041 if (delegate_)
1040 delegate_->SetContextMenuPosition(position); 1042 delegate_->SetContextMenuPosition(position);
1041 } 1043 }
1042 1044
1043 } // namespace content 1045 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698