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

Side by Side Diff: chrome/browser/ui/views/tabs/tab_drag_controller.cc

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: new android code Created 8 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 | Annotate | Revision Log
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 "chrome/browser/ui/views/tabs/tab_drag_controller.h" 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <set> 8 #include <set>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 gfx::Point TabDragController::GetWindowCreatePoint( 666 gfx::Point TabDragController::GetWindowCreatePoint(
667 const gfx::Point& origin) const { 667 const gfx::Point& origin) const {
668 if (dock_info_.type() != DockInfo::NONE && dock_info_.in_enable_area()) { 668 if (dock_info_.type() != DockInfo::NONE && dock_info_.in_enable_area()) {
669 // If we're going to dock, we need to return the exact coordinate, 669 // If we're going to dock, we need to return the exact coordinate,
670 // otherwise we may attempt to maximize on the wrong monitor. 670 // otherwise we may attempt to maximize on the wrong monitor.
671 return origin; 671 return origin;
672 } 672 }
673 673
674 // If the cursor is outside the monitor area, move it inside. For example, 674 // If the cursor is outside the monitor area, move it inside. For example,
675 // dropping a tab onto the task bar on Windows produces this situation. 675 // dropping a tab onto the task bar on Windows produces this situation.
676 gfx::Rect work_area = gfx::Screen::GetDisplayNearestPoint(origin).work_area(); 676 gfx::Rect work_area = gfx::Screen::GetScreenFor(
677 source_tabstrip_->GetWidget()->GetNativeView())->
678 GetDisplayNearestPoint(origin).work_area();
677 gfx::Point create_point(origin); 679 gfx::Point create_point(origin);
678 if (!work_area.IsEmpty()) { 680 if (!work_area.IsEmpty()) {
679 if (create_point.x() < work_area.x()) 681 if (create_point.x() < work_area.x())
680 create_point.set_x(work_area.x()); 682 create_point.set_x(work_area.x());
681 else if (create_point.x() > work_area.right()) 683 else if (create_point.x() > work_area.right())
682 create_point.set_x(work_area.right()); 684 create_point.set_x(work_area.right());
683 if (create_point.y() < work_area.y()) 685 if (create_point.y() < work_area.y())
684 create_point.set_y(work_area.y()); 686 create_point.set_y(work_area.y());
685 else if (create_point.y() > work_area.bottom()) 687 else if (create_point.y() > work_area.bottom())
686 create_point.set_y(work_area.bottom()); 688 create_point.set_y(work_area.bottom());
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 aura::Window* widget_window = widget->GetNativeWindow(); 1983 aura::Window* widget_window = widget->GetNativeWindow();
1982 DCHECK(widget_window->GetRootWindow()); 1984 DCHECK(widget_window->GetRootWindow());
1983 gfx::Point touch_point; 1985 gfx::Point touch_point;
1984 bool got_touch_point = widget_window->GetRootWindow()-> 1986 bool got_touch_point = widget_window->GetRootWindow()->
1985 gesture_recognizer()->GetLastTouchPointForTarget(widget_window, 1987 gesture_recognizer()->GetLastTouchPointForTarget(widget_window,
1986 &touch_point); 1988 &touch_point);
1987 DCHECK(got_touch_point); 1989 DCHECK(got_touch_point);
1988 return touch_point; 1990 return touch_point;
1989 } 1991 }
1990 #endif 1992 #endif
1991 return gfx::Screen::GetCursorScreenPoint(); 1993 return gfx::Screen::GetScreenFor(
1994 GetAttachedBrowserWidget()->GetNativeView())->GetCursorScreenPoint();
1992 } 1995 }
1993 1996
1994 gfx::Point TabDragController::GetWindowOffset( 1997 gfx::Point TabDragController::GetWindowOffset(
1995 const gfx::Point& point_in_screen) { 1998 const gfx::Point& point_in_screen) {
1996 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? 1999 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ?
1997 attached_tabstrip_ : source_tabstrip_; 2000 attached_tabstrip_ : source_tabstrip_;
1998 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); 2001 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView();
1999 2002
2000 gfx::Point offset = point_in_screen; 2003 gfx::Point offset = point_in_screen;
2001 views::View::ConvertPointFromScreen(toplevel_view, &offset); 2004 views::View::ConvertPointFromScreen(toplevel_view, &offset);
2002 return offset; 2005 return offset;
2003 } 2006 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698