| 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/snap_sizer.h" | 5 #include "ash/wm/workspace/snap_sizer.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
| 10 #include "ash/wm/window_resizer.h" | 10 #include "ash/wm/window_resizer.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 return GetTargetBoundsForSize(current % arraysize(kSizes)); | 83 return GetTargetBoundsForSize(current % arraysize(kSizes)); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void SnapSizer::SelectDefaultSizeAndDisableResize() { | 86 void SnapSizer::SelectDefaultSizeAndDisableResize() { |
| 87 resize_disabled_ = true; | 87 resize_disabled_ = true; |
| 88 size_index_ = 0; | 88 size_index_ = 0; |
| 89 target_bounds_ = GetTargetBounds(); | 89 target_bounds_ = GetTargetBounds(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 gfx::Rect SnapSizer::GetTargetBoundsForSize(size_t size_index) const { | 92 gfx::Rect SnapSizer::GetTargetBoundsForSize(size_t size_index) const { |
| 93 gfx::Rect work_area(ScreenAsh::GetUnmaximizedWorkAreaBoundsInParent(window_)); | 93 gfx::Rect work_area(ScreenAsh::GetDisplayWorkAreaBoundsInParent(window_)); |
| 94 int y = work_area.y(); | 94 int y = work_area.y(); |
| 95 // We don't align to the bottom of the grid as the launcher may not | 95 // We don't align to the bottom of the grid as the launcher may not |
| 96 // necessarily align to the grid (happens when auto-hidden). | 96 // necessarily align to the grid (happens when auto-hidden). |
| 97 int max_y = work_area.bottom(); | 97 int max_y = work_area.bottom(); |
| 98 int width = kSizes[size_index]; | 98 int width = kSizes[size_index]; |
| 99 if (resize_disabled_) { | 99 if (resize_disabled_) { |
| 100 width = std::max(1024, work_area.width() / 2); | 100 width = std::max(1024, work_area.width() / 2); |
| 101 } else { | 101 } else { |
| 102 while (width >= work_area.width()) { | 102 while (width >= work_area.width()) { |
| 103 if (size_index >= arraysize(kSizes)) | 103 if (size_index >= arraysize(kSizes)) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 return GetTargetBoundsForSize(size_index_); | 151 return GetTargetBoundsForSize(size_index_); |
| 152 } | 152 } |
| 153 | 153 |
| 154 bool SnapSizer::AlongEdge(int x) const { | 154 bool SnapSizer::AlongEdge(int x) const { |
| 155 gfx::Rect area(ScreenAsh::GetDisplayBoundsInParent(window_)); | 155 gfx::Rect area(ScreenAsh::GetDisplayBoundsInParent(window_)); |
| 156 return (x <= area.x()) || (x >= area.right() - 1); | 156 return (x <= area.x()) || (x >= area.right() - 1); |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace internal | 159 } // namespace internal |
| 160 } // namespace ash | 160 } // namespace ash |
| OLD | NEW |