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

Side by Side Diff: ash/wm/toplevel_window_event_handler.cc

Issue 169713003: Remove WindowState::IsNormalShowState() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | « ash/wm/resize_shadow_and_cursor_unittest.cc ('k') | ash/wm/window_positioner.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/toplevel_window_event_handler.h" 5 #include "ash/wm/toplevel_window_event_handler.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/wm/resize_shadow_controller.h" 8 #include "ash/wm/resize_shadow_controller.h"
9 #include "ash/wm/window_resizer.h" 9 #include "ash/wm/window_resizer.h"
10 #include "ash/wm/window_state.h" 10 #include "ash/wm/window_state.h"
(...skipping 27 matching lines...) Expand all
38 namespace { 38 namespace {
39 39
40 // Returns whether |window| can be moved via a two finger drag given 40 // Returns whether |window| can be moved via a two finger drag given
41 // the hittest results of the two fingers. 41 // the hittest results of the two fingers.
42 bool CanStartTwoFingerMove(aura::Window* window, 42 bool CanStartTwoFingerMove(aura::Window* window,
43 int window_component1, 43 int window_component1,
44 int window_component2) { 44 int window_component2) {
45 // We allow moving a window via two fingers when the hittest components are 45 // We allow moving a window via two fingers when the hittest components are
46 // HTCLIENT. This is done so that a window can be dragged via two fingers when 46 // HTCLIENT. This is done so that a window can be dragged via two fingers when
47 // the tab strip is full and hitting the caption area is difficult. We check 47 // the tab strip is full and hitting the caption area is difficult. We check
48 // the window type and the show state so that we do not steal touches from the 48 // the window type and the show type so that we do not steal touches from the
49 // web contents. 49 // web contents.
50 if (!ash::wm::GetWindowState(window)->IsNormalShowState() || 50 if (!wm::GetWindowState(window)->IsNormalOrSnapped() ||
51 window->type() != ui::wm::WINDOW_TYPE_NORMAL) { 51 window->type() != ui::wm::WINDOW_TYPE_NORMAL) {
52 return false; 52 return false;
53 } 53 }
54 int component1_behavior = 54 int component1_behavior =
55 WindowResizer::GetBoundsChangeForWindowComponent(window_component1); 55 WindowResizer::GetBoundsChangeForWindowComponent(window_component1);
56 int component2_behavior = 56 int component2_behavior =
57 WindowResizer::GetBoundsChangeForWindowComponent(window_component2); 57 WindowResizer::GetBoundsChangeForWindowComponent(window_component2);
58 return (component1_behavior & WindowResizer::kBoundsChange_Resizes) == 0 && 58 return (component1_behavior & WindowResizer::kBoundsChange_Resizes) == 0 &&
59 (component2_behavior & WindowResizer::kBoundsChange_Resizes) == 0; 59 (component2_behavior & WindowResizer::kBoundsChange_Resizes) == 0;
60 } 60 }
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 CompleteDrag(DRAG_COMPLETE); 329 CompleteDrag(DRAG_COMPLETE);
330 event->StopPropagation(); 330 event->StopPropagation();
331 return; 331 return;
332 case ui::ET_SCROLL_FLING_START: 332 case ui::ET_SCROLL_FLING_START:
333 CompleteDrag(DRAG_COMPLETE); 333 CompleteDrag(DRAG_COMPLETE);
334 334
335 // TODO(pkotwicz): Fix tests which inadvertantly start flings and check 335 // TODO(pkotwicz): Fix tests which inadvertantly start flings and check
336 // window_resizer_->IsMove() instead of the hittest component at |event|'s 336 // window_resizer_->IsMove() instead of the hittest component at |event|'s
337 // location. 337 // location.
338 if (GetWindowComponent(target, *event) != HTCAPTION || 338 if (GetWindowComponent(target, *event) != HTCAPTION ||
339 !wm::GetWindowState(target)->IsNormalShowState()) { 339 !wm::GetWindowState(target)->IsNormalOrSnapped()) {
340 return; 340 return;
341 } 341 }
342 342
343 if (event->details().velocity_y() > kMinVertVelocityForWindowMinimize) { 343 if (event->details().velocity_y() > kMinVertVelocityForWindowMinimize) {
344 SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_MINIMIZED); 344 SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_MINIMIZED);
345 } else if (event->details().velocity_y() < 345 } else if (event->details().velocity_y() <
346 -kMinVertVelocityForWindowMinimize) { 346 -kMinVertVelocityForWindowMinimize) {
347 SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_MAXIMIZED); 347 SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_MAXIMIZED);
348 } else if (event->details().velocity_x() > 348 } else if (event->details().velocity_x() >
349 kMinHorizVelocityForWindowSwipe) { 349 kMinHorizVelocityForWindowSwipe) {
350 SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_RIGHT_SNAPPED); 350 SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_RIGHT_SNAPPED);
351 } else if (event->details().velocity_x() < 351 } else if (event->details().velocity_x() <
352 -kMinHorizVelocityForWindowSwipe) { 352 -kMinHorizVelocityForWindowSwipe) {
353 SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_LEFT_SNAPPED); 353 SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_LEFT_SNAPPED);
354 } 354 }
355 event->StopPropagation(); 355 event->StopPropagation();
356 return; 356 return;
357 case ui::ET_GESTURE_MULTIFINGER_SWIPE: 357 case ui::ET_GESTURE_MULTIFINGER_SWIPE:
358 if (!wm::GetWindowState(target)->IsNormalShowState()) 358 if (!wm::GetWindowState(target)->IsNormalOrSnapped())
359 return; 359 return;
360 360
361 CompleteDrag(DRAG_COMPLETE); 361 CompleteDrag(DRAG_COMPLETE);
362 362
363 if (event->details().swipe_down()) 363 if (event->details().swipe_down())
364 SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_MINIMIZED); 364 SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_MINIMIZED);
365 else if (event->details().swipe_up()) 365 else if (event->details().swipe_up())
366 SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_MAXIMIZED); 366 SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_MAXIMIZED);
367 else if (event->details().swipe_right()) 367 else if (event->details().swipe_right())
368 SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_RIGHT_SNAPPED); 368 SetWindowShowTypeFromGesture(target, wm::SHOW_TYPE_RIGHT_SNAPPED);
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 605
606 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { 606 void ToplevelWindowEventHandler::ResizerWindowDestroyed() {
607 // We explicitly don't invoke RevertDrag() since that may do things to window. 607 // We explicitly don't invoke RevertDrag() since that may do things to window.
608 // Instead we destroy the resizer. 608 // Instead we destroy the resizer.
609 window_resizer_.reset(); 609 window_resizer_.reset();
610 610
611 CompleteDrag(DRAG_REVERT); 611 CompleteDrag(DRAG_REVERT);
612 } 612 }
613 613
614 } // namespace ash 614 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/resize_shadow_and_cursor_unittest.cc ('k') | ash/wm/window_positioner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698