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

Side by Side Diff: ash/wm/gestures/system_pinch_handler.cc

Issue 23471004: Only support left/right maximizing at 50% width when the --ash-enable-alternate-caption-button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
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/gestures/system_pinch_handler.h" 5 #include "ash/wm/gestures/system_pinch_handler.h"
6 6
7 #include "ash/launcher/launcher.h" 7 #include "ash/launcher/launcher.h"
8 #include "ash/screen_ash.h" 8 #include "ash/screen_ash.h"
9 #include "ash/shelf/shelf_widget.h" 9 #include "ash/shelf/shelf_widget.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 break; 79 break;
80 } 80 }
81 81
82 case ui::ET_GESTURE_MULTIFINGER_SWIPE: { 82 case ui::ET_GESTURE_MULTIFINGER_SWIPE: {
83 phantom_.Hide(); 83 phantom_.Hide();
84 pinch_factor_ = 1.0; 84 pinch_factor_ = 1.0;
85 phantom_state_ = PHANTOM_WINDOW_NORMAL; 85 phantom_state_ = PHANTOM_WINDOW_NORMAL;
86 86
87 if (event.details().swipe_left() || event.details().swipe_right()) { 87 if (event.details().swipe_left() || event.details().swipe_right()) {
88 // Snap for left/right swipes. 88 // Snap for left/right swipes.
89 ui::ScopedLayerAnimationSettings settings( 89 using internal::SnapSizer;
90 target_->layer()->GetAnimator()); 90 if (SnapSizer::CanSnapWindow(target_)) {
91 internal::SnapSizer::SnapWindow(target_, 91 ui::ScopedLayerAnimationSettings settings(
92 event.details().swipe_left() ? internal::SnapSizer::LEFT_EDGE : 92 target_->layer()->GetAnimator());
93 internal::SnapSizer::RIGHT_EDGE); 93 SnapSizer::Edge edge = event.details().swipe_left() ?
94 SnapSizer::LEFT_EDGE : SnapSizer::RIGHT_EDGE;
95 SnapSizer::SnapWindow(target_, edge, SnapSizer::STEP_NO);
96 }
94 } else if (event.details().swipe_up()) { 97 } else if (event.details().swipe_up()) {
95 if (!wm::IsWindowMaximized(target_) && 98 if (!wm::IsWindowMaximized(target_) &&
96 !wm::IsWindowFullscreen(target_)) 99 !wm::IsWindowFullscreen(target_) &&
100 wm::CanMaximizeWindow(target_))
97 wm::MaximizeWindow(target_); 101 wm::MaximizeWindow(target_);
98 } else if (event.details().swipe_down()) { 102 } else if (event.details().swipe_down()) {
99 wm::MinimizeWindow(target_); 103 wm::MinimizeWindow(target_);
100 } else { 104 } else {
101 NOTREACHED() << "Swipe happened without a direction."; 105 NOTREACHED() << "Swipe happened without a direction.";
102 } 106 }
103 break; 107 break;
104 } 108 }
105 109
106 default: 110 default:
(...skipping 29 matching lines...) Expand all
136 phantom_state_ = PHANTOM_WINDOW_MINIMIZED; 140 phantom_state_ = PHANTOM_WINDOW_MINIMIZED;
137 return rect; 141 return rect;
138 } 142 }
139 143
140 phantom_state_ = PHANTOM_WINDOW_NORMAL; 144 phantom_state_ = PHANTOM_WINDOW_NORMAL;
141 return window->bounds(); 145 return window->bounds();
142 } 146 }
143 147
144 } // namespace internal 148 } // namespace internal
145 } // namespace ash 149 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698