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/pickle.h" | 10 #include "base/pickle.h" |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
489 host->ForwardWheelEvent(resent_wheel_event); | 489 host->ForwardWheelEvent(resent_wheel_event); |
490 } else { | 490 } else { |
491 NOTIMPLEMENTED(); | 491 NOTIMPLEMENTED(); |
492 } | 492 } |
493 } | 493 } |
494 | 494 |
495 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { | 495 WebContentsImpl* BrowserPluginGuest::GetWebContents() const { |
496 return static_cast<WebContentsImpl*>(web_contents()); | 496 return static_cast<WebContentsImpl*>(web_contents()); |
497 } | 497 } |
498 | 498 |
499 gfx::Point BrowserPluginGuest::GetScreenCoordinates( | 499 gfx::Point BrowserPluginGuest::GetScreenCoordinates( |
tdresser
2015/11/04 19:24:17
Can this be rewritten in terms of the other GetScr
wjmaclean
2015/11/05 14:55:46
My bad ... the float version of this function shou
| |
500 const gfx::Point& relative_position) const { | 500 const gfx::Point& relative_position) const { |
501 if (!attached()) | 501 if (!attached()) |
502 return relative_position; | 502 return relative_position; |
503 | 503 |
504 gfx::Point screen_pos(relative_position); | 504 gfx::Point screen_pos(relative_position); |
505 screen_pos += guest_window_rect_.OffsetFromOrigin(); | 505 screen_pos += guest_window_rect_.OffsetFromOrigin(); |
506 return screen_pos; | 506 return screen_pos; |
507 } | 507 } |
508 | 508 |
509 gfx::PointF BrowserPluginGuest::GetScreenCoordinates( | |
510 const gfx::PointF& relative_position) const { | |
511 if (!attached()) | |
512 return relative_position; | |
513 | |
514 gfx::PointF screen_pos(relative_position); | |
515 screen_pos += guest_window_rect_.OffsetFromOrigin(); | |
516 return screen_pos; | |
517 } | |
518 | |
509 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { | 519 void BrowserPluginGuest::SendMessageToEmbedder(IPC::Message* msg) { |
510 // During tests, attache() may be true when there is no owner_web_contents_; | 520 // During tests, attache() may be true when there is no owner_web_contents_; |
511 // in this case just queue any messages we receive. | 521 // in this case just queue any messages we receive. |
512 if (!attached() || !owner_web_contents_) { | 522 if (!attached() || !owner_web_contents_) { |
513 // Some pages such as data URLs, javascript URLs, and about:blank | 523 // Some pages such as data URLs, javascript URLs, and about:blank |
514 // do not load external resources and so they load prior to attachment. | 524 // do not load external resources and so they load prior to attachment. |
515 // As a result, we must save all these IPCs until attachment and then | 525 // As a result, we must save all these IPCs until attachment and then |
516 // forward them so that the embedder gets a chance to see and process | 526 // forward them so that the embedder gets a chance to see and process |
517 // the load events. | 527 // the load events. |
518 pending_messages_.push_back(linked_ptr<IPC::Message>(msg)); | 528 pending_messages_.push_back(linked_ptr<IPC::Message>(msg)); |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1055 range, character_bounds); | 1065 range, character_bounds); |
1056 } | 1066 } |
1057 #endif | 1067 #endif |
1058 | 1068 |
1059 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { | 1069 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { |
1060 if (delegate_) | 1070 if (delegate_) |
1061 delegate_->SetContextMenuPosition(position); | 1071 delegate_->SetContextMenuPosition(position); |
1062 } | 1072 } |
1063 | 1073 |
1064 } // namespace content | 1074 } // namespace content |
OLD | NEW |