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