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

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

Issue 263083005: Remove "Alternate frame caption button style" command line flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/workspace/workspace_window_resizer.h" 5 #include "ash/wm/workspace/workspace_window_resizer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 snap_type_ = GetSnapType(location); 904 snap_type_ = GetSnapType(location);
905 if (snap_type_ == SNAP_NONE || snap_type_ != last_type) { 905 if (snap_type_ == SNAP_NONE || snap_type_ != last_type) {
906 snap_phantom_window_controller_.reset(); 906 snap_phantom_window_controller_.reset();
907 edge_cycler_.reset(); 907 edge_cycler_.reset();
908 if (snap_type_ == SNAP_NONE) { 908 if (snap_type_ == SNAP_NONE) {
909 SetDraggedWindowDocked(false); 909 SetDraggedWindowDocked(false);
910 return; 910 return;
911 } 911 }
912 } 912 }
913 913
914 const bool can_dock = dock_layout_->CanDockWindow(GetTarget(), snap_type_) && 914 DockedAlignment desired_alignment = (snap_type_ == SNAP_LEFT) ?
flackr 2014/05/06 00:08:31 Hmmm, maybe DCHECK(snap_type_ == SNAP_LEFT || snap
pkotwicz 2014/05/06 01:43:17 Done.
915 DOCKED_ALIGNMENT_LEFT : DOCKED_ALIGNMENT_RIGHT;
916 const bool can_dock =
917 dock_layout_->CanDockWindow(GetTarget(), desired_alignment) &&
915 dock_layout_->GetAlignmentOfWindow(GetTarget()) != DOCKED_ALIGNMENT_NONE; 918 dock_layout_->GetAlignmentOfWindow(GetTarget()) != DOCKED_ALIGNMENT_NONE;
916 if (!can_dock) { 919 if (!can_dock) {
917 // If the window cannot be docked, undock the window. This may change the 920 // If the window cannot be docked, undock the window. This may change the
918 // workspace bounds and hence |snap_type_|. 921 // workspace bounds and hence |snap_type_|.
919 SetDraggedWindowDocked(false); 922 SetDraggedWindowDocked(false);
920 snap_type_ = GetSnapType(location); 923 snap_type_ = GetSnapType(location);
921 } 924 }
922 const bool can_snap = snap_type_ != SNAP_NONE && window_state()->CanSnap(); 925 const bool can_snap = snap_type_ != SNAP_NONE && window_state()->CanSnap();
923 if (!can_snap && !can_dock) { 926 if (!can_snap && !can_dock) {
924 snap_type_ = SNAP_NONE; 927 snap_type_ = SNAP_NONE;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 parent->StackChildAtTop(map.rbegin()->second); 986 parent->StackChildAtTop(map.rbegin()->second);
984 for (IndexToWindowMap::const_reverse_iterator i = map.rbegin(); 987 for (IndexToWindowMap::const_reverse_iterator i = map.rbegin();
985 i != map.rend(); ) { 988 i != map.rend(); ) {
986 aura::Window* window = i->second; 989 aura::Window* window = i->second;
987 ++i; 990 ++i;
988 if (i != map.rend()) 991 if (i != map.rend())
989 parent->StackChildBelow(i->second, window); 992 parent->StackChildBelow(i->second, window);
990 } 993 }
991 } 994 }
992 995
993 SnapType WorkspaceWindowResizer::GetSnapType( 996 WorkspaceWindowResizer::SnapType WorkspaceWindowResizer::GetSnapType(
994 const gfx::Point& location) const { 997 const gfx::Point& location) const {
995 // TODO: this likely only wants total display area, not the area of a single 998 // TODO: this likely only wants total display area, not the area of a single
996 // display. 999 // display.
997 gfx::Rect area(ScreenUtil::GetDisplayWorkAreaBoundsInParent(GetTarget())); 1000 gfx::Rect area(ScreenUtil::GetDisplayWorkAreaBoundsInParent(GetTarget()));
998 if (details().source == aura::client::WINDOW_MOVE_SOURCE_TOUCH) { 1001 if (details().source == aura::client::WINDOW_MOVE_SOURCE_TOUCH) {
999 // Increase tolerance for touch-snapping near the screen edges. This is only 1002 // Increase tolerance for touch-snapping near the screen edges. This is only
1000 // necessary when the work area left or right edge is same as screen edge. 1003 // necessary when the work area left or right edge is same as screen edge.
1001 gfx::Rect display_bounds(ScreenUtil::GetDisplayBoundsInParent(GetTarget())); 1004 gfx::Rect display_bounds(ScreenUtil::GetDisplayBoundsInParent(GetTarget()));
1002 int inset_left = 0; 1005 int inset_left = 0;
1003 if (area.x() == display_bounds.x()) 1006 if (area.x() == display_bounds.x())
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED); 1038 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED);
1036 gfx::Rect snapped_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent( 1039 gfx::Rect snapped_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent(
1037 GetTarget()); 1040 GetTarget());
1038 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED) 1041 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED)
1039 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); 1042 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width());
1040 snapped_bounds.set_width(bounds_in_parent.width()); 1043 snapped_bounds.set_width(bounds_in_parent.width());
1041 return bounds_in_parent == snapped_bounds; 1044 return bounds_in_parent == snapped_bounds;
1042 } 1045 }
1043 1046
1044 } // namespace ash 1047 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698