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

Unified Diff: ui/base/cocoa/nib_loading.mm

Issue 1836363002: Mac: Remove use of deprecated [NSNib instantiateNibWithOwner:topLevelObjects:]. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160329-Mac-DeploymentTarget
Patch Set: Add forward declare 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/cocoa/nib_loading.mm
diff --git a/ui/base/cocoa/nib_loading.mm b/ui/base/cocoa/nib_loading.mm
index dd0eb48d806e1454028ada1c2b738b131d6b61ae..6deea19f698b4006a023f41257f5d214e1b30a24 100644
--- a/ui/base/cocoa/nib_loading.mm
+++ b/ui/base/cocoa/nib_loading.mm
@@ -7,6 +7,11 @@
#include "base/mac/bundle_locations.h"
#include "base/mac/scoped_nsobject.h"
+@interface NSNib (MountainLionSDK)
+- (BOOL)instantiateWithOwner:(nullable id)owner
+ topLevelObjects:(NSArray* __nonnull* __nullable)topLevelObjects;
+@end
+
namespace ui {
NSView* GetViewFromNib(NSString* name) {
@@ -17,18 +22,10 @@ NSView* GetViewFromNib(NSString* name) {
return nil;
NSArray* objects;
- BOOL success = [nib instantiateNibWithOwner:nil
- topLevelObjects:&objects];
+ BOOL success = [nib instantiateWithOwner:nil topLevelObjects:&objects];
if (!success)
return nil;
- // When loading a nib manually (as opposed to using an NSWindowController or
- // NSViewController), all the top-level objects need to be explicitly
- // released. See
- // http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html#//apple_ref/doc/uid/10000051i-CH4-SW10
- // for more information.
- [objects makeObjectsPerformSelector:@selector(release)];
-
// For some strange reason, even nibs that appear to have but one top-level
// object often have more (an NSApplication, etc.). Filter out what isn't
// desired.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698