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

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

Issue 1898223002: Removes most aura dependencies from WindowResizer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_aura_from_window_state
Patch Set: nit and merge Created 4 years, 8 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
« no previous file with comments | « ash/wm/window_resizer.cc ('k') | ash/wm/workspace/phantom_window_controller.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_util.h" 7 #include "ash/screen_util.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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 464
465 if (windows_.direction == LEFT_RIGHT) 465 if (windows_.direction == LEFT_RIGHT)
466 bounds.set_y(show_bounds_in_screen_.y()); 466 bounds.set_y(show_bounds_in_screen_.y());
467 else 467 else
468 bounds.set_x(show_bounds_in_screen_.x()); 468 bounds.set_x(show_bounds_in_screen_.x());
469 resize_widget_->SetBounds(bounds); 469 resize_widget_->SetBounds(bounds);
470 } 470 }
471 471
472 void MultiWindowResizeController::CompleteResize() { 472 void MultiWindowResizeController::CompleteResize() {
473 window_resizer_->CompleteDrag(); 473 window_resizer_->CompleteDrag();
474 wm::GetWindowState(window_resizer_->GetTarget())->DeleteDragDetails(); 474 wm::GetWindowState(window_resizer_->GetAuraTarget())->DeleteDragDetails();
475 window_resizer_.reset(); 475 window_resizer_.reset();
476 476
477 // Mouse may still be over resizer, if not hide. 477 // Mouse may still be over resizer, if not hide.
478 gfx::Point screen_loc = gfx::Screen::GetScreen()->GetCursorScreenPoint(); 478 gfx::Point screen_loc = gfx::Screen::GetScreen()->GetCursorScreenPoint();
479 if (!resize_widget_->GetWindowBoundsInScreen().Contains(screen_loc)) { 479 if (!resize_widget_->GetWindowBoundsInScreen().Contains(screen_loc)) {
480 Hide(); 480 Hide();
481 } else { 481 } else {
482 // If the mouse is over the resizer we need to remove observers on any of 482 // If the mouse is over the resizer we need to remove observers on any of
483 // the |other_windows|. If we start another resize we'll recalculate the 483 // the |other_windows|. If we start another resize we'll recalculate the
484 // |other_windows| and invoke AddObserver() as necessary. 484 // |other_windows| and invoke AddObserver() as necessary.
485 for (size_t i = 0; i < windows_.other_windows.size(); ++i) 485 for (size_t i = 0; i < windows_.other_windows.size(); ++i)
486 windows_.other_windows[i]->RemoveObserver(this); 486 windows_.other_windows[i]->RemoveObserver(this);
487 windows_.other_windows.clear(); 487 windows_.other_windows.clear();
488 488
489 CreateMouseWatcher(); 489 CreateMouseWatcher();
490 } 490 }
491 } 491 }
492 492
493 void MultiWindowResizeController::CancelResize() { 493 void MultiWindowResizeController::CancelResize() {
494 if (!window_resizer_) 494 if (!window_resizer_)
495 return; // Happens if window was destroyed and we nuked the WindowResizer. 495 return; // Happens if window was destroyed and we nuked the WindowResizer.
496 window_resizer_->RevertDrag(); 496 window_resizer_->RevertDrag();
497 wm::GetWindowState(window_resizer_->GetTarget())->DeleteDragDetails(); 497 wm::GetWindowState(window_resizer_->GetAuraTarget())->DeleteDragDetails();
498 window_resizer_.reset(); 498 window_resizer_.reset();
499 Hide(); 499 Hide();
500 } 500 }
501 501
502 gfx::Rect MultiWindowResizeController::CalculateResizeWidgetBounds( 502 gfx::Rect MultiWindowResizeController::CalculateResizeWidgetBounds(
503 const gfx::Point& location_in_parent) const { 503 const gfx::Point& location_in_parent) const {
504 gfx::Size pref = resize_widget_->GetContentsView()->GetPreferredSize(); 504 gfx::Size pref = resize_widget_->GetContentsView()->GetPreferredSize();
505 int x = 0, y = 0; 505 int x = 0, y = 0;
506 if (windows_.direction == LEFT_RIGHT) { 506 if (windows_.direction == LEFT_RIGHT) {
507 x = windows_.window1->bounds().right() - pref.width() / 2; 507 x = windows_.window1->bounds().right() - pref.width() / 2;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 bool MultiWindowResizeController::IsOverComponent( 573 bool MultiWindowResizeController::IsOverComponent(
574 aura::Window* window, 574 aura::Window* window,
575 const gfx::Point& location_in_screen, 575 const gfx::Point& location_in_screen,
576 int component) const { 576 int component) const {
577 gfx::Point window_loc(location_in_screen); 577 gfx::Point window_loc(location_in_screen);
578 ::wm::ConvertPointFromScreen(window, &window_loc); 578 ::wm::ConvertPointFromScreen(window, &window_loc);
579 return window->delegate()->GetNonClientComponent(window_loc) == component; 579 return window->delegate()->GetNonClientComponent(window_loc) == component;
580 } 580 }
581 581
582 } // namespace ash 582 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_resizer.cc ('k') | ash/wm/workspace/phantom_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698