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

Unified Diff: chrome/browser/tab_contents/chrome_web_contents_view_delegate_views.cc

Issue 10409011: Aura/ash: On Desktops, use a aura::client to resolve screen coordinates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge with trunk. Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/aura/aura.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/chrome_web_contents_view_delegate_views.cc
diff --git a/chrome/browser/tab_contents/chrome_web_contents_view_delegate_views.cc b/chrome/browser/tab_contents/chrome_web_contents_view_delegate_views.cc
index cde829d32a3f96dd6b136716cd291a0989ebf550..91b454b764068dad176fe42b2815cf06f1a83dbb 100644
--- a/chrome/browser/tab_contents/chrome_web_contents_view_delegate_views.cc
+++ b/chrome/browser/tab_contents/chrome_web_contents_view_delegate_views.cc
@@ -21,6 +21,8 @@
#if defined(USE_AURA)
#include "chrome/browser/tab_contents/web_drag_bookmark_handler_aura.h"
+#include "ui/aura/client/screen_position_client.h"
+#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#else
#include "chrome/browser/tab_contents/web_drag_bookmark_handler_win.h"
@@ -41,7 +43,6 @@ ChromeWebContentsViewDelegateViews::~ChromeWebContentsViewDelegateViews() {
views::ViewStorage* view_storage = views::ViewStorage::GetInstance();
if (view_storage->RetrieveView(last_focused_view_storage_id_) != NULL)
view_storage->RemoveView(last_focused_view_storage_id_);
-
}
content::WebDragDestDelegate*
@@ -133,9 +134,21 @@ void ChromeWebContentsViewDelegateViews::ShowContextMenu(
gfx::Point screen_point(params.x, params.y);
#if defined(USE_AURA)
- gfx::Point view_origin = web_contents_->GetView()->GetNativeView()->
- GetBoundsInRootWindow().origin();
- screen_point.Offset(view_origin.x(), view_origin.y());
+ // Convert from content coordinates to window coordinates.
+ aura::Window* web_contents_window =
+ web_contents_->GetView()->GetNativeView();
+ aura::RootWindow* root_window = web_contents_window->GetRootWindow();
+ aura::Window::ConvertPointToWindow(web_contents_window, root_window,
+ &screen_point);
+
+ // If we are on the desktop, transform the data from our toplevel window
+ // coordinates to screen coordinates.
+ aura::Window* toplevel_window =
+ web_contents_->GetView()->GetTopLevelNativeWindow();
+ aura::client::ScreenPositionClient* screen_position_client =
+ aura::client::GetScreenPositionClient(toplevel_window);
+ if (screen_position_client)
+ screen_position_client->ConvertToScreenPoint(&screen_point);
#else
POINT temp = screen_point.ToPOINT();
ClientToScreen(web_contents_->GetView()->GetNativeView(), &temp);
« no previous file with comments | « no previous file | ui/aura/aura.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698