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

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

Issue 753933003: Dismiss the multi window resizer when the user clicks outside of the resizer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@toplevel_consume_press
Patch Set: Created 6 years 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
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // MouseWatcherHost implementation for MultiWindowResizeController. Forwards 123 // MouseWatcherHost implementation for MultiWindowResizeController. Forwards
124 // Contains() to MultiWindowResizeController. 124 // Contains() to MultiWindowResizeController.
125 class MultiWindowResizeController::ResizeMouseWatcherHost : 125 class MultiWindowResizeController::ResizeMouseWatcherHost :
126 public views::MouseWatcherHost { 126 public views::MouseWatcherHost {
127 public: 127 public:
128 ResizeMouseWatcherHost(MultiWindowResizeController* host) : host_(host) {} 128 ResizeMouseWatcherHost(MultiWindowResizeController* host) : host_(host) {}
129 129
130 // MouseWatcherHost overrides: 130 // MouseWatcherHost overrides:
131 bool Contains(const gfx::Point& point_in_screen, 131 bool Contains(const gfx::Point& point_in_screen,
132 MouseEventType type) override { 132 MouseEventType type) override {
133 return host_->IsOverWindows(point_in_screen); 133 return (type == MOUSE_PRESS)
134 ? host_->IsOverResizeWidget(point_in_screen)
135 : host_->IsOverWindows(point_in_screen);
134 } 136 }
135 137
136 private: 138 private:
137 MultiWindowResizeController* host_; 139 MultiWindowResizeController* host_;
138 140
139 DISALLOW_COPY_AND_ASSIGN(ResizeMouseWatcherHost); 141 DISALLOW_COPY_AND_ASSIGN(ResizeMouseWatcherHost);
140 }; 142 };
141 143
142 MultiWindowResizeController::ResizeWindows::ResizeWindows() 144 MultiWindowResizeController::ResizeWindows::ResizeWindows()
143 : window1(NULL), 145 : window1(NULL),
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 x = location_in_parent.x() + kResizeWidgetPadding; 512 x = location_in_parent.x() + kResizeWidgetPadding;
511 if (x + pref.height() / 2 > windows_.window1->bounds().right() && 513 if (x + pref.height() / 2 > windows_.window1->bounds().right() &&
512 x + pref.height() / 2 > windows_.window2->bounds().right()) { 514 x + pref.height() / 2 > windows_.window2->bounds().right()) {
513 x = location_in_parent.x() - kResizeWidgetPadding - pref.width(); 515 x = location_in_parent.x() - kResizeWidgetPadding - pref.width();
514 } 516 }
515 y = windows_.window1->bounds().bottom() - pref.height() / 2; 517 y = windows_.window1->bounds().bottom() - pref.height() / 2;
516 } 518 }
517 return gfx::Rect(x, y, pref.width(), pref.height()); 519 return gfx::Rect(x, y, pref.width(), pref.height());
518 } 520 }
519 521
522 bool MultiWindowResizeController::IsOverResizeWidget(
523 const gfx::Point& location_in_screen) const {
524 return resize_widget_->GetWindowBoundsInScreen().Contains(
525 location_in_screen);
526 }
527
520 bool MultiWindowResizeController::IsOverWindows( 528 bool MultiWindowResizeController::IsOverWindows(
521 const gfx::Point& location_in_screen) const { 529 const gfx::Point& location_in_screen) const {
522 if (resize_widget_->GetWindowBoundsInScreen().Contains(location_in_screen)) 530 if (IsOverResizeWidget(location_in_screen))
523 return true; 531 return true;
524 532
525 if (windows_.direction == TOP_BOTTOM) { 533 if (windows_.direction == TOP_BOTTOM) {
526 if (!ContainsScreenX(windows_.window1, location_in_screen.x()) || 534 if (!ContainsScreenX(windows_.window1, location_in_screen.x()) ||
527 !ContainsScreenX(windows_.window2, location_in_screen.x())) { 535 !ContainsScreenX(windows_.window2, location_in_screen.x())) {
528 return false; 536 return false;
529 } 537 }
530 } else { 538 } else {
531 if (!ContainsScreenY(windows_.window1, location_in_screen.y()) || 539 if (!ContainsScreenY(windows_.window1, location_in_screen.y()) ||
532 !ContainsScreenY(windows_.window2, location_in_screen.y())) { 540 !ContainsScreenY(windows_.window2, location_in_screen.y())) {
(...skipping 29 matching lines...) Expand all
562 bool MultiWindowResizeController::IsOverComponent( 570 bool MultiWindowResizeController::IsOverComponent(
563 aura::Window* window, 571 aura::Window* window,
564 const gfx::Point& location_in_screen, 572 const gfx::Point& location_in_screen,
565 int component) const { 573 int component) const {
566 gfx::Point window_loc(location_in_screen); 574 gfx::Point window_loc(location_in_screen);
567 ::wm::ConvertPointFromScreen(window, &window_loc); 575 ::wm::ConvertPointFromScreen(window, &window_loc);
568 return window->delegate()->GetNonClientComponent(window_loc) == component; 576 return window->delegate()->GetNonClientComponent(window_loc) == component;
569 } 577 }
570 578
571 } // namespace ash 579 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/multi_window_resize_controller.h ('k') | ash/wm/workspace/multi_window_resize_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698