Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / ios / chrome / browser / ui / native_content_controller.mm
blob0fd43a252e964b03e62cb163b29b89c6ef96b0a9
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
3 // found in the LICENSE file.
5 #import "ios/chrome/browser/ui/native_content_controller.h"
7 #import <UIKit/UIKit.h>
9 #include "base/mac/bundle_locations.h"
10 #import "base/mac/foundation_util.h"
11 #include "base/mac/objc_property_releaser.h"
13 @implementation NativeContentController {
14   GURL _url;
15   base::mac::ObjCPropertyReleaser _propertyReleaser_NativeContentController;
18 @synthesize view = _view;
19 @synthesize title = _title;
20 @synthesize url = _url;
22 - (instancetype)initWithNibName:(NSString*)nibName url:(const GURL&)url {
23   self = [super init];
24   if (self) {
25     _propertyReleaser_NativeContentController.Init(
26         self, [NativeContentController class]);
27     if (nibName.length) {
28       [base::mac::FrameworkBundle() loadNibNamed:nibName
29                                            owner:self
30                                          options:nil];
31     }
32     _url = url;
33   }
34   return self;
37 - (instancetype)init {
38   NOTREACHED();
39   return nil;
42 - (instancetype)initWithURL:(const GURL&)url {
43   return [self initWithNibName:nil url:url];
46 - (void)dealloc {
47   [_view removeFromSuperview];
48   [super dealloc];
51 #pragma mark CRWNativeContent
53 - (void)handleLowMemory {
54   // TODO(pinkerton): What should this do? Toss the view?
57 - (BOOL)isViewAlive {
58   // TODO(pinkerton): See handleLowMemory above.
59   return YES;
62 - (void)reload {
63   // Not implemented in base class.
66 @end