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 "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/callback.h" | 10 #include "base/callback.h" |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 gfx::Point TabDragController::GetWindowCreatePoint( | 664 gfx::Point TabDragController::GetWindowCreatePoint( |
665 const gfx::Point& origin) const { | 665 const gfx::Point& origin) const { |
666 if (dock_info_.type() != DockInfo::NONE && dock_info_.in_enable_area()) { | 666 if (dock_info_.type() != DockInfo::NONE && dock_info_.in_enable_area()) { |
667 // If we're going to dock, we need to return the exact coordinate, | 667 // If we're going to dock, we need to return the exact coordinate, |
668 // otherwise we may attempt to maximize on the wrong monitor. | 668 // otherwise we may attempt to maximize on the wrong monitor. |
669 return origin; | 669 return origin; |
670 } | 670 } |
671 | 671 |
672 // If the cursor is outside the monitor area, move it inside. For example, | 672 // If the cursor is outside the monitor area, move it inside. For example, |
673 // dropping a tab onto the task bar on Windows produces this situation. | 673 // dropping a tab onto the task bar on Windows produces this situation. |
674 gfx::Rect work_area = gfx::Screen::GetDisplayNearestPoint(origin).work_area(); | 674 gfx::Rect work_area = gfx::Screen::GetDisplayNearestPoint( |
| 675 gfx::Screen::BadTwoWorldsContext(), origin).work_area(); |
675 gfx::Point create_point(origin); | 676 gfx::Point create_point(origin); |
676 if (!work_area.IsEmpty()) { | 677 if (!work_area.IsEmpty()) { |
677 if (create_point.x() < work_area.x()) | 678 if (create_point.x() < work_area.x()) |
678 create_point.set_x(work_area.x()); | 679 create_point.set_x(work_area.x()); |
679 else if (create_point.x() > work_area.right()) | 680 else if (create_point.x() > work_area.right()) |
680 create_point.set_x(work_area.right()); | 681 create_point.set_x(work_area.right()); |
681 if (create_point.y() < work_area.y()) | 682 if (create_point.y() < work_area.y()) |
682 create_point.set_y(work_area.y()); | 683 create_point.set_y(work_area.y()); |
683 else if (create_point.y() > work_area.bottom()) | 684 else if (create_point.y() > work_area.bottom()) |
684 create_point.set_y(work_area.bottom()); | 685 create_point.set_y(work_area.bottom()); |
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1976 aura::Window* widget_window = widget->GetNativeWindow(); | 1977 aura::Window* widget_window = widget->GetNativeWindow(); |
1977 DCHECK(widget_window->GetRootWindow()); | 1978 DCHECK(widget_window->GetRootWindow()); |
1978 gfx::Point touch_point; | 1979 gfx::Point touch_point; |
1979 bool got_touch_point = widget_window->GetRootWindow()-> | 1980 bool got_touch_point = widget_window->GetRootWindow()-> |
1980 gesture_recognizer()->GetLastTouchPointForTarget(widget_window, | 1981 gesture_recognizer()->GetLastTouchPointForTarget(widget_window, |
1981 &touch_point); | 1982 &touch_point); |
1982 DCHECK(got_touch_point); | 1983 DCHECK(got_touch_point); |
1983 return touch_point; | 1984 return touch_point; |
1984 } | 1985 } |
1985 #endif | 1986 #endif |
1986 return gfx::Screen::GetCursorScreenPoint(); | 1987 return gfx::Screen::GetCursorScreenPoint(gfx::Screen::BadTwoWorldsContext()); |
1987 } | 1988 } |
1988 | 1989 |
1989 gfx::Point TabDragController::GetWindowOffset( | 1990 gfx::Point TabDragController::GetWindowOffset( |
1990 const gfx::Point& point_in_screen) { | 1991 const gfx::Point& point_in_screen) { |
1991 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? | 1992 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? |
1992 attached_tabstrip_ : source_tabstrip_; | 1993 attached_tabstrip_ : source_tabstrip_; |
1993 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); | 1994 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); |
1994 | 1995 |
1995 gfx::Point offset = point_in_screen; | 1996 gfx::Point offset = point_in_screen; |
1996 views::View::ConvertPointFromScreen(toplevel_view, &offset); | 1997 views::View::ConvertPointFromScreen(toplevel_view, &offset); |
1997 return offset; | 1998 return offset; |
1998 } | 1999 } |
OLD | NEW |