| 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_controller2.h" | 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller2.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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 | 495 |
| 496 gfx::Point TabDragController2::GetWindowCreatePoint() const { | 496 gfx::Point TabDragController2::GetWindowCreatePoint() const { |
| 497 gfx::Point cursor_point = GetCursorScreenPoint(); | 497 gfx::Point cursor_point = GetCursorScreenPoint(); |
| 498 if (dock_info_.type() != DockInfo::NONE && dock_info_.in_enable_area()) { | 498 if (dock_info_.type() != DockInfo::NONE && dock_info_.in_enable_area()) { |
| 499 // If we're going to dock, we need to return the exact coordinate, | 499 // If we're going to dock, we need to return the exact coordinate, |
| 500 // otherwise we may attempt to maximize on the wrong monitor. | 500 // otherwise we may attempt to maximize on the wrong monitor. |
| 501 return cursor_point; | 501 return cursor_point; |
| 502 } | 502 } |
| 503 // If the cursor is outside the monitor area, move it inside. For example, | 503 // If the cursor is outside the monitor area, move it inside. For example, |
| 504 // dropping a tab onto the task bar on Windows produces this situation. | 504 // dropping a tab onto the task bar on Windows produces this situation. |
| 505 gfx::Rect work_area = gfx::Screen::GetMonitorWorkAreaNearestPoint( | 505 gfx::Rect work_area = gfx::Screen::GetMonitorNearestPoint( |
| 506 cursor_point); | 506 cursor_point).work_area(); |
| 507 if (!work_area.IsEmpty()) { | 507 if (!work_area.IsEmpty()) { |
| 508 if (cursor_point.x() < work_area.x()) | 508 if (cursor_point.x() < work_area.x()) |
| 509 cursor_point.set_x(work_area.x()); | 509 cursor_point.set_x(work_area.x()); |
| 510 else if (cursor_point.x() > work_area.right()) | 510 else if (cursor_point.x() > work_area.right()) |
| 511 cursor_point.set_x(work_area.right()); | 511 cursor_point.set_x(work_area.right()); |
| 512 if (cursor_point.y() < work_area.y()) | 512 if (cursor_point.y() < work_area.y()) |
| 513 cursor_point.set_y(work_area.y()); | 513 cursor_point.set_y(work_area.y()); |
| 514 else if (cursor_point.y() > work_area.bottom()) | 514 else if (cursor_point.y() > work_area.bottom()) |
| 515 cursor_point.set_y(work_area.bottom()); | 515 cursor_point.set_y(work_area.bottom()); |
| 516 } | 516 } |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1427 browser->window()->SetBounds(new_bounds); | 1427 browser->window()->SetBounds(new_bounds); |
| 1428 return browser; | 1428 return browser; |
| 1429 } | 1429 } |
| 1430 | 1430 |
| 1431 void TabDragController2::SetTrackedByWorkspace(gfx::NativeWindow window, | 1431 void TabDragController2::SetTrackedByWorkspace(gfx::NativeWindow window, |
| 1432 bool value) { | 1432 bool value) { |
| 1433 #if defined(USE_ASH) | 1433 #if defined(USE_ASH) |
| 1434 ash::SetTrackedByWorkspace(window, value); | 1434 ash::SetTrackedByWorkspace(window, value); |
| 1435 #endif | 1435 #endif |
| 1436 } | 1436 } |
| OLD | NEW |