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