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 @@
# found in the LICENSE file.
source_set("fancy_ui") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"bidi_container_view.h",
"bidi_container_view.mm",
......
......@@ -6,26 +6,11 @@
#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
// language. If the current language is RTL then during the first call to
// |layoutSubviews|, this view will flip horizontally all its subviews around
// its center axis and adjust the autoresizing masks.
@interface BidiContainerView : UIView {
@private
ios::rtl::AdjustSubviewsForRTLType adjustSubviewsType_;
base::scoped_nsobject<NSMutableSet> subviewsToBeAdjustedForRTL_;
}
@interface BidiContainerView : UIView
// 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
......
......@@ -7,7 +7,23 @@
#include "base/i18n/rtl.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
// layout is bind to oposite sites than LRT one.
+ (UIViewAutoresizing)mirrorAutoresizingMask:
......@@ -71,7 +87,7 @@
if (!base::i18n::IsRTL())
return;
if (!subviewsToBeAdjustedForRTL_)
subviewsToBeAdjustedForRTL_.reset([[NSMutableSet alloc] init]);
subviewsToBeAdjustedForRTL_ = [[NSMutableSet alloc] init];
[subviewsToBeAdjustedForRTL_ addObject:subview];
}
......
......@@ -6,6 +6,10 @@
#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
- (id)initWithFrame:(CGRect)frame {
......
......@@ -4,11 +4,13 @@
#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 () {
base::scoped_nsobject<UIColor> normalStateTint_;
base::scoped_nsobject<UIColor> highlightedTint_;
UIColor* normalStateTint_;
UIColor* highlightedTint_;
}
// Makes the button's tint color reflect its current state.
......@@ -21,10 +23,10 @@
- (void)setTintColor:(UIColor*)color forState:(UIControlState)state {
switch (state) {
case UIControlStateNormal:
normalStateTint_.reset([color copy]);
normalStateTint_ = [color copy];
break;
case UIControlStateHighlighted:
highlightedTint_.reset([color copy]);
highlightedTint_ = [color copy];
break;
default:
return;
......@@ -50,13 +52,13 @@
UIColor* newTint = nil;
switch (self.state) {
case UIControlStateNormal:
newTint = normalStateTint_.get();
newTint = normalStateTint_;
break;
case UIControlStateHighlighted:
newTint = highlightedTint_.get();
newTint = highlightedTint_;
break;
default:
newTint = normalStateTint_.get();
newTint = normalStateTint_;
break;
}
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