| 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 "apps/app_shim/app_shim_handler_mac.h" | 5 #include "apps/app_shim/app_shim_handler_mac.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/scoped_nsobject.h" | 10 #include "base/memory/scoped_nsobject.h" |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 // Just display at the bottom-left of the display the cursor is on. | 322 // Just display at the bottom-left of the display the cursor is on. |
| 323 return NSMakePoint(display_bounds.x(), | 323 return NSMakePoint(display_bounds.x(), |
| 324 max_y - display_bounds.bottom()); | 324 max_y - display_bounds.bottom()); |
| 325 } | 325 } |
| 326 | 326 |
| 327 // Anchor the center of the window in a region that prevents the window | 327 // Anchor the center of the window in a region that prevents the window |
| 328 // showing outside of the work area. | 328 // showing outside of the work area. |
| 329 const NSSize window_size = [window frame].size; | 329 const NSSize window_size = [window frame].size; |
| 330 gfx::Rect anchor_area = display.work_area(); | 330 gfx::Rect anchor_area = display.work_area(); |
| 331 anchor_area.Inset(window_size.width / 2, window_size.height / 2); | 331 anchor_area.Inset(window_size.width / 2, window_size.height / 2); |
| 332 anchor.ClampToMin(anchor_area.origin()); | 332 anchor.SetToMax(anchor_area.origin()); |
| 333 anchor.ClampToMax(anchor_area.bottom_right()); | 333 anchor.SetToMin(anchor_area.bottom_right()); |
| 334 | 334 |
| 335 // Move anchor to the dock, keeping the other axis aligned with the cursor. | 335 // Move anchor to the dock, keeping the other axis aligned with the cursor. |
| 336 switch (dock_location) { | 336 switch (dock_location) { |
| 337 case DockLocationBottom: | 337 case DockLocationBottom: |
| 338 anchor.set_y(anchor_area.bottom()); | 338 anchor.set_y(anchor_area.bottom()); |
| 339 break; | 339 break; |
| 340 case DockLocationLeft: | 340 case DockLocationLeft: |
| 341 anchor.set_x(anchor_area.x()); | 341 anchor.set_x(anchor_area.x()); |
| 342 break; | 342 break; |
| 343 case DockLocationRight: | 343 case DockLocationRight: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 364 | 364 |
| 365 // static | 365 // static |
| 366 AppListService* AppListService::Get() { | 366 AppListService* AppListService::Get() { |
| 367 return AppListServiceMac::GetInstance(); | 367 return AppListServiceMac::GetInstance(); |
| 368 } | 368 } |
| 369 | 369 |
| 370 // static | 370 // static |
| 371 void AppListService::InitAll(Profile* initial_profile) { | 371 void AppListService::InitAll(Profile* initial_profile) { |
| 372 Get()->Init(initial_profile); | 372 Get()->Init(initial_profile); |
| 373 } | 373 } |
| OLD | NEW |