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

Unified Diff: ios/web_view/shell/shell_view_controller.mm

Issue 2665653003: Convert ios/web_view to ARC. (Closed)
Patch Set: Created 3 years, 11 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
Index: ios/web_view/shell/shell_view_controller.mm
diff --git a/ios/web_view/shell/shell_view_controller.mm b/ios/web_view/shell/shell_view_controller.mm
index c164096a240284127311bf597fb6d77e4cf23b5b..4fa95a231aa66c7ee87a5f7caf0ccde9c46dc682 100644
--- a/ios/web_view/shell/shell_view_controller.mm
+++ b/ios/web_view/shell/shell_view_controller.mm
@@ -4,23 +4,26 @@
#import "ios/web_view/shell/shell_view_controller.h"
-#import "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
#import "ios/web_view/public/criwv.h"
#import "ios/web_view/public/criwv_web_view.h"
#import "ios/web_view/shell/translate_controller.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
namespace {
const CGFloat kButtonSize = 44;
}
-@interface ShellViewController () {
- base::scoped_nsobject<UIView> _containerView;
- base::scoped_nsobject<UITextField> _field;
- base::scoped_nsobject<UIToolbar> _toolbar;
- base::scoped_nsprotocol<id<CRIWVWebView>> _webView;
- base::scoped_nsobject<TranslateController> _translateController;
-}
+@interface ShellViewController ()
+@property (nonatomic, strong) UIView* containerView;
Eugene But (OOO till 7-30) 2017/01/30 17:53:39 Please add comments for properties.
michaeldo 2017/01/30 19:30:35 Done.
+@property (nonatomic, strong) UITextField* field;
+@property (nonatomic, strong) UIToolbar* toolbar;
+@property (nonatomic, strong) id<CRIWVWebView> webView;
+@property (nonatomic, strong) TranslateController* translateController;
+
- (void)back;
- (void)forward;
- (void)stopLoading;
@@ -28,13 +31,19 @@ const CGFloat kButtonSize = 44;
@implementation ShellViewController
+@synthesize containerView = _containerView;
+@synthesize field = _field;
+@synthesize toolbar = _toolbar;
+@synthesize webView = _webView;
+@synthesize translateController = _translateController;
+
- (void)viewDidLoad {
[super viewDidLoad];
CGRect bounds = self.view.bounds;
// Set up the toolbar.
- _toolbar.reset([[UIToolbar alloc] init]);
+ self.toolbar = [[UIToolbar alloc] init];
[_toolbar setBarTintColor:[UIColor colorWithRed:0.337
green:0.467
blue:0.988
@@ -45,7 +54,7 @@ const CGFloat kButtonSize = 44;
[self.view addSubview:_toolbar];
// Set up the container view.
- _containerView.reset([[UIView alloc] init]);
+ self.containerView = [[UIView alloc] init];
[_containerView setFrame:CGRectMake(0, 64, CGRectGetWidth(bounds),
CGRectGetHeight(bounds) - 64)];
[_containerView setBackgroundColor:[UIColor lightGrayColor]];
@@ -55,11 +64,11 @@ const CGFloat kButtonSize = 44;
// Text field.
const int kButtonCount = 3;
- _field.reset([[UITextField alloc]
+ self.field = [[UITextField alloc]
initWithFrame:CGRectMake(kButtonCount * kButtonSize, 6,
CGRectGetWidth([_toolbar frame]) -
kButtonCount * kButtonSize - 10,
- 31)]);
+ 31)];
[_field setDelegate:self];
[_field setBackground:[[UIImage imageNamed:@"textfield_background"]
resizableImageWithCapInsets:UIEdgeInsetsMake(
@@ -109,7 +118,7 @@ const CGFloat kButtonSize = 44;
[_toolbar addSubview:stop];
[_toolbar addSubview:_field];
- _webView.reset([[CRIWV webView] retain]);
+ self.webView = [CRIWV webView];
[_webView setDelegate:self];
UIView* view = [_webView view];
[_containerView addSubview:view];
@@ -121,7 +130,7 @@ const CGFloat kButtonSize = 44;
}
- (UIBarPosition)positionForBar:(id<UIBarPositioning>)bar {
- if (bar == _toolbar.get()) {
+ if (bar == _toolbar) {
return UIBarPositionTopAttached;
}
return UIBarPositionAny;
@@ -186,7 +195,7 @@ const CGFloat kButtonSize = 44;
- (id<CRIWVTranslateDelegate>)translateDelegate {
if (!_translateController)
- _translateController.reset([[TranslateController alloc] init]);
+ self.translateController = [[TranslateController alloc] init];
return _translateController;
}

Powered by Google App Engine
This is Rietveld 408576698