Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1880)

Side by Side Diff: chrome/browser/ui/app_list/app_list_service_mac.mm

Issue 14367021: Rename ClampToMin and ClampToMax (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | chrome/browser/ui/views/app_list/app_list_controller_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698