| 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/point.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 void AppListPositioner::WorkAreaInset(int left, | 26 void AppListPositioner::WorkAreaInset(int left, |
| 27 int top, | 27 int top, |
| 28 int right, | 28 int right, |
| 29 int bottom) { | 29 int bottom) { |
| 30 gfx::Rect work_area = display_.work_area(); | 30 gfx::Rect work_area = display_.work_area(); |
| 31 work_area.Inset(left, top, right, bottom); | 31 work_area.Inset(left, top, right, bottom); |
| 32 display_.set_work_area(work_area); | 32 display_.set_work_area(work_area); |
| 33 } | 33 } |
| 34 | 34 |
| 35 gfx::Point AppListPositioner::GetAnchorPointForScreenCenter() const { |
| 36 return display_.bounds().CenterPoint(); |
| 37 } |
| 38 |
| 35 gfx::Point AppListPositioner::GetAnchorPointForScreenCorner( | 39 gfx::Point AppListPositioner::GetAnchorPointForScreenCorner( |
| 36 ScreenCorner corner) const { | 40 ScreenCorner corner) const { |
| 37 const gfx::Rect& screen_rect = display_.bounds(); | 41 const gfx::Rect& screen_rect = display_.bounds(); |
| 38 gfx::Point anchor; | 42 gfx::Point anchor; |
| 39 switch (corner) { | 43 switch (corner) { |
| 40 case SCREEN_CORNER_TOP_LEFT: | 44 case SCREEN_CORNER_TOP_LEFT: |
| 41 anchor = screen_rect.origin(); | 45 anchor = screen_rect.origin(); |
| 42 break; | 46 break; |
| 43 case SCREEN_CORNER_TOP_RIGHT: | 47 case SCREEN_CORNER_TOP_RIGHT: |
| 44 anchor = screen_rect.top_right(); | 48 anchor = screen_rect.top_right(); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 195 |
| 192 // 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 |
| 193 // showing outside of the work area. | 197 // showing outside of the work area. |
| 194 bounds_rect.Inset(window_size_.width() / 2 + min_distance_from_edge_, | 198 bounds_rect.Inset(window_size_.width() / 2 + min_distance_from_edge_, |
| 195 window_size_.height() / 2 + min_distance_from_edge_); | 199 window_size_.height() / 2 + min_distance_from_edge_); |
| 196 | 200 |
| 197 anchor.SetToMax(bounds_rect.origin()); | 201 anchor.SetToMax(bounds_rect.origin()); |
| 198 anchor.SetToMin(bounds_rect.bottom_right()); | 202 anchor.SetToMin(bounds_rect.bottom_right()); |
| 199 return anchor; | 203 return anchor; |
| 200 } | 204 } |
| OLD | NEW |