OLD | NEW |
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 "ui/base/cocoa/nib_loading.h" | 5 #import "ui/base/cocoa/nib_loading.h" |
6 | 6 |
7 #include "base/mac/bundle_locations.h" | 7 #include "base/mac/bundle_locations.h" |
8 #include "base/memory/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
11 | 11 |
12 NSView* GetViewFromNib(NSString* name) { | 12 NSView* GetViewFromNib(NSString* name) { |
13 scoped_nsobject<NSNib> nib( | 13 base::scoped_nsobject<NSNib> nib( |
14 [[NSNib alloc] initWithNibNamed:name | 14 [[NSNib alloc] initWithNibNamed:name |
15 bundle:base::mac::FrameworkBundle()]); | 15 bundle:base::mac::FrameworkBundle()]); |
16 if (!nib) | 16 if (!nib) |
17 return nil; | 17 return nil; |
18 | 18 |
19 NSArray* objects; | 19 NSArray* objects; |
20 BOOL success = [nib instantiateNibWithOwner:nil | 20 BOOL success = [nib instantiateNibWithOwner:nil |
21 topLevelObjects:&objects]; | 21 topLevelObjects:&objects]; |
22 if (!success) | 22 if (!success) |
23 return nil; | 23 return nil; |
(...skipping 12 matching lines...) Expand all Loading... |
36 if (![view isKindOfClass:[NSView class]]) | 36 if (![view isKindOfClass:[NSView class]]) |
37 continue; | 37 continue; |
38 | 38 |
39 return [[view retain] autorelease]; | 39 return [[view retain] autorelease]; |
40 } | 40 } |
41 | 41 |
42 return nil; | 42 return nil; |
43 } | 43 } |
44 | 44 |
45 } // namespace ui | 45 } // namespace ui |
OLD | NEW |