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

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

Issue 2544223002: Fix the position of context menu for BrowserPlugins inside OOPIF (Closed)
Patch Set: Addressing lfg@'s comments Created 4 years 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
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 resent_wheel_event.resendingPluginId = browser_plugin_instance_id_; 487 resent_wheel_event.resendingPluginId = browser_plugin_instance_id_;
488 // TODO(wjmaclean): Initialize latency info correctly for OOPIFs. 488 // TODO(wjmaclean): Initialize latency info correctly for OOPIFs.
489 // https://crbug.com/613628 489 // https://crbug.com/613628
490 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL); 490 ui::LatencyInfo latency_info(ui::SourceEventType::WHEEL);
491 view->ProcessMouseWheelEvent(resent_wheel_event, latency_info); 491 view->ProcessMouseWheelEvent(resent_wheel_event, latency_info);
492 } else { 492 } else {
493 NOTIMPLEMENTED(); 493 NOTIMPLEMENTED();
494 } 494 }
495 } 495 }
496 496
497 gfx::Point BrowserPluginGuest::GetCoordinatesInEmbedderWebContents(
498 const gfx::Point& relative_point) {
499 RenderWidgetHostView* owner_rwhv = GetOwnerRenderWidgetHostView();
500 if (!owner_rwhv)
501 return relative_point;
502
503 gfx::Point point(relative_point);
504
505 // Add the offset form the embedder web contents view.
506 point +=
507 owner_rwhv->TransformPointToRootCoordSpace(guest_window_rect_.origin())
508 .OffsetFromOrigin();
509 return point;
510 }
511
497 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { 512 WebContentsImpl* BrowserPluginGuest::GetWebContents() const {
498 return static_cast<WebContentsImpl*>(web_contents()); 513 return static_cast<WebContentsImpl*>(web_contents());
499 } 514 }
500 515
501 gfx::Point BrowserPluginGuest::GetScreenCoordinates( 516 gfx::Point BrowserPluginGuest::GetScreenCoordinates(
502 const gfx::Point& relative_position) const { 517 const gfx::Point& relative_position) const {
503 if (!attached()) 518 if (!attached())
504 return relative_position; 519 return relative_position;
505 520
506 gfx::Point screen_pos(relative_position); 521 gfx::Point screen_pos(relative_position);
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 range, character_bounds); 1078 range, character_bounds);
1064 } 1079 }
1065 #endif 1080 #endif
1066 1081
1067 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { 1082 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) {
1068 if (delegate_) 1083 if (delegate_)
1069 delegate_->SetContextMenuPosition(position); 1084 delegate_->SetContextMenuPosition(position);
1070 } 1085 }
1071 1086
1072 } // namespace content 1087 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698