Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Side by Side Diff: ash/wm/workspace/multi_window_resize_controller.cc

Issue 10830148: Fixes bug in MultiWindowResizeController where it wasn't removing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/wm/workspace/multi_window_resize_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/screen_ash.h" 7 #include "ash/screen_ash.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/wm/window_animations.h" 10 #include "ash/wm/window_animations.h"
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 void MultiWindowResizeController::StartResize( 392 void MultiWindowResizeController::StartResize(
393 const gfx::Point& location_in_screen) { 393 const gfx::Point& location_in_screen) {
394 DCHECK(!window_resizer_.get()); 394 DCHECK(!window_resizer_.get());
395 DCHECK(windows_.is_valid()); 395 DCHECK(windows_.is_valid());
396 hide_timer_.Stop(); 396 hide_timer_.Stop();
397 gfx::Point location_in_parent(location_in_screen); 397 gfx::Point location_in_parent(location_in_screen);
398 aura::client::GetScreenPositionClient(windows_.window2->GetRootWindow())-> 398 aura::client::GetScreenPositionClient(windows_.window2->GetRootWindow())->
399 ConvertPointFromScreen(windows_.window2->parent(), &location_in_parent); 399 ConvertPointFromScreen(windows_.window2->parent(), &location_in_parent);
400 std::vector<aura::Window*> windows; 400 std::vector<aura::Window*> windows;
401 windows.push_back(windows_.window2); 401 windows.push_back(windows_.window2);
402 DCHECK(windows_.other_windows.empty());
402 FindWindowsTouching(windows_.window2, windows_.direction, 403 FindWindowsTouching(windows_.window2, windows_.direction,
403 &windows_.other_windows); 404 &windows_.other_windows);
404 for (size_t i = 0; i < windows_.other_windows.size(); ++i) { 405 for (size_t i = 0; i < windows_.other_windows.size(); ++i) {
405 windows_.other_windows[i]->AddObserver(this); 406 windows_.other_windows[i]->AddObserver(this);
406 windows.push_back(windows_.other_windows[i]); 407 windows.push_back(windows_.other_windows[i]);
407 } 408 }
408 int component = windows_.direction == LEFT_RIGHT ? HTRIGHT : HTBOTTOM; 409 int component = windows_.direction == LEFT_RIGHT ? HTRIGHT : HTBOTTOM;
409 window_resizer_.reset(WorkspaceWindowResizer::Create( 410 window_resizer_.reset(WorkspaceWindowResizer::Create(
410 windows_.window1, location_in_parent, component, windows)); 411 windows_.window1, location_in_parent, component, windows));
411 } 412 }
(...skipping 14 matching lines...) Expand all
426 bounds.set_x(show_bounds_in_screen_.x()); 427 bounds.set_x(show_bounds_in_screen_.x());
427 resize_widget_->SetBounds(bounds); 428 resize_widget_->SetBounds(bounds);
428 } 429 }
429 430
430 void MultiWindowResizeController::CompleteResize(int event_flags) { 431 void MultiWindowResizeController::CompleteResize(int event_flags) {
431 window_resizer_->CompleteDrag(event_flags); 432 window_resizer_->CompleteDrag(event_flags);
432 window_resizer_.reset(); 433 window_resizer_.reset();
433 434
434 // Mouse may still be over resizer, if not hide. 435 // Mouse may still be over resizer, if not hide.
435 gfx::Point screen_loc = gfx::Screen::GetCursorScreenPoint(); 436 gfx::Point screen_loc = gfx::Screen::GetCursorScreenPoint();
436 if (!resize_widget_->GetWindowBoundsInScreen().Contains(screen_loc)) 437 if (!resize_widget_->GetWindowBoundsInScreen().Contains(screen_loc)) {
437 Hide(); 438 Hide();
439 } else {
440 // If the mouse is over the resizer we need to remove observers on any of
441 // the |other_windows|. If we start another resize we'll recalculate the
442 // |other_windows| and invoke AddObserver() as necessary.
443 for (size_t i = 0; i < windows_.other_windows.size(); ++i)
444 windows_.other_windows[i]->RemoveObserver(this);
445 windows_.other_windows.clear();
446 }
438 } 447 }
439 448
440 void MultiWindowResizeController::CancelResize() { 449 void MultiWindowResizeController::CancelResize() {
441 if (!window_resizer_.get()) 450 if (!window_resizer_.get())
442 return; // Happens if window was destroyed and we nuked the WindowResizer. 451 return; // Happens if window was destroyed and we nuked the WindowResizer.
443 window_resizer_->RevertDrag(); 452 window_resizer_->RevertDrag();
444 window_resizer_.reset(); 453 window_resizer_.reset();
445 Hide(); 454 Hide();
446 } 455 }
447 456
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 506
498 gfx::Point window_loc(location_in_screen); 507 gfx::Point window_loc(location_in_screen);
499 aura::Window::ConvertPointToWindow( 508 aura::Window::ConvertPointToWindow(
500 window->GetRootWindow(), window, &window_loc); 509 window->GetRootWindow(), window, &window_loc);
501 return window->HitTest(window_loc) && 510 return window->HitTest(window_loc) &&
502 window->delegate()->GetNonClientComponent(window_loc) == component; 511 window->delegate()->GetNonClientComponent(window_loc) == component;
503 } 512 }
504 513
505 } // namespace internal 514 } // namespace internal
506 } // namespace ash 515 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/workspace/multi_window_resize_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698