| 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 #include "base/mac/objc_property_releaser.h" | 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 12 | 15 |
| 13 @implementation NativeContentController { | 16 @implementation NativeContentController { |
| 14 GURL _url; | 17 GURL _url; |
| 15 base::mac::ObjCPropertyReleaser _propertyReleaser_NativeContentController; | |
| 16 } | 18 } |
| 17 | 19 |
| 18 @synthesize view = _view; | 20 @synthesize view = _view; |
| 19 @synthesize title = _title; | 21 @synthesize title = _title; |
| 20 @synthesize url = _url; | 22 @synthesize url = _url; |
| 21 | 23 |
| 22 - (instancetype)initWithNibName:(NSString*)nibName url:(const GURL&)url { | 24 - (instancetype)initWithNibName:(NSString*)nibName url:(const GURL&)url { |
| 23 self = [super init]; | 25 self = [super init]; |
| 24 if (self) { | 26 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 | |
| 42 - (instancetype)initWithURL:(const GURL&)url { | 37 - (instancetype)initWithURL:(const GURL&)url { |
| 43 return [self initWithNibName:nil url:url]; | 38 return [self initWithNibName:nil url:url]; |
| 44 } | 39 } |
| 45 | 40 |
| 46 - (void)dealloc { | 41 - (void)dealloc { |
| 47 [_view removeFromSuperview]; | 42 [_view removeFromSuperview]; |
| 48 [super dealloc]; | |
| 49 } | 43 } |
| 50 | 44 |
| 51 #pragma mark CRWNativeContent | 45 #pragma mark CRWNativeContent |
| 52 | 46 |
| 53 - (void)handleLowMemory { | 47 - (void)handleLowMemory { |
| 54 // TODO(pinkerton): What should this do? Toss the view? | 48 // TODO(pinkerton): What should this do? Toss the view? |
| 55 } | 49 } |
| 56 | 50 |
| 57 - (BOOL)isViewAlive { | 51 - (BOOL)isViewAlive { |
| 58 // TODO(pinkerton): See handleLowMemory above. | 52 // TODO(pinkerton): See handleLowMemory above. |
| 59 return YES; | 53 return YES; |
| 60 } | 54 } |
| 61 | 55 |
| 62 - (void)reload { | 56 - (void)reload { |
| 63 // Not implemented in base class. | 57 // Not implemented in base class. |
| 64 } | 58 } |
| 65 | 59 |
| 66 @end | 60 @end |
| OLD | NEW |