OLD | NEW |
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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 SetDraggedWindowDocked(false); | 934 SetDraggedWindowDocked(false); |
935 snap_type_ = GetSnapType(location); | 935 snap_type_ = GetSnapType(location); |
936 } | 936 } |
937 const bool can_snap = snap_type_ != SNAP_NONE && window_state()->CanSnap(); | 937 const bool can_snap = snap_type_ != SNAP_NONE && window_state()->CanSnap(); |
938 if (!can_snap && !can_dock) { | 938 if (!can_snap && !can_dock) { |
939 snap_type_ = SNAP_NONE; | 939 snap_type_ = SNAP_NONE; |
940 snap_phantom_window_controller_.reset(); | 940 snap_phantom_window_controller_.reset(); |
941 edge_cycler_.reset(); | 941 edge_cycler_.reset(); |
942 return; | 942 return; |
943 } | 943 } |
944 if (!edge_cycler_) { | 944 if (!edge_cycler_) |
945 edge_cycler_.reset(new TwoStepEdgeCycler( | 945 edge_cycler_.reset(new TwoStepEdgeCycler(location)); |
946 location, snap_type_ == SNAP_LEFT | 946 else |
947 ? TwoStepEdgeCycler::DIRECTION_LEFT | |
948 : TwoStepEdgeCycler::DIRECTION_RIGHT)); | |
949 } else { | |
950 edge_cycler_->OnMove(location); | 947 edge_cycler_->OnMove(location); |
951 } | |
952 | 948 |
953 // Update phantom window with snapped or docked guide bounds. | 949 // Update phantom window with snapped or docked guide bounds. |
954 // Windows that cannot be snapped or are less wide than kMaxDockWidth can get | 950 // Windows that cannot be snapped or are less wide than kMaxDockWidth can get |
955 // docked without going through a snapping sequence. | 951 // docked without going through a snapping sequence. |
956 gfx::Rect phantom_bounds; | 952 gfx::Rect phantom_bounds; |
957 const bool should_dock = can_dock && | 953 const bool should_dock = can_dock && |
958 (!can_snap || | 954 (!can_snap || |
959 GetTarget()->bounds().width() <= | 955 GetTarget()->bounds().width() <= |
960 DockedWindowLayoutManager::kMaxDockWidth || | 956 DockedWindowLayoutManager::kMaxDockWidth || |
961 edge_cycler_->use_second_mode() || | 957 edge_cycler_->use_second_mode() || |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED); | 1050 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED); |
1055 gfx::Rect snapped_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent( | 1051 gfx::Rect snapped_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent( |
1056 GetTarget()); | 1052 GetTarget()); |
1057 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED) | 1053 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED) |
1058 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); | 1054 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); |
1059 snapped_bounds.set_width(bounds_in_parent.width()); | 1055 snapped_bounds.set_width(bounds_in_parent.width()); |
1060 return bounds_in_parent == snapped_bounds; | 1056 return bounds_in_parent == snapped_bounds; |
1061 } | 1057 } |
1062 | 1058 |
1063 } // namespace ash | 1059 } // namespace ash |
OLD | NEW |