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::GetScreenFor( |
675 source_tabstrip_->GetWidget()->GetNativeView())-> | |
676 GetDisplayNearestPoint(origin).work_area(); | |
oshima
2012/10/10 17:58:23
Any reason this and next change are using differen
scottmg
2012/10/10 19:04:47
No, I'm just not familiar with code, so I wasn't c
| |
675 gfx::Point create_point(origin); | 677 gfx::Point create_point(origin); |
676 if (!work_area.IsEmpty()) { | 678 if (!work_area.IsEmpty()) { |
677 if (create_point.x() < work_area.x()) | 679 if (create_point.x() < work_area.x()) |
678 create_point.set_x(work_area.x()); | 680 create_point.set_x(work_area.x()); |
679 else if (create_point.x() > work_area.right()) | 681 else if (create_point.x() > work_area.right()) |
680 create_point.set_x(work_area.right()); | 682 create_point.set_x(work_area.right()); |
681 if (create_point.y() < work_area.y()) | 683 if (create_point.y() < work_area.y()) |
682 create_point.set_y(work_area.y()); | 684 create_point.set_y(work_area.y()); |
683 else if (create_point.y() > work_area.bottom()) | 685 else if (create_point.y() > work_area.bottom()) |
684 create_point.set_y(work_area.bottom()); | 686 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(); | 1978 aura::Window* widget_window = widget->GetNativeWindow(); |
1977 DCHECK(widget_window->GetRootWindow()); | 1979 DCHECK(widget_window->GetRootWindow()); |
1978 gfx::Point touch_point; | 1980 gfx::Point touch_point; |
1979 bool got_touch_point = widget_window->GetRootWindow()-> | 1981 bool got_touch_point = widget_window->GetRootWindow()-> |
1980 gesture_recognizer()->GetLastTouchPointForTarget(widget_window, | 1982 gesture_recognizer()->GetLastTouchPointForTarget(widget_window, |
1981 &touch_point); | 1983 &touch_point); |
1982 DCHECK(got_touch_point); | 1984 DCHECK(got_touch_point); |
1983 return touch_point; | 1985 return touch_point; |
1984 } | 1986 } |
1985 #endif | 1987 #endif |
1986 return gfx::Screen::GetCursorScreenPoint(); | 1988 return gfx::Screen::GetScreenFor( |
1989 GetAttachedBrowserWidget()->GetNativeView())->GetCursorScreenPoint(); | |
1987 } | 1990 } |
1988 | 1991 |
1989 gfx::Point TabDragController::GetWindowOffset( | 1992 gfx::Point TabDragController::GetWindowOffset( |
1990 const gfx::Point& point_in_screen) { | 1993 const gfx::Point& point_in_screen) { |
1991 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? | 1994 TabStrip* owning_tabstrip = (attached_tabstrip_ && detach_into_browser_) ? |
1992 attached_tabstrip_ : source_tabstrip_; | 1995 attached_tabstrip_ : source_tabstrip_; |
1993 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); | 1996 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); |
1994 | 1997 |
1995 gfx::Point offset = point_in_screen; | 1998 gfx::Point offset = point_in_screen; |
1996 views::View::ConvertPointFromScreen(toplevel_view, &offset); | 1999 views::View::ConvertPointFromScreen(toplevel_view, &offset); |
1997 return offset; | 2000 return offset; |
1998 } | 2001 } |
OLD | NEW |