Commit cf0a0e0b authored by gambard's avatar gambard Committed by Commit bot

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

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

Review-Url: https://codereview.chromium.org/2838213002
Cr-Commit-Position: refs/heads/master@{#467940}
parent 834d21ef
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# found in the LICENSE file. # found in the LICENSE file.
source_set("fancy_ui") { source_set("fancy_ui") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [ sources = [
"bidi_container_view.h", "bidi_container_view.h",
"bidi_container_view.mm", "bidi_container_view.mm",
......
...@@ -6,26 +6,11 @@ ...@@ -6,26 +6,11 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#include "base/mac/scoped_nsobject.h"
namespace ios {
namespace rtl {
enum AdjustSubviewsForRTLType {
ADJUST_FRAME_AND_AUTOROTATION_MASK_FOR_ALL_SUBVIEWS,
ADJUST_FRAME_FOR_UPDATED_SUBVIEWS
};
} // namespace rtl
} // namespace ios
// A UIView that lays outs its subviews based on the direction of the current // A UIView that lays outs its subviews based on the direction of the current
// language. If the current language is RTL then during the first call to // language. If the current language is RTL then during the first call to
// |layoutSubviews|, this view will flip horizontally all its subviews around // |layoutSubviews|, this view will flip horizontally all its subviews around
// its center axis and adjust the autoresizing masks. // its center axis and adjust the autoresizing masks.
@interface BidiContainerView : UIView { @interface BidiContainerView : UIView
@private
ios::rtl::AdjustSubviewsForRTLType adjustSubviewsType_;
base::scoped_nsobject<NSMutableSet> subviewsToBeAdjustedForRTL_;
}
// Adds |subview| to the set of subviews that need to be adjusted to RTL. If the // Adds |subview| to the set of subviews that need to be adjusted to RTL. If the
// current language is RTL, then the next call |layoutSubviews| will flip // current language is RTL, then the next call |layoutSubviews| will flip
......
...@@ -7,7 +7,23 @@ ...@@ -7,7 +7,23 @@
#include "base/i18n/rtl.h" #include "base/i18n/rtl.h"
#include "base/logging.h" #include "base/logging.h"
@interface BidiContainerView () #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace ios {
namespace rtl {
enum AdjustSubviewsForRTLType {
ADJUST_FRAME_AND_AUTOROTATION_MASK_FOR_ALL_SUBVIEWS,
ADJUST_FRAME_FOR_UPDATED_SUBVIEWS
};
} // namespace rtl
} // namespace ios
@interface BidiContainerView () {
ios::rtl::AdjustSubviewsForRTLType adjustSubviewsType_;
NSMutableSet* subviewsToBeAdjustedForRTL_;
}
// Changes the autoresizing mask by mirroring it horizontally so that the RTL // Changes the autoresizing mask by mirroring it horizontally so that the RTL
// layout is bind to oposite sites than LRT one. // layout is bind to oposite sites than LRT one.
+ (UIViewAutoresizing)mirrorAutoresizingMask: + (UIViewAutoresizing)mirrorAutoresizingMask:
...@@ -71,7 +87,7 @@ ...@@ -71,7 +87,7 @@
if (!base::i18n::IsRTL()) if (!base::i18n::IsRTL())
return; return;
if (!subviewsToBeAdjustedForRTL_) if (!subviewsToBeAdjustedForRTL_)
subviewsToBeAdjustedForRTL_.reset([[NSMutableSet alloc] init]); subviewsToBeAdjustedForRTL_ = [[NSMutableSet alloc] init];
[subviewsToBeAdjustedForRTL_ addObject:subview]; [subviewsToBeAdjustedForRTL_ addObject:subview];
} }
......
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
#import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation PrimaryActionButton @implementation PrimaryActionButton
- (id)initWithFrame:(CGRect)frame { - (id)initWithFrame:(CGRect)frame {
......
...@@ -4,11 +4,13 @@ ...@@ -4,11 +4,13 @@
#include "ios/chrome/browser/ui/fancy_ui/tinted_button.h" #include "ios/chrome/browser/ui/fancy_ui/tinted_button.h"
#import "base/mac/scoped_nsobject.h" #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@interface TintedButton () { @interface TintedButton () {
base::scoped_nsobject<UIColor> normalStateTint_; UIColor* normalStateTint_;
base::scoped_nsobject<UIColor> highlightedTint_; UIColor* highlightedTint_;
} }
// Makes the button's tint color reflect its current state. // Makes the button's tint color reflect its current state.
...@@ -21,10 +23,10 @@ ...@@ -21,10 +23,10 @@
- (void)setTintColor:(UIColor*)color forState:(UIControlState)state { - (void)setTintColor:(UIColor*)color forState:(UIControlState)state {
switch (state) { switch (state) {
case UIControlStateNormal: case UIControlStateNormal:
normalStateTint_.reset([color copy]); normalStateTint_ = [color copy];
break; break;
case UIControlStateHighlighted: case UIControlStateHighlighted:
highlightedTint_.reset([color copy]); highlightedTint_ = [color copy];
break; break;
default: default:
return; return;
...@@ -50,13 +52,13 @@ ...@@ -50,13 +52,13 @@
UIColor* newTint = nil; UIColor* newTint = nil;
switch (self.state) { switch (self.state) {
case UIControlStateNormal: case UIControlStateNormal:
newTint = normalStateTint_.get(); newTint = normalStateTint_;
break; break;
case UIControlStateHighlighted: case UIControlStateHighlighted:
newTint = highlightedTint_.get(); newTint = highlightedTint_;
break; break;
default: default:
newTint = normalStateTint_.get(); newTint = normalStateTint_;
break; break;
} }
self.tintColor = newTint; self.tintColor = newTint;
......
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