| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ios/chrome/browser/ui/native_content_controller.h" | 5 #import "ios/chrome/browser/ui/native_content_controller.h" |
| 6 | 6 |
| 7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 | 8 |
| 9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
| 10 #import "base/mac/foundation_util.h" | 10 #import "base/mac/foundation_util.h" |
| 11 | 11 #include "base/mac/objc_property_releaser.h" |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 13 #error "This file requires ARC support." | |
| 14 #endif | |
| 15 | 12 |
| 16 @implementation NativeContentController { | 13 @implementation NativeContentController { |
| 17 GURL _url; | 14 GURL _url; |
| 15 base::mac::ObjCPropertyReleaser _propertyReleaser_NativeContentController; |
| 18 } | 16 } |
| 19 | 17 |
| 20 @synthesize view = _view; | 18 @synthesize view = _view; |
| 21 @synthesize title = _title; | 19 @synthesize title = _title; |
| 22 @synthesize url = _url; | 20 @synthesize url = _url; |
| 23 | 21 |
| 24 - (instancetype)initWithNibName:(NSString*)nibName url:(const GURL&)url { | 22 - (instancetype)initWithNibName:(NSString*)nibName url:(const GURL&)url { |
| 25 self = [super init]; | 23 self = [super init]; |
| 26 if (self) { | 24 if (self) { |
| 25 _propertyReleaser_NativeContentController.Init( |
| 26 self, [NativeContentController class]); |
| 27 if (nibName.length) { | 27 if (nibName.length) { |
| 28 [base::mac::FrameworkBundle() loadNibNamed:nibName | 28 [base::mac::FrameworkBundle() loadNibNamed:nibName |
| 29 owner:self | 29 owner:self |
| 30 options:nil]; | 30 options:nil]; |
| 31 } | 31 } |
| 32 _url = url; | 32 _url = url; |
| 33 } | 33 } |
| 34 return self; | 34 return self; |
| 35 } | 35 } |
| 36 | 36 |
| 37 - (instancetype)init { |
| 38 NOTREACHED(); |
| 39 return nil; |
| 40 } |
| 41 |
| 37 - (instancetype)initWithURL:(const GURL&)url { | 42 - (instancetype)initWithURL:(const GURL&)url { |
| 38 return [self initWithNibName:nil url:url]; | 43 return [self initWithNibName:nil url:url]; |
| 39 } | 44 } |
| 40 | 45 |
| 41 - (void)dealloc { | 46 - (void)dealloc { |
| 42 [_view removeFromSuperview]; | 47 [_view removeFromSuperview]; |
| 48 [super dealloc]; |
| 43 } | 49 } |
| 44 | 50 |
| 45 #pragma mark CRWNativeContent | 51 #pragma mark CRWNativeContent |
| 46 | 52 |
| 47 - (void)handleLowMemory { | 53 - (void)handleLowMemory { |
| 48 // TODO(pinkerton): What should this do? Toss the view? | 54 // TODO(pinkerton): What should this do? Toss the view? |
| 49 } | 55 } |
| 50 | 56 |
| 51 - (BOOL)isViewAlive { | 57 - (BOOL)isViewAlive { |
| 52 // TODO(pinkerton): See handleLowMemory above. | 58 // TODO(pinkerton): See handleLowMemory above. |
| 53 return YES; | 59 return YES; |
| 54 } | 60 } |
| 55 | 61 |
| 56 - (void)reload { | 62 - (void)reload { |
| 57 // Not implemented in base class. | 63 // Not implemented in base class. |
| 58 } | 64 } |
| 59 | 65 |
| 60 @end | 66 @end |
| OLD | NEW |