| 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/common/wm/workspace/multi_window_resize_controller.h" | 5 #include "ash/common/wm/workspace/multi_window_resize_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/shell_window_ids.h" | 7 #include "ash/common/shell_window_ids.h" |
| 8 #include "ash/common/wm/wm_lookup.h" | |
| 9 #include "ash/common/wm/wm_root_window_controller.h" | |
| 10 #include "ash/common/wm/wm_window.h" | |
| 11 #include "ash/common/wm/workspace/workspace_window_resizer.h" | 8 #include "ash/common/wm/workspace/workspace_window_resizer.h" |
| 9 #include "ash/common/wm_lookup.h" |
| 10 #include "ash/common/wm_root_window_controller.h" |
| 11 #include "ash/common/wm_window.h" |
| 12 #include "grit/ash_resources.h" | 12 #include "grit/ash_resources.h" |
| 13 #include "ui/base/cursor/cursor.h" | 13 #include "ui/base/cursor/cursor.h" |
| 14 #include "ui/base/hit_test.h" | 14 #include "ui/base/hit_test.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.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" |
| 22 #include "ui/wm/core/compound_event_filter.h" | 22 #include "ui/wm/core/compound_event_filter.h" |
| 23 | 23 |
| 24 namespace ash { | 24 namespace ash { |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 // Delay before showing. | 27 // Delay before showing. |
| 28 const int kShowDelayMS = 400; | 28 const int kShowDelayMS = 400; |
| 29 | 29 |
| 30 // Delay before hiding. | 30 // Delay before hiding. |
| 31 const int kHideDelayMS = 500; | 31 const int kHideDelayMS = 500; |
| 32 | 32 |
| 33 // Padding from the bottom/right edge the resize widget is shown at. | 33 // Padding from the bottom/right edge the resize widget is shown at. |
| 34 const int kResizeWidgetPadding = 15; | 34 const int kResizeWidgetPadding = 15; |
| 35 | 35 |
| 36 bool ContainsX(wm::WmWindow* window, int x) { | 36 bool ContainsX(WmWindow* window, int x) { |
| 37 return x >= 0 && x <= window->GetBounds().width(); | 37 return x >= 0 && x <= window->GetBounds().width(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 bool ContainsScreenX(wm::WmWindow* window, int x_in_screen) { | 40 bool ContainsScreenX(WmWindow* window, int x_in_screen) { |
| 41 gfx::Point window_loc = | 41 gfx::Point window_loc = |
| 42 window->ConvertPointFromScreen(gfx::Point(x_in_screen, 0)); | 42 window->ConvertPointFromScreen(gfx::Point(x_in_screen, 0)); |
| 43 return ContainsX(window, window_loc.x()); | 43 return ContainsX(window, window_loc.x()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool ContainsY(wm::WmWindow* window, int y) { | 46 bool ContainsY(WmWindow* window, int y) { |
| 47 return y >= 0 && y <= window->GetBounds().height(); | 47 return y >= 0 && y <= window->GetBounds().height(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool ContainsScreenY(wm::WmWindow* window, int y_in_screen) { | 50 bool ContainsScreenY(WmWindow* window, int y_in_screen) { |
| 51 gfx::Point window_loc = | 51 gfx::Point window_loc = |
| 52 window->ConvertPointFromScreen(gfx::Point(0, y_in_screen)); | 52 window->ConvertPointFromScreen(gfx::Point(0, y_in_screen)); |
| 53 return ContainsY(window, window_loc.y()); | 53 return ContainsY(window, window_loc.y()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool Intersects(int x1, int max_1, int x2, int max_2) { | 56 bool Intersects(int x1, int max_1, int x2, int max_2) { |
| 57 return x2 <= max_1 && max_2 > x1; | 57 return x2 <= max_1 && max_2 > x1; |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace | 60 } // namespace |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 direction == other.direction; | 142 direction == other.direction; |
| 143 } | 143 } |
| 144 | 144 |
| 145 MultiWindowResizeController::MultiWindowResizeController() {} | 145 MultiWindowResizeController::MultiWindowResizeController() {} |
| 146 | 146 |
| 147 MultiWindowResizeController::~MultiWindowResizeController() { | 147 MultiWindowResizeController::~MultiWindowResizeController() { |
| 148 window_resizer_.reset(); | 148 window_resizer_.reset(); |
| 149 Hide(); | 149 Hide(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void MultiWindowResizeController::Show(wm::WmWindow* window, | 152 void MultiWindowResizeController::Show(WmWindow* window, |
| 153 int component, | 153 int component, |
| 154 const gfx::Point& point_in_window) { | 154 const gfx::Point& point_in_window) { |
| 155 // When the resize widget is showing we ignore Show() requests. Instead we | 155 // When the resize widget is showing we ignore Show() requests. Instead we |
| 156 // only care about mouse movements from MouseWatcher. This is necessary as | 156 // only care about mouse movements from MouseWatcher. This is necessary as |
| 157 // WorkspaceEventHandler only sees mouse movements over the windows, not all | 157 // WorkspaceEventHandler only sees mouse movements over the windows, not all |
| 158 // windows or over the desktop. | 158 // windows or over the desktop. |
| 159 if (resize_widget_) | 159 if (resize_widget_) |
| 160 return; | 160 return; |
| 161 | 161 |
| 162 ResizeWindows windows(DetermineWindows(window, component, point_in_window)); | 162 ResizeWindows windows(DetermineWindows(window, component, point_in_window)); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 windows_.other_windows[i]->RemoveObserver(this); | 201 windows_.other_windows[i]->RemoveObserver(this); |
| 202 mouse_watcher_.reset(); | 202 mouse_watcher_.reset(); |
| 203 resize_widget_.reset(); | 203 resize_widget_.reset(); |
| 204 windows_ = ResizeWindows(); | 204 windows_ = ResizeWindows(); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void MultiWindowResizeController::MouseMovedOutOfHost() { | 207 void MultiWindowResizeController::MouseMovedOutOfHost() { |
| 208 Hide(); | 208 Hide(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void MultiWindowResizeController::OnWindowDestroying(wm::WmWindow* window) { | 211 void MultiWindowResizeController::OnWindowDestroying(WmWindow* window) { |
| 212 // Have to explicitly reset the WindowResizer, otherwise Hide() does nothing. | 212 // Have to explicitly reset the WindowResizer, otherwise Hide() does nothing. |
| 213 window_resizer_.reset(); | 213 window_resizer_.reset(); |
| 214 Hide(); | 214 Hide(); |
| 215 } | 215 } |
| 216 | 216 |
| 217 MultiWindowResizeController::ResizeWindows | 217 MultiWindowResizeController::ResizeWindows |
| 218 MultiWindowResizeController::DetermineWindowsFromScreenPoint( | 218 MultiWindowResizeController::DetermineWindowsFromScreenPoint( |
| 219 wm::WmWindow* window) const { | 219 WmWindow* window) const { |
| 220 gfx::Point mouse_location( | 220 gfx::Point mouse_location( |
| 221 display::Screen::GetScreen()->GetCursorScreenPoint()); | 221 display::Screen::GetScreen()->GetCursorScreenPoint()); |
| 222 mouse_location = window->ConvertPointFromScreen(mouse_location); | 222 mouse_location = window->ConvertPointFromScreen(mouse_location); |
| 223 const int component = window->GetNonClientComponent(mouse_location); | 223 const int component = window->GetNonClientComponent(mouse_location); |
| 224 return DetermineWindows(window, component, mouse_location); | 224 return DetermineWindows(window, component, mouse_location); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void MultiWindowResizeController::CreateMouseWatcher() { | 227 void MultiWindowResizeController::CreateMouseWatcher() { |
| 228 mouse_watcher_.reset( | 228 mouse_watcher_.reset( |
| 229 new views::MouseWatcher(new ResizeMouseWatcherHost(this), this)); | 229 new views::MouseWatcher(new ResizeMouseWatcherHost(this), this)); |
| 230 mouse_watcher_->set_notify_on_exit_time( | 230 mouse_watcher_->set_notify_on_exit_time( |
| 231 base::TimeDelta::FromMilliseconds(kHideDelayMS)); | 231 base::TimeDelta::FromMilliseconds(kHideDelayMS)); |
| 232 mouse_watcher_->Start(); | 232 mouse_watcher_->Start(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 MultiWindowResizeController::ResizeWindows | 235 MultiWindowResizeController::ResizeWindows |
| 236 MultiWindowResizeController::DetermineWindows(wm::WmWindow* window, | 236 MultiWindowResizeController::DetermineWindows(WmWindow* window, |
| 237 int window_component, | 237 int window_component, |
| 238 const gfx::Point& point) const { | 238 const gfx::Point& point) const { |
| 239 ResizeWindows result; | 239 ResizeWindows result; |
| 240 gfx::Point point_in_parent = | 240 gfx::Point point_in_parent = |
| 241 window->ConvertPointToTarget(window->GetParent(), point); | 241 window->ConvertPointToTarget(window->GetParent(), point); |
| 242 switch (window_component) { | 242 switch (window_component) { |
| 243 case HTRIGHT: | 243 case HTRIGHT: |
| 244 result.direction = LEFT_RIGHT; | 244 result.direction = LEFT_RIGHT; |
| 245 result.window1 = window; | 245 result.window1 = window; |
| 246 result.window2 = FindWindowByEdge( | 246 result.window2 = FindWindowByEdge( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 263 result.window1 = window; | 263 result.window1 = window; |
| 264 result.window2 = FindWindowByEdge(window, HTTOP, point_in_parent.x(), | 264 result.window2 = FindWindowByEdge(window, HTTOP, point_in_parent.x(), |
| 265 window->GetBounds().bottom()); | 265 window->GetBounds().bottom()); |
| 266 break; | 266 break; |
| 267 default: | 267 default: |
| 268 break; | 268 break; |
| 269 } | 269 } |
| 270 return result; | 270 return result; |
| 271 } | 271 } |
| 272 | 272 |
| 273 wm::WmWindow* MultiWindowResizeController::FindWindowByEdge( | 273 WmWindow* MultiWindowResizeController::FindWindowByEdge( |
| 274 wm::WmWindow* window_to_ignore, | 274 WmWindow* window_to_ignore, |
| 275 int edge_want, | 275 int edge_want, |
| 276 int x_in_parent, | 276 int x_in_parent, |
| 277 int y_in_parent) const { | 277 int y_in_parent) const { |
| 278 wm::WmWindow* parent = window_to_ignore->GetParent(); | 278 WmWindow* parent = window_to_ignore->GetParent(); |
| 279 std::vector<wm::WmWindow*> windows = parent->GetChildren(); | 279 std::vector<WmWindow*> windows = parent->GetChildren(); |
| 280 for (auto i = windows.rbegin(); i != windows.rend(); ++i) { | 280 for (auto i = windows.rbegin(); i != windows.rend(); ++i) { |
| 281 wm::WmWindow* window = *i; | 281 WmWindow* window = *i; |
| 282 if (window == window_to_ignore || !window->IsVisible()) | 282 if (window == window_to_ignore || !window->IsVisible()) |
| 283 continue; | 283 continue; |
| 284 | 284 |
| 285 // Ignore windows without a non-client area. | 285 // Ignore windows without a non-client area. |
| 286 if (!window->HasNonClientArea()) | 286 if (!window->HasNonClientArea()) |
| 287 continue; | 287 continue; |
| 288 | 288 |
| 289 gfx::Point p = parent->ConvertPointToTarget( | 289 gfx::Point p = parent->ConvertPointToTarget( |
| 290 window, gfx::Point(x_in_parent, y_in_parent)); | 290 window, gfx::Point(x_in_parent, y_in_parent)); |
| 291 switch (edge_want) { | 291 switch (edge_want) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 309 NOTREACHED(); | 309 NOTREACHED(); |
| 310 } | 310 } |
| 311 // Window doesn't contain the edge, but if window contains |point| | 311 // Window doesn't contain the edge, but if window contains |point| |
| 312 // it's obscuring any other window that could be at the location. | 312 // it's obscuring any other window that could be at the location. |
| 313 if (window->GetBounds().Contains(x_in_parent, y_in_parent)) | 313 if (window->GetBounds().Contains(x_in_parent, y_in_parent)) |
| 314 return NULL; | 314 return NULL; |
| 315 } | 315 } |
| 316 return NULL; | 316 return NULL; |
| 317 } | 317 } |
| 318 | 318 |
| 319 wm::WmWindow* MultiWindowResizeController::FindWindowTouching( | 319 WmWindow* MultiWindowResizeController::FindWindowTouching( |
| 320 wm::WmWindow* window, | 320 WmWindow* window, |
| 321 Direction direction) const { | 321 Direction direction) const { |
| 322 int right = window->GetBounds().right(); | 322 int right = window->GetBounds().right(); |
| 323 int bottom = window->GetBounds().bottom(); | 323 int bottom = window->GetBounds().bottom(); |
| 324 wm::WmWindow* parent = window->GetParent(); | 324 WmWindow* parent = window->GetParent(); |
| 325 std::vector<wm::WmWindow*> windows = parent->GetChildren(); | 325 std::vector<WmWindow*> windows = parent->GetChildren(); |
| 326 for (auto i = windows.rbegin(); i != windows.rend(); ++i) { | 326 for (auto i = windows.rbegin(); i != windows.rend(); ++i) { |
| 327 wm::WmWindow* other = *i; | 327 WmWindow* other = *i; |
| 328 if (other == window || !other->IsVisible()) | 328 if (other == window || !other->IsVisible()) |
| 329 continue; | 329 continue; |
| 330 switch (direction) { | 330 switch (direction) { |
| 331 case TOP_BOTTOM: | 331 case TOP_BOTTOM: |
| 332 if (other->GetBounds().y() == bottom && | 332 if (other->GetBounds().y() == bottom && |
| 333 Intersects(other->GetBounds().x(), other->GetBounds().right(), | 333 Intersects(other->GetBounds().x(), other->GetBounds().right(), |
| 334 window->GetBounds().x(), window->GetBounds().right())) { | 334 window->GetBounds().x(), window->GetBounds().right())) { |
| 335 return other; | 335 return other; |
| 336 } | 336 } |
| 337 break; | 337 break; |
| 338 case LEFT_RIGHT: | 338 case LEFT_RIGHT: |
| 339 if (other->GetBounds().x() == right && | 339 if (other->GetBounds().x() == right && |
| 340 Intersects(other->GetBounds().y(), other->GetBounds().bottom(), | 340 Intersects(other->GetBounds().y(), other->GetBounds().bottom(), |
| 341 window->GetBounds().y(), window->GetBounds().bottom())) { | 341 window->GetBounds().y(), window->GetBounds().bottom())) { |
| 342 return other; | 342 return other; |
| 343 } | 343 } |
| 344 break; | 344 break; |
| 345 default: | 345 default: |
| 346 NOTREACHED(); | 346 NOTREACHED(); |
| 347 } | 347 } |
| 348 } | 348 } |
| 349 return NULL; | 349 return NULL; |
| 350 } | 350 } |
| 351 | 351 |
| 352 void MultiWindowResizeController::FindWindowsTouching( | 352 void MultiWindowResizeController::FindWindowsTouching( |
| 353 wm::WmWindow* start, | 353 WmWindow* start, |
| 354 Direction direction, | 354 Direction direction, |
| 355 std::vector<wm::WmWindow*>* others) const { | 355 std::vector<WmWindow*>* others) const { |
| 356 while (start) { | 356 while (start) { |
| 357 start = FindWindowTouching(start, direction); | 357 start = FindWindowTouching(start, direction); |
| 358 if (start) | 358 if (start) |
| 359 others->push_back(start); | 359 others->push_back(start); |
| 360 } | 360 } |
| 361 } | 361 } |
| 362 | 362 |
| 363 void MultiWindowResizeController::ShowIfValidMouseLocation() { | 363 void MultiWindowResizeController::ShowIfValidMouseLocation() { |
| 364 if (DetermineWindowsFromScreenPoint(windows_.window1).Equals(windows_) || | 364 if (DetermineWindowsFromScreenPoint(windows_.window1).Equals(windows_) || |
| 365 DetermineWindowsFromScreenPoint(windows_.window2).Equals(windows_)) { | 365 DetermineWindowsFromScreenPoint(windows_.window2).Equals(windows_)) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 377 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 377 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 378 params.name = "MultiWindowResizeController"; | 378 params.name = "MultiWindowResizeController"; |
| 379 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 379 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 380 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 380 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 381 windows_.window1->GetRootWindowController() | 381 windows_.window1->GetRootWindowController() |
| 382 ->ConfigureWidgetInitParamsForContainer( | 382 ->ConfigureWidgetInitParamsForContainer( |
| 383 resize_widget_.get(), kShellWindowId_AlwaysOnTopContainer, ¶ms); | 383 resize_widget_.get(), kShellWindowId_AlwaysOnTopContainer, ¶ms); |
| 384 ResizeView* view = new ResizeView(this, windows_.direction); | 384 ResizeView* view = new ResizeView(this, windows_.direction); |
| 385 resize_widget_->set_focus_on_creation(false); | 385 resize_widget_->set_focus_on_creation(false); |
| 386 resize_widget_->Init(params); | 386 resize_widget_->Init(params); |
| 387 wm::WmLookup::Get() | 387 WmLookup::Get() |
| 388 ->GetWindowForWidget(resize_widget_.get()) | 388 ->GetWindowForWidget(resize_widget_.get()) |
| 389 ->SetVisibilityAnimationType(::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); | 389 ->SetVisibilityAnimationType(::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); |
| 390 resize_widget_->SetContentsView(view); | 390 resize_widget_->SetContentsView(view); |
| 391 show_bounds_in_screen_ = windows_.window1->GetParent()->ConvertRectToScreen( | 391 show_bounds_in_screen_ = windows_.window1->GetParent()->ConvertRectToScreen( |
| 392 CalculateResizeWidgetBounds(show_location_in_parent_)); | 392 CalculateResizeWidgetBounds(show_location_in_parent_)); |
| 393 resize_widget_->SetBounds(show_bounds_in_screen_); | 393 resize_widget_->SetBounds(show_bounds_in_screen_); |
| 394 resize_widget_->Show(); | 394 resize_widget_->Show(); |
| 395 CreateMouseWatcher(); | 395 CreateMouseWatcher(); |
| 396 } | 396 } |
| 397 | 397 |
| 398 bool MultiWindowResizeController::IsShowing() const { | 398 bool MultiWindowResizeController::IsShowing() const { |
| 399 return resize_widget_.get() || show_timer_.IsRunning(); | 399 return resize_widget_.get() || show_timer_.IsRunning(); |
| 400 } | 400 } |
| 401 | 401 |
| 402 void MultiWindowResizeController::StartResize( | 402 void MultiWindowResizeController::StartResize( |
| 403 const gfx::Point& location_in_screen) { | 403 const gfx::Point& location_in_screen) { |
| 404 DCHECK(!window_resizer_.get()); | 404 DCHECK(!window_resizer_.get()); |
| 405 DCHECK(windows_.is_valid()); | 405 DCHECK(windows_.is_valid()); |
| 406 gfx::Point location_in_parent = | 406 gfx::Point location_in_parent = |
| 407 windows_.window2->GetParent()->ConvertPointFromScreen(location_in_screen); | 407 windows_.window2->GetParent()->ConvertPointFromScreen(location_in_screen); |
| 408 std::vector<wm::WmWindow*> windows; | 408 std::vector<WmWindow*> windows; |
| 409 windows.push_back(windows_.window2); | 409 windows.push_back(windows_.window2); |
| 410 DCHECK(windows_.other_windows.empty()); | 410 DCHECK(windows_.other_windows.empty()); |
| 411 FindWindowsTouching(windows_.window2, windows_.direction, | 411 FindWindowsTouching(windows_.window2, windows_.direction, |
| 412 &windows_.other_windows); | 412 &windows_.other_windows); |
| 413 for (size_t i = 0; i < windows_.other_windows.size(); ++i) { | 413 for (size_t i = 0; i < windows_.other_windows.size(); ++i) { |
| 414 windows_.other_windows[i]->AddObserver(this); | 414 windows_.other_windows[i]->AddObserver(this); |
| 415 windows.push_back(windows_.other_windows[i]); | 415 windows.push_back(windows_.other_windows[i]); |
| 416 } | 416 } |
| 417 int component = windows_.direction == LEFT_RIGHT ? HTRIGHT : HTBOTTOM; | 417 int component = windows_.direction == LEFT_RIGHT ? HTRIGHT : HTBOTTOM; |
| 418 wm::WindowState* window_state = windows_.window1->GetWindowState(); | 418 wm::WindowState* window_state = windows_.window1->GetWindowState(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 } else { | 509 } else { |
| 510 if (!ContainsScreenY(windows_.window1, location_in_screen.y()) || | 510 if (!ContainsScreenY(windows_.window1, location_in_screen.y()) || |
| 511 !ContainsScreenY(windows_.window2, location_in_screen.y())) { | 511 !ContainsScreenY(windows_.window2, location_in_screen.y())) { |
| 512 return false; | 512 return false; |
| 513 } | 513 } |
| 514 } | 514 } |
| 515 | 515 |
| 516 // Check whether |location_in_screen| is in the event target's resize region. | 516 // Check whether |location_in_screen| is in the event target's resize region. |
| 517 // This is tricky because a window's resize region can extend outside a | 517 // This is tricky because a window's resize region can extend outside a |
| 518 // window's bounds. | 518 // window's bounds. |
| 519 wm::WmWindow* target = | 519 WmWindow* target = |
| 520 windows_.window1->GetRootWindowController()->FindEventTarget( | 520 windows_.window1->GetRootWindowController()->FindEventTarget( |
| 521 location_in_screen); | 521 location_in_screen); |
| 522 if (target == windows_.window1) { | 522 if (target == windows_.window1) { |
| 523 return IsOverComponent( | 523 return IsOverComponent( |
| 524 windows_.window1, location_in_screen, | 524 windows_.window1, location_in_screen, |
| 525 windows_.direction == TOP_BOTTOM ? HTBOTTOM : HTRIGHT); | 525 windows_.direction == TOP_BOTTOM ? HTBOTTOM : HTRIGHT); |
| 526 } | 526 } |
| 527 if (target == windows_.window2) { | 527 if (target == windows_.window2) { |
| 528 return IsOverComponent(windows_.window2, location_in_screen, | 528 return IsOverComponent(windows_.window2, location_in_screen, |
| 529 windows_.direction == TOP_BOTTOM ? HTTOP : HTLEFT); | 529 windows_.direction == TOP_BOTTOM ? HTTOP : HTLEFT); |
| 530 } | 530 } |
| 531 return false; | 531 return false; |
| 532 } | 532 } |
| 533 | 533 |
| 534 bool MultiWindowResizeController::IsOverComponent( | 534 bool MultiWindowResizeController::IsOverComponent( |
| 535 wm::WmWindow* window, | 535 WmWindow* window, |
| 536 const gfx::Point& location_in_screen, | 536 const gfx::Point& location_in_screen, |
| 537 int component) const { | 537 int component) const { |
| 538 gfx::Point window_loc = window->ConvertPointFromScreen(location_in_screen); | 538 gfx::Point window_loc = window->ConvertPointFromScreen(location_in_screen); |
| 539 return window->GetNonClientComponent(window_loc) == component; | 539 return window->GetNonClientComponent(window_loc) == component; |
| 540 } | 540 } |
| 541 | 541 |
| 542 } // namespace ash | 542 } // namespace ash |
| OLD | NEW |