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

Side by Side Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm

Issue 1775223002: Prepare chrome/ for compilation with OS X 10.7 deployment target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile errors. Fix null-window error. Created 4 years, 9 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
OLDNEW
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 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h" 5 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/sdk_forward_declarations.h"
10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h" 11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h"
11 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_in fo.h" 12 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_in fo.h"
12 #import "chrome/browser/ui/cocoa/web_contents_modal_dialog_host_cocoa.h" 13 #import "chrome/browser/ui/cocoa/web_contents_modal_dialog_host_cocoa.h"
13 14
14 namespace { 15 namespace {
15 16
16 // Maps parent windows to sheet controllers. 17 // Maps parent windows to sheet controllers.
17 NSMutableDictionary* g_sheetControllers; 18 NSMutableDictionary* g_sheetControllers;
18 19
19 // Get a value for the given window that can be used as a key in a dictionary. 20 // Get a value for the given window that can be used as a key in a dictionary.
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 NSRect sheetFrame = NSZeroRect; 311 NSRect sheetFrame = NSZeroRect;
311 // This API needs Y to be the distance from the bottom of the overlay to 312 // This API needs Y to be the distance from the bottom of the overlay to
312 // the top of the sheet. X, width, and height are ignored. 313 // the top of the sheet. X, width, and height are ignored.
313 sheetFrame.origin.y = NSMaxY(viewFrame); 314 sheetFrame.origin.y = NSMaxY(viewFrame);
314 NSRect customSheetFrame = [delegate window:[parentView window] 315 NSRect customSheetFrame = [delegate window:[parentView window]
315 willPositionSheet:nil 316 willPositionSheet:nil
316 usingRect:sheetFrame]; 317 usingRect:sheetFrame];
317 viewFrame.size.height += NSMinY(customSheetFrame) - NSMinY(sheetFrame); 318 viewFrame.size.height += NSMinY(customSheetFrame) - NSMinY(sheetFrame);
318 } 319 }
319 320
320 viewFrame.origin = [[parentView window] convertBaseToScreen:viewFrame.origin]; 321 viewFrame = [[parentView window] convertRectToScreen:viewFrame];
321 return viewFrame; 322 return viewFrame;
322 } 323 }
323 324
324 - (NSPoint)originForSheetSize:(NSSize)sheetSize 325 - (NSPoint)originForSheetSize:(NSSize)sheetSize
325 inContainerRect:(NSRect)containerRect { 326 inContainerRect:(NSRect)containerRect {
326 NSPoint origin; 327 NSPoint origin;
327 origin.x = roundf(NSMinX(containerRect) + 328 origin.x = roundf(NSMinX(containerRect) +
328 (NSWidth(containerRect) - sheetSize.width) / 2.0); 329 (NSWidth(containerRect) - sheetSize.width) / 2.0);
329 origin.y = NSMaxY(containerRect) + 5 - sheetSize.height; 330 origin.y = NSMaxY(containerRect) + 5 - sheetSize.height;
330 return origin; 331 return origin;
(...skipping 22 matching lines...) Expand all
353 if ([activeView_ isEqual:[info parentView]]) 354 if ([activeView_ isEqual:[info parentView]])
354 activeView_.reset(); 355 activeView_.reset();
355 356
356 [parentWindow_ removeChildWindow:[info overlayWindow]]; 357 [parentWindow_ removeChildWindow:[info overlayWindow]];
357 [[info sheet] closeSheetWithAnimation:withAnimation]; 358 [[info sheet] closeSheetWithAnimation:withAnimation];
358 [[info overlayWindow] close]; 359 [[info overlayWindow] close];
359 [sheets_ removeObject:info]; 360 [sheets_ removeObject:info];
360 } 361 }
361 362
362 @end 363 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698