Commit 54842ee2 authored by stkhapugin's avatar stkhapugin Committed by Commit bot

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

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

Review-Url: https://codereview.chromium.org/2569713002
Cr-Commit-Position: refs/heads/master@{#437891}
parent 890d09b2
......@@ -5,6 +5,7 @@
import("//build/config/ios/rules.gni")
source_set("ui") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"UIView+SizeClassSupport.h",
"UIView+SizeClassSupport.mm",
......
......@@ -8,6 +8,10 @@
#import "base/ios/ios_util.h"
#import "ios/chrome/browser/ui/ui_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
// Returns the SizeClassIdiom corresponding with |size_class|.
......
......@@ -9,6 +9,10 @@
#include "ios/chrome/browser/ui/reversed_animation.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
CAAnimation* FrameAnimationMake(CALayer* layer,
CGRect beginFrame,
CGRect endFrame) {
......@@ -59,7 +63,7 @@ CAAnimation* AnimationGroupMake(NSArray* animations) {
CAAnimation* DelayedAnimationMake(CAAnimation* animation,
CFTimeInterval delay) {
CAAnimation* delayedAnimation = [[animation copy] autorelease];
CAAnimation* delayedAnimation = [animation copy];
if (delayedAnimation) {
delayedAnimation.beginTime = delay;
delayedAnimation = AnimationGroupMake(@[ delayedAnimation ]);
......
......@@ -10,9 +10,12 @@
#include "base/mac/bundle_locations.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_cftyperef.h"
#import "base/mac/scoped_nsobject.h"
#import "ios/chrome/browser/ui/ui_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
// This is a utility function that may be used as a standalone helper function
// to generate a radial gradient UIImage.
UIImage* GetRadialGradient(CGRect backgroundRect,
......@@ -48,8 +51,7 @@ UIImage* GetRadialGradient(CGRect backgroundRect,
}
void InstallBackgroundInView(UIView* view) {
UIImageView* imageView =
[[[UIImageView alloc] initWithFrame:view.bounds] autorelease];
UIImageView* imageView = [[UIImageView alloc] initWithFrame:view.bounds];
imageView.image = [UIImage imageNamed:@"stack_view_background_noise.jpg"];
imageView.contentMode = UIViewContentModeScaleAspectFill;
imageView.autoresizingMask =
......
......@@ -6,6 +6,10 @@
#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
bool IsOffTheRecordSessionActive() {
ios::ChromeBrowserProvider* chrome_browser_provider =
ios::GetChromeBrowserProvider();
......
......@@ -4,9 +4,12 @@
#import "ios/chrome/browser/ui/favicon_view.h"
#include "base/mac/objc_property_releaser.h"
#import "ios/chrome/browser/ui/uikit_ui_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
// Default corner radius for the favicon image view.
const CGFloat kDefaultCornerRadius = 3;
......@@ -14,13 +17,12 @@ const CGFloat kDefaultCornerRadius = 3;
@interface FaviconViewNew () {
// Property releaser for FaviconViewNew.
base::mac::ObjCPropertyReleaser _propertyReleaser_FaviconViewNew;
}
// Image view for the favicon.
@property(nonatomic, retain) UIImageView* faviconImageView;
@property(nonatomic, strong) UIImageView* faviconImageView;
// Label for fallback favicon placeholder.
@property(nonatomic, retain) UILabel* faviconFallbackLabel;
@property(nonatomic, strong) UILabel* faviconFallbackLabel;
@end
......@@ -31,7 +33,6 @@ const CGFloat kDefaultCornerRadius = 3;
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
_propertyReleaser_FaviconViewNew.Init(self, [FaviconViewNew class]);
_faviconImageView = [[UIImageView alloc] initWithFrame:self.bounds];
_faviconImageView.clipsToBounds = YES;
_faviconImageView.layer.cornerRadius = kDefaultCornerRadius;
......
......@@ -9,6 +9,10 @@
#include "base/strings/sys_string_conversions.h"
#include "ios/chrome/browser/application_context.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
// English is the default locale for the Terms of Service.
const char kEnglishLocale[] = "en";
......
......@@ -9,6 +9,10 @@
#include "ui/gfx/color_analysis.h"
#include "ui/gfx/image/image.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
UIColor* DominantColorForImage(const gfx::Image& image, CGFloat opacity) {
SkColor color = color_utils::CalculateKMeanColorOfBitmap(*image.ToSkBitmap());
UIColor* result = [UIColor colorWithRed:SkColorGetR(color) / 255.0
......
......@@ -20,7 +20,7 @@ class GURL;
@interface NativeContentController : NSObject<CRWNativeContent>
// Top-level view.
@property(nonatomic, retain) IBOutlet UIView* view;
@property(nonatomic, strong) IBOutlet UIView* view;
@property(nonatomic, copy) NSString* title;
@property(nonatomic, readonly, assign) const GURL& url;
......
......@@ -8,11 +8,13 @@
#include "base/mac/bundle_locations.h"
#import "base/mac/foundation_util.h"
#include "base/mac/objc_property_releaser.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation NativeContentController {
GURL _url;
base::mac::ObjCPropertyReleaser _propertyReleaser_NativeContentController;
}
@synthesize view = _view;
......@@ -22,8 +24,6 @@
- (instancetype)initWithNibName:(NSString*)nibName url:(const GURL&)url {
self = [super init];
if (self) {
_propertyReleaser_NativeContentController.Init(
self, [NativeContentController class]);
if (nibName.length) {
[base::mac::FrameworkBundle() loadNibNamed:nibName
owner:self
......@@ -34,18 +34,12 @@
return self;
}
- (instancetype)init {
NOTREACHED();
return nil;
}
- (instancetype)initWithURL:(const GURL&)url {
return [self initWithNibName:nil url:url];
}
- (void)dealloc {
[_view removeFromSuperview];
[super dealloc];
}
#pragma mark CRWNativeContent
......
......@@ -7,6 +7,10 @@
#include "base/logging.h"
#include "ios/chrome/browser/ui/ui_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation OrientationLimitingNavigationController
- (NSUInteger)supportedInterfaceOrientations {
......
......@@ -9,7 +9,10 @@
#include <cmath>
#include "base/logging.h"
#include "base/mac/objc_property_releaser.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@protocol ReversedAnimationProtocol;
typedef CAAnimation<ReversedAnimationProtocol> ReversedAnimation;
......@@ -60,10 +63,7 @@ void UpdateReversedAnimation(ReversedAnimation* reversedAnimation,
#pragma mark - ReversedBasicAnimation
@interface ReversedBasicAnimation
: CABasicAnimation<ReversedAnimationProtocol> {
base::mac::ObjCPropertyReleaser _propertyReleaser_ReversedBasicAnimation;
}
@interface ReversedBasicAnimation : CABasicAnimation<ReversedAnimationProtocol>
// Returns an animation that performs |animation| in reverse when added to
// |layer|. |parentBeginTime| should be set to the beginTime in absolute time
......@@ -81,15 +81,6 @@ void UpdateReversedAnimation(ReversedAnimation* reversedAnimation,
@synthesize animationDirection = _animationDirection;
@synthesize animationTimeOffset = _animationTimeOffset;
- (instancetype)init {
self = [super init];
if (self) {
_propertyReleaser_ReversedBasicAnimation.Init(
self, [ReversedBasicAnimation class]);
}
return self;
}
- (instancetype)copyWithZone:(NSZone*)zone {
ReversedBasicAnimation* copy = [super copyWithZone:zone];
copy.originalAnimation = self.originalAnimation;
......@@ -136,10 +127,7 @@ void UpdateReversedAnimation(ReversedAnimation* reversedAnimation,
#pragma mark - ReversedAnimationGroup
@interface ReversedAnimationGroup
: CAAnimationGroup<ReversedAnimationProtocol> {
base::mac::ObjCPropertyReleaser _propertyReleaser_ReversedAnimationGroup;
}
@interface ReversedAnimationGroup : CAAnimationGroup<ReversedAnimationProtocol>
// Returns an animation that performs |animation| in reverse when added to
// |layer|. |parentBeginTime| should be set to the beginTime in absolute time
......@@ -157,15 +145,6 @@ void UpdateReversedAnimation(ReversedAnimation* reversedAnimation,
@synthesize animationDirection = _animationDirection;
@synthesize animationTimeOffset = _animationTimeOffset;
- (instancetype)init {
self = [super init];
if (self) {
_propertyReleaser_ReversedAnimationGroup.Init(
self, [ReversedAnimationGroup class]);
}
return self;
}
- (instancetype)copyWithZone:(NSZone*)zone {
ReversedAnimationGroup* copy = [super copyWithZone:zone];
copy.originalAnimation = self.originalAnimation;
......
......@@ -10,6 +10,10 @@
#include "base/logging.h"
#include "ios/chrome/browser/ui/ui_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
bool UseRTLLayout() {
return base::i18n::IsRTL();
}
......
......@@ -7,11 +7,14 @@
#include <UIKit/UIKit.h>
#include "base/logging.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
#include "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
#include "ios/chrome/browser/ui/commands/show_mail_composer_command.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
void ShowMailComposer(const base::string16& to_recipient,
const base::string16& subject,
const base::string16& body,
......@@ -19,13 +22,12 @@ void ShowMailComposer(const base::string16& to_recipient,
const base::FilePath& text_file_to_attach,
int email_not_configured_alert_title_id,
int email_not_configured_alert_message_id) {
base::scoped_nsobject<ShowMailComposerCommand>
command([[ShowMailComposerCommand alloc]
ShowMailComposerCommand* command = [[ShowMailComposerCommand alloc]
initWithToRecipient:base::SysUTF16ToNSString(to_recipient)
subject:base::SysUTF16ToNSString(subject)
body:base::SysUTF16ToNSString(body)
emailNotConfiguredAlertTitleId:email_not_configured_alert_title_id
emailNotConfiguredAlertMessageId:email_not_configured_alert_message_id]);
emailNotConfiguredAlertMessageId:email_not_configured_alert_message_id];
[command setTextFileToAttach:text_file_to_attach];
UIWindow* main_window = [[UIApplication sharedApplication] keyWindow];
DCHECK(main_window);
......
......@@ -4,15 +4,17 @@
#import "ios/chrome/browser/ui/show_privacy_settings_util.h"
#import "base/mac/scoped_nsobject.h"
#import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
#import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
#include "ios/chrome/browser/ui/commands/ios_command_ids.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
void ShowClearBrowsingData() {
base::scoped_nsobject<GenericChromeCommand> command(
[[GenericChromeCommand alloc]
initWithTag:IDC_SHOW_CLEAR_BROWSING_DATA_SETTINGS]);
GenericChromeCommand* command = [[GenericChromeCommand alloc]
initWithTag:IDC_SHOW_CLEAR_BROWSING_DATA_SETTINGS];
UIWindow* main_window = [[UIApplication sharedApplication] keyWindow];
[main_window chromeExecuteCommand:command];
}
......@@ -8,6 +8,10 @@
#include "base/logging.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
// The absolute maximum swipe angle from |x = y| for a swipe to begin.
......
......@@ -10,6 +10,10 @@
#import "ios/chrome/browser/ui/uikit_ui_util.h"
#include "ui/gfx/ios/uikit_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
bool IsIPadIdiom() {
UIUserInterfaceIdiom idiom = [[UIDevice currentDevice] userInterfaceIdiom];
return idiom == UIUserInterfaceIdiomPad;
......
......@@ -15,7 +15,6 @@
#include "base/ios/ios_util.h"
#include "base/logging.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_nsobject.h"
#include "ios/chrome/browser/experimental_flags.h"
#include "ios/chrome/browser/ui/ui_util.h"
#include "ios/web/public/web_thread.h"
......@@ -24,6 +23,10 @@
#include "ui/gfx/ios/uikit_util.h"
#include "ui/gfx/scoped_cg_context_save_gstate_mac.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
// Linearly interpolate between |a| and |b| by fraction |f|. Satisfies
......@@ -552,8 +555,8 @@ void ApplyVisualConstraintsWithMetricsAndOptions(
NSDictionary* subviewsDictionary,
NSDictionary* metrics,
NSLayoutFormatOptions options) {
base::scoped_nsobject<NSMutableArray> layoutConstraints(
[[NSMutableArray arrayWithCapacity:constraints.count * 3] retain]);
NSMutableArray* layoutConstraints =
[NSMutableArray arrayWithCapacity:constraints.count * 3];
for (NSString* constraint in constraints) {
DCHECK([constraint isKindOfClass:[NSString class]]);
[layoutConstraints addObjectsFromArray:
......
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