Commit b806e284 authored by stkhapugin's avatar stkhapugin Committed by Commit bot

[ObjC ARC] Converts ios/chrome/browser/ui/elements:elements to ARC.

Automatically generated ARCMigrate commit
Notable issues:None
BUG=624363
TEST=None

Review-Url: https://codereview.chromium.org/2568843002
Cr-Commit-Position: refs/heads/master@{#438861}
parent a3f67a21
......@@ -3,6 +3,7 @@
# found in the LICENSE file.
source_set("elements") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"selector_coordinator.h",
"selector_coordinator.mm",
......
......@@ -4,19 +4,21 @@
#import "ios/chrome/browser/ui/elements/selector_coordinator.h"
#import "base/mac/objc_property_releaser.h"
#import "ios/chrome/browser/ui/elements/selector_picker_view_controller.h"
#import "ios/chrome/browser/ui/elements/selector_picker_presentation_controller.h"
#import "ios/chrome/browser/ui/elements/selector_view_controller_delegate.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@interface SelectorCoordinator ()<SelectorViewControllerDelegate,
UIViewControllerTransitioningDelegate> {
base::mac::ObjCPropertyReleaser _propertyReleaser_SelectorCoordinator;
__unsafe_unretained id<SelectorCoordinatorDelegate> _delegate;
}
// Redeclaration of infoBarPickerController as readwrite.
@property(nonatomic, nullable, retain)
@property(nonatomic, nullable, strong)
SelectorPickerViewController* selectorPickerViewController;
@end
......@@ -28,20 +30,10 @@
@synthesize delegate = _delegate;
@synthesize selectorPickerViewController = _selectorPickerViewController;
- (nullable instancetype)initWithBaseViewController:
(nullable UIViewController*)viewController {
self = [super initWithBaseViewController:viewController];
if (self) {
_propertyReleaser_SelectorCoordinator.Init(self,
[SelectorCoordinator class]);
}
return self;
}
- (void)start {
self.selectorPickerViewController = [[[SelectorPickerViewController alloc]
initWithOptions:self.options
default:self.defaultOption] autorelease];
self.selectorPickerViewController =
[[SelectorPickerViewController alloc] initWithOptions:self.options
default:self.defaultOption];
self.selectorPickerViewController.delegate = self;
self.selectorPickerViewController.modalTransitionStyle =
......@@ -75,9 +67,9 @@
presentationControllerForPresentedViewController:(UIViewController*)presented
presentingViewController:(UIViewController*)presenting
sourceViewController:(UIViewController*)source {
return [[[SelectorPickerPresentationController alloc]
return [[SelectorPickerPresentationController alloc]
initWithPresentedViewController:self.selectorPickerViewController
presentingViewController:self.baseViewController] autorelease];
presentingViewController:self.baseViewController];
}
@end
......@@ -4,13 +4,12 @@
#import "ios/chrome/browser/ui/elements/selector_picker_presentation_controller.h"
#import "base/mac/objc_property_releaser.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@interface SelectorPickerPresentationController () {
base::mac::ObjCPropertyReleaser
_propertyReleaser_SelectorPickerPresentationController;
}
@property(nonatomic, retain) UIView* dimmingView;
@interface SelectorPickerPresentationController ()
@property(nonatomic, strong) UIView* dimmingView;
@end
@implementation SelectorPickerPresentationController
......@@ -22,8 +21,6 @@
self = [super initWithPresentedViewController:presented
presentingViewController:presenting];
if (self) {
_propertyReleaser_SelectorPickerPresentationController.Init(
self, [SelectorPickerPresentationController class]);
_dimmingView = [[UIView alloc] initWithFrame:CGRectZero];
_dimmingView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4];
}
......
......@@ -6,7 +6,11 @@
#import "ios/chrome/browser/ui/elements/selector_view_controller_delegate.h"
#include "base/logging.h"
#import "base/mac/objc_property_releaser.h"
#import "base/mac/foundation_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
// Font size of text in the picker view.
......@@ -15,8 +19,6 @@ CGFloat kUIPickerFontSize = 26;
@interface SelectorPickerViewController ()<UIPickerViewDelegate,
UIPickerViewDataSource> {
base::mac::ObjCPropertyReleaser
_propertyReleaser_SelectorPickerViewController;
__unsafe_unretained id<SelectorViewControllerDelegate> _delegate;
}
// Options to display.
......@@ -24,9 +26,9 @@ CGFloat kUIPickerFontSize = 26;
// The default option.
@property(nonatomic, copy) NSString* defaultOption;
// The displayed UINavigationBar. Exposed for testing.
@property(nonatomic, retain) UINavigationBar* navigationBar;
@property(nonatomic, strong) UINavigationBar* navigationBar;
// The displayed UIPickerView. Exposed for testing.
@property(nonatomic, retain) UIPickerView* pickerView;
@property(nonatomic, strong) UIPickerView* pickerView;
// Action for the "Done" button.
- (void)doneButtonPressed;
// Action for the "Cancel" button.
......@@ -45,10 +47,8 @@ CGFloat kUIPickerFontSize = 26;
default:(NSString*)defaultOption {
self = [super initWithNibName:nil bundle:nil];
if (self) {
_propertyReleaser_SelectorPickerViewController.Init(
self, [SelectorPickerViewController class]);
_options = [options copy];
_defaultOption = [defaultOption copy];
_options = [options copy];
}
return self;
}
......@@ -64,15 +64,12 @@ CGFloat kUIPickerFontSize = 26;
}
- (void)loadView {
self.pickerView =
[[[UIPickerView alloc] initWithFrame:CGRectZero] autorelease];
self.navigationBar =
[[[UINavigationBar alloc] initWithFrame:CGRectZero] autorelease];
self.pickerView = [[UIPickerView alloc] initWithFrame:CGRectZero];
self.navigationBar = [[UINavigationBar alloc] initWithFrame:CGRectZero];
self.pickerView.translatesAutoresizingMaskIntoConstraints = NO;
self.navigationBar.translatesAutoresizingMaskIntoConstraints = NO;
UIStackView* stackView = [[[UIStackView alloc]
initWithArrangedSubviews:@[ self.navigationBar, self.pickerView ]]
autorelease];
UIStackView* stackView = [[UIStackView alloc]
initWithArrangedSubviews:@[ self.navigationBar, self.pickerView ]];
stackView.axis = UILayoutConstraintAxisVertical;
self.view = stackView;
}
......@@ -91,15 +88,15 @@ CGFloat kUIPickerFontSize = 26;
}
UINavigationItem* navigationItem =
[[[UINavigationItem alloc] initWithTitle:@""] autorelease];
UIBarButtonItem* doneButton = [[[UIBarButtonItem alloc]
[[UINavigationItem alloc] initWithTitle:@""];
UIBarButtonItem* doneButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self
action:@selector(doneButtonPressed)] autorelease];
UIBarButtonItem* cancelButton = [[[UIBarButtonItem alloc]
action:@selector(doneButtonPressed)];
UIBarButtonItem* cancelButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self
action:@selector(cancelButtonPressed)] autorelease];
action:@selector(cancelButtonPressed)];
[navigationItem setRightBarButtonItem:doneButton];
[navigationItem setLeftBarButtonItem:cancelButton];
[navigationItem setHidesBackButton:YES];
......@@ -133,8 +130,8 @@ CGFloat kUIPickerFontSize = 26;
reusingView:(UIView*)view {
DCHECK_EQ(0, component);
UILabel* label = [view isKindOfClass:[UILabel class]]
? (UILabel*)view
: [[[UILabel alloc] init] autorelease];
? base::mac::ObjCCastStrict<UILabel>(view)
: [[UILabel alloc] init];
NSString* text = self.options[row];
label.text = text;
label.textAlignment = NSTextAlignmentCenter;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment