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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 gfx::Point TabDragController::GetWindowCreatePoint( | 625 gfx::Point TabDragController::GetWindowCreatePoint( |
626 const gfx::Point& origin) const { | 626 const gfx::Point& origin) const { |
627 if (dock_info_.type() != DockInfo::NONE && dock_info_.in_enable_area()) { | 627 if (dock_info_.type() != DockInfo::NONE && dock_info_.in_enable_area()) { |
628 // If we're going to dock, we need to return the exact coordinate, | 628 // If we're going to dock, we need to return the exact coordinate, |
629 // otherwise we may attempt to maximize on the wrong monitor. | 629 // otherwise we may attempt to maximize on the wrong monitor. |
630 return origin; | 630 return origin; |
631 } | 631 } |
632 | 632 |
633 // If the cursor is outside the monitor area, move it inside. For example, | 633 // If the cursor is outside the monitor area, move it inside. For example, |
634 // dropping a tab onto the task bar on Windows produces this situation. | 634 // dropping a tab onto the task bar on Windows produces this situation. |
635 gfx::Rect work_area = gfx::Screen::GetMonitorNearestPoint(origin).work_area(); | 635 gfx::Rect work_area = gfx::Screen::GetDisplayNearestPoint(origin).work_area(); |
636 gfx::Point create_point(origin); | 636 gfx::Point create_point(origin); |
637 if (!work_area.IsEmpty()) { | 637 if (!work_area.IsEmpty()) { |
638 if (create_point.x() < work_area.x()) | 638 if (create_point.x() < work_area.x()) |
639 create_point.set_x(work_area.x()); | 639 create_point.set_x(work_area.x()); |
640 else if (create_point.x() > work_area.right()) | 640 else if (create_point.x() > work_area.right()) |
641 create_point.set_x(work_area.right()); | 641 create_point.set_x(work_area.right()); |
642 if (create_point.y() < work_area.y()) | 642 if (create_point.y() < work_area.y()) |
643 create_point.set_y(work_area.y()); | 643 create_point.set_y(work_area.y()); |
644 else if (create_point.y() > work_area.bottom()) | 644 else if (create_point.y() > work_area.bottom()) |
645 create_point.set_y(work_area.bottom()); | 645 create_point.set_y(work_area.bottom()); |
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 } | 1876 } |
1877 | 1877 |
1878 default: | 1878 default: |
1879 break; // Nothing to do for DETACH_ABOVE_OR_BELOW. | 1879 break; // Nothing to do for DETACH_ABOVE_OR_BELOW. |
1880 } | 1880 } |
1881 | 1881 |
1882 SetTrackedByWorkspace(browser->window()->GetNativeWindow(), false); | 1882 SetTrackedByWorkspace(browser->window()->GetNativeWindow(), false); |
1883 browser->window()->SetBounds(new_bounds); | 1883 browser->window()->SetBounds(new_bounds); |
1884 return browser; | 1884 return browser; |
1885 } | 1885 } |
OLD | NEW |