| 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 "ash/wm/workspace/multi_window_resize_controller.h" | 5 #include "ash/wm/workspace/multi_window_resize_controller.h" |
| 6 | 6 |
| 7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/wm/window_state.h" | 9 #include "ash/wm/window_state.h" |
| 10 #include "ash/wm/window_util.h" |
| 10 #include "ash/wm/workspace/workspace_window_resizer.h" | 11 #include "ash/wm/workspace/workspace_window_resizer.h" |
| 11 #include "ash/wm_window.h" | |
| 12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
| 13 #include "ui/aura/window_delegate.h" | 13 #include "ui/aura/window_delegate.h" |
| 14 #include "ui/base/cursor/cursor.h" | 14 #include "ui/base/cursor/cursor.h" |
| 15 #include "ui/base/hit_test.h" | 15 #include "ui/base/hit_test.h" |
| 16 #include "ui/display/screen.h" | 16 #include "ui/display/screen.h" |
| 17 #include "ui/gfx/canvas.h" | 17 #include "ui/gfx/canvas.h" |
| 18 #include "ui/gfx/image/image.h" | 18 #include "ui/gfx/image/image.h" |
| 19 #include "ui/views/view.h" | 19 #include "ui/views/view.h" |
| 20 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| 21 #include "ui/views/widget/widget_delegate.h" | 21 #include "ui/views/widget/widget_delegate.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 window_resizer_.reset(); | 269 window_resizer_.reset(); |
| 270 Hide(); | 270 Hide(); |
| 271 } | 271 } |
| 272 | 272 |
| 273 MultiWindowResizeController::ResizeWindows | 273 MultiWindowResizeController::ResizeWindows |
| 274 MultiWindowResizeController::DetermineWindowsFromScreenPoint( | 274 MultiWindowResizeController::DetermineWindowsFromScreenPoint( |
| 275 aura::Window* window) const { | 275 aura::Window* window) const { |
| 276 gfx::Point mouse_location( | 276 gfx::Point mouse_location( |
| 277 display::Screen::GetScreen()->GetCursorScreenPoint()); | 277 display::Screen::GetScreen()->GetCursorScreenPoint()); |
| 278 mouse_location = ConvertPointFromScreen(window, mouse_location); | 278 mouse_location = ConvertPointFromScreen(window, mouse_location); |
| 279 const int component = | 279 const int component = wm::GetNonClientComponent(window, mouse_location); |
| 280 window->delegate() | |
| 281 ? window->delegate()->GetNonClientComponent(mouse_location) | |
| 282 : HTNOWHERE; | |
| 283 return DetermineWindows(window, component, mouse_location); | 280 return DetermineWindows(window, component, mouse_location); |
| 284 } | 281 } |
| 285 | 282 |
| 286 void MultiWindowResizeController::CreateMouseWatcher() { | 283 void MultiWindowResizeController::CreateMouseWatcher() { |
| 287 mouse_watcher_.reset( | 284 mouse_watcher_.reset( |
| 288 new views::MouseWatcher(new ResizeMouseWatcherHost(this), this)); | 285 new views::MouseWatcher(new ResizeMouseWatcherHost(this), this)); |
| 289 mouse_watcher_->set_notify_on_exit_time( | 286 mouse_watcher_->set_notify_on_exit_time( |
| 290 base::TimeDelta::FromMilliseconds(kHideDelayMS)); | 287 base::TimeDelta::FromMilliseconds(kHideDelayMS)); |
| 291 mouse_watcher_->Start(); | 288 mouse_watcher_->Start(); |
| 292 } | 289 } |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 windows_.direction == TOP_BOTTOM ? HTTOP : HTLEFT); | 586 windows_.direction == TOP_BOTTOM ? HTTOP : HTLEFT); |
| 590 } | 587 } |
| 591 return false; | 588 return false; |
| 592 } | 589 } |
| 593 | 590 |
| 594 bool MultiWindowResizeController::IsOverComponent( | 591 bool MultiWindowResizeController::IsOverComponent( |
| 595 aura::Window* window, | 592 aura::Window* window, |
| 596 const gfx::Point& location_in_screen, | 593 const gfx::Point& location_in_screen, |
| 597 int component) const { | 594 int component) const { |
| 598 gfx::Point window_loc = ConvertPointFromScreen(window, location_in_screen); | 595 gfx::Point window_loc = ConvertPointFromScreen(window, location_in_screen); |
| 599 const int window_component = | 596 return wm::GetNonClientComponent(window, window_loc) == component; |
| 600 window->delegate() ? window->delegate()->GetNonClientComponent(window_loc) | |
| 601 : HTNOWHERE; | |
| 602 return window_component == component; | |
| 603 } | 597 } |
| 604 | 598 |
| 605 } // namespace ash | 599 } // namespace ash |
| OLD | NEW |