| 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/default_tab_drag_controller.h" | 5 #include "chrome/browser/ui/views/tabs/default_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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 | 557 |
| 558 gfx::Point DefaultTabDragController::GetWindowCreatePoint() const { | 558 gfx::Point DefaultTabDragController::GetWindowCreatePoint() const { |
| 559 gfx::Point cursor_point = GetCursorScreenPoint(); | 559 gfx::Point cursor_point = GetCursorScreenPoint(); |
| 560 if (dock_info_.type() != DockInfo::NONE && dock_info_.in_enable_area()) { | 560 if (dock_info_.type() != DockInfo::NONE && dock_info_.in_enable_area()) { |
| 561 // If we're going to dock, we need to return the exact coordinate, | 561 // If we're going to dock, we need to return the exact coordinate, |
| 562 // otherwise we may attempt to maximize on the wrong monitor. | 562 // otherwise we may attempt to maximize on the wrong monitor. |
| 563 return cursor_point; | 563 return cursor_point; |
| 564 } | 564 } |
| 565 // If the cursor is outside the monitor area, move it inside. For example, | 565 // If the cursor is outside the monitor area, move it inside. For example, |
| 566 // dropping a tab onto the task bar on Windows produces this situation. | 566 // dropping a tab onto the task bar on Windows produces this situation. |
| 567 gfx::Rect work_area = gfx::Screen::GetMonitorWorkAreaNearestPoint( | 567 gfx::Rect work_area = gfx::Screen::GetMonitorNearestPoint( |
| 568 cursor_point); | 568 cursor_point).work_area(); |
| 569 if (!work_area.IsEmpty()) { | 569 if (!work_area.IsEmpty()) { |
| 570 if (cursor_point.x() < work_area.x()) | 570 if (cursor_point.x() < work_area.x()) |
| 571 cursor_point.set_x(work_area.x()); | 571 cursor_point.set_x(work_area.x()); |
| 572 else if (cursor_point.x() > work_area.right()) | 572 else if (cursor_point.x() > work_area.right()) |
| 573 cursor_point.set_x(work_area.right()); | 573 cursor_point.set_x(work_area.right()); |
| 574 if (cursor_point.y() < work_area.y()) | 574 if (cursor_point.y() < work_area.y()) |
| 575 cursor_point.set_y(work_area.y()); | 575 cursor_point.set_y(work_area.y()); |
| 576 else if (cursor_point.y() > work_area.bottom()) | 576 else if (cursor_point.y() > work_area.bottom()) |
| 577 cursor_point.set_y(work_area.bottom()); | 577 cursor_point.set_y(work_area.bottom()); |
| 578 } | 578 } |
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1475 } | 1475 } |
| 1476 | 1476 |
| 1477 // static | 1477 // static |
| 1478 bool TabDragController::IsActive() { | 1478 bool TabDragController::IsActive() { |
| 1479 #if defined(USE_AURA) || defined(OS_WIN) | 1479 #if defined(USE_AURA) || defined(OS_WIN) |
| 1480 return TabDragController2::IsActive() || (instance_ && instance_->active()); | 1480 return TabDragController2::IsActive() || (instance_ && instance_->active()); |
| 1481 #else | 1481 #else |
| 1482 return instance_ && instance_->active(); | 1482 return instance_ && instance_->active(); |
| 1483 #endif | 1483 #endif |
| 1484 } | 1484 } |
| OLD | NEW |