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

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
« no previous file with comments | « ash/wm/workspace/workspace_window_resizer.h ('k') | chrome/app/generated_resources.grd » ('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/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 DCHECK(snap_type_ == SNAP_LEFT || snap_type_ == SNAP_RIGHT);
915 DockedAlignment desired_alignment = (snap_type_ == SNAP_LEFT) ?
916 DOCKED_ALIGNMENT_LEFT : DOCKED_ALIGNMENT_RIGHT;
917 const bool can_dock =
918 dock_layout_->CanDockWindow(GetTarget(), desired_alignment) &&
915 dock_layout_->GetAlignmentOfWindow(GetTarget()) != DOCKED_ALIGNMENT_NONE; 919 dock_layout_->GetAlignmentOfWindow(GetTarget()) != DOCKED_ALIGNMENT_NONE;
916 if (!can_dock) { 920 if (!can_dock) {
917 // If the window cannot be docked, undock the window. This may change the 921 // If the window cannot be docked, undock the window. This may change the
918 // workspace bounds and hence |snap_type_|. 922 // workspace bounds and hence |snap_type_|.
919 SetDraggedWindowDocked(false); 923 SetDraggedWindowDocked(false);
920 snap_type_ = GetSnapType(location); 924 snap_type_ = GetSnapType(location);
921 } 925 }
922 const bool can_snap = snap_type_ != SNAP_NONE && window_state()->CanSnap(); 926 const bool can_snap = snap_type_ != SNAP_NONE && window_state()->CanSnap();
923 if (!can_snap && !can_dock) { 927 if (!can_snap && !can_dock) {
924 snap_type_ = SNAP_NONE; 928 snap_type_ = SNAP_NONE;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 parent->StackChildAtTop(map.rbegin()->second); 987 parent->StackChildAtTop(map.rbegin()->second);
984 for (IndexToWindowMap::const_reverse_iterator i = map.rbegin(); 988 for (IndexToWindowMap::const_reverse_iterator i = map.rbegin();
985 i != map.rend(); ) { 989 i != map.rend(); ) {
986 aura::Window* window = i->second; 990 aura::Window* window = i->second;
987 ++i; 991 ++i;
988 if (i != map.rend()) 992 if (i != map.rend())
989 parent->StackChildBelow(i->second, window); 993 parent->StackChildBelow(i->second, window);
990 } 994 }
991 } 995 }
992 996
993 SnapType WorkspaceWindowResizer::GetSnapType( 997 WorkspaceWindowResizer::SnapType WorkspaceWindowResizer::GetSnapType(
994 const gfx::Point& location) const { 998 const gfx::Point& location) const {
995 // TODO: this likely only wants total display area, not the area of a single 999 // TODO: this likely only wants total display area, not the area of a single
996 // display. 1000 // display.
997 gfx::Rect area(ScreenUtil::GetDisplayWorkAreaBoundsInParent(GetTarget())); 1001 gfx::Rect area(ScreenUtil::GetDisplayWorkAreaBoundsInParent(GetTarget()));
998 if (details().source == aura::client::WINDOW_MOVE_SOURCE_TOUCH) { 1002 if (details().source == aura::client::WINDOW_MOVE_SOURCE_TOUCH) {
999 // Increase tolerance for touch-snapping near the screen edges. This is only 1003 // 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. 1004 // necessary when the work area left or right edge is same as screen edge.
1001 gfx::Rect display_bounds(ScreenUtil::GetDisplayBoundsInParent(GetTarget())); 1005 gfx::Rect display_bounds(ScreenUtil::GetDisplayBoundsInParent(GetTarget()));
1002 int inset_left = 0; 1006 int inset_left = 0;
1003 if (area.x() == display_bounds.x()) 1007 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); 1039 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED);
1036 gfx::Rect snapped_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent( 1040 gfx::Rect snapped_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent(
1037 GetTarget()); 1041 GetTarget());
1038 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED) 1042 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED)
1039 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); 1043 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width());
1040 snapped_bounds.set_width(bounds_in_parent.width()); 1044 snapped_bounds.set_width(bounds_in_parent.width());
1041 return bounds_in_parent == snapped_bounds; 1045 return bounds_in_parent == snapped_bounds;
1042 } 1046 }
1043 1047
1044 } // namespace ash 1048 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_window_resizer.h ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698