OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/app_list/app_list_positioner.h" | 5 #include "chrome/browser/ui/app_list/app_list_positioner.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/gfx/point.h" | 10 #include "ui/gfx/geometry/point.h" |
11 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
12 | 12 |
13 AppListPositioner::AppListPositioner(const gfx::Display& display, | 13 AppListPositioner::AppListPositioner(const gfx::Display& display, |
14 const gfx::Size& window_size, | 14 const gfx::Size& window_size, |
15 int min_distance_from_edge) | 15 int min_distance_from_edge) |
16 : display_(display), | 16 : display_(display), |
17 window_size_(window_size), | 17 window_size_(window_size), |
18 min_distance_from_edge_(min_distance_from_edge) {} | 18 min_distance_from_edge_(min_distance_from_edge) {} |
19 | 19 |
20 void AppListPositioner::WorkAreaSubtract(const gfx::Rect& rect) { | 20 void AppListPositioner::WorkAreaSubtract(const gfx::Rect& rect) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 // Anchor the center of the window in a region that prevents the window | 196 // Anchor the center of the window in a region that prevents the window |
197 // showing outside of the work area. | 197 // showing outside of the work area. |
198 bounds_rect.Inset(window_size_.width() / 2 + min_distance_from_edge_, | 198 bounds_rect.Inset(window_size_.width() / 2 + min_distance_from_edge_, |
199 window_size_.height() / 2 + min_distance_from_edge_); | 199 window_size_.height() / 2 + min_distance_from_edge_); |
200 | 200 |
201 anchor.SetToMax(bounds_rect.origin()); | 201 anchor.SetToMax(bounds_rect.origin()); |
202 anchor.SetToMin(bounds_rect.bottom_right()); | 202 anchor.SetToMin(bounds_rect.bottom_right()); |
203 return anchor; | 203 return anchor; |
204 } | 204 } |
OLD | NEW |