Commit 1430a093 authored by stkhapugin's avatar stkhapugin Committed by Commit bot

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

Semi-automatically generated ARCMigrate commit

Notable issues:Had to fix includes and subclasses.
BUG=624363
TEST=None

Review-Url: https://codereview.chromium.org/2574463002
Cr-Commit-Position: refs/heads/master@{#438183}
parent 089ce14f
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# found in the LICENSE file. # found in the LICENSE file.
source_set("infobars") { source_set("infobars") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [ sources = [
"confirm_infobar_controller+protected.h", "confirm_infobar_controller+protected.h",
"confirm_infobar_controller.h", "confirm_infobar_controller.h",
......
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
#include "ui/base/window_open_disposition.h" #include "ui/base/window_open_disposition.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
namespace { namespace {
// UI Tags for the infobar elements. // UI Tags for the infobar elements.
...@@ -53,13 +57,13 @@ ConfirmInfoBarDelegate::InfoBarButton UITagToButton(NSUInteger tag) { ...@@ -53,13 +57,13 @@ ConfirmInfoBarDelegate::InfoBarButton UITagToButton(NSUInteger tag) {
#pragma mark - #pragma mark -
#pragma mark InfoBarController #pragma mark InfoBarController
- (base::scoped_nsobject<UIView<InfoBarViewProtocol>>) - (UIView<InfoBarViewProtocol>*)viewForDelegate:
viewForDelegate:(infobars::InfoBarDelegate*)delegate (infobars::InfoBarDelegate*)delegate
frame:(CGRect)frame { frame:(CGRect)frame {
base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView; UIView<InfoBarViewProtocol>* infoBarView;
_confirmInfobarDelegate = delegate->AsConfirmInfoBarDelegate(); _confirmInfobarDelegate = delegate->AsConfirmInfoBarDelegate();
infoBarView.reset( infoBarView =
ios::GetChromeBrowserProvider()->CreateInfoBarView(frame, self.delegate)); ios::GetChromeBrowserProvider()->CreateInfoBarView(frame, self.delegate);
// Model data. // Model data.
gfx::Image modelIcon = _confirmInfobarDelegate->GetIcon(); gfx::Image modelIcon = _confirmInfobarDelegate->GetIcon();
int buttons = _confirmInfobarDelegate->GetButtons(); int buttons = _confirmInfobarDelegate->GetButtons();
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
#include "ios/chrome/browser/infobars/infobar_controller.h" #include "ios/chrome/browser/infobars/infobar_controller.h"
#include "ios/chrome/browser/translate/translate_infobar_tags.h" #include "ios/chrome/browser/translate/translate_infobar_tags.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
using infobars::InfoBar; using infobars::InfoBar;
using infobars::InfoBarDelegate; using infobars::InfoBarDelegate;
...@@ -26,7 +30,7 @@ InfoBarIOS::~InfoBarIOS() { ...@@ -26,7 +30,7 @@ InfoBarIOS::~InfoBarIOS() {
} }
void InfoBarIOS::SetController(InfoBarController* controller) { void InfoBarIOS::SetController(InfoBarController* controller) {
controller_.reset([controller retain]); controller_.reset(controller);
} }
void InfoBarIOS::Layout(CGRect container_bounds) { void InfoBarIOS::Layout(CGRect container_bounds) {
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
#include "ios/chrome/browser/infobars/infobar_container_view.h" #include "ios/chrome/browser/infobars/infobar_container_view.h"
#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
InfoBarContainerIOS::InfoBarContainerIOS( InfoBarContainerIOS::InfoBarContainerIOS(
infobars::InfoBarContainer::Delegate* delegate) infobars::InfoBarContainer::Delegate* delegate)
: InfoBarContainer(delegate), delegate_(delegate) { : InfoBarContainer(delegate), delegate_(delegate) {
......
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
#include "ios/public/provider/chrome/browser/ui/infobar_view_protocol.h" #include "ios/public/provider/chrome/browser/ui/infobar_view_protocol.h"
#include "ui/base/device_form_factor.h" #include "ui/base/device_form_factor.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation InfoBarContainerView @implementation InfoBarContainerView
- (void)addInfoBar:(InfoBarIOS*)infoBarIOS position:(NSInteger)position { - (void)addInfoBar:(InfoBarIOS*)infoBarIOS position:(NSInteger)position {
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#define IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTROLLER_H_ #define IOS_CHROME_BROWSER_INFOBARS_INFOBAR_CONTROLLER_H_
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#include "base/mac/scoped_nsobject.h"
@protocol InfoBarViewProtocol; @protocol InfoBarViewProtocol;
class InfoBarViewDelegate; class InfoBarViewDelegate;
...@@ -26,9 +25,9 @@ class InfoBarDelegate; ...@@ -26,9 +25,9 @@ class InfoBarDelegate;
// Creates a view and lays out all the infobar elements in it. Will not add // Creates a view and lays out all the infobar elements in it. Will not add
// it as a subview yet. This method must be overriden in subclasses. // it as a subview yet. This method must be overriden in subclasses.
- (base::scoped_nsobject<UIView<InfoBarViewProtocol>>) - (UIView<InfoBarViewProtocol>*)viewForDelegate:
viewForDelegate:(infobars::InfoBarDelegate*)delegate (infobars::InfoBarDelegate*)delegate
frame:(CGRect)bounds; frame:(CGRect)bounds;
// Creates the view. // Creates the view.
- (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate - (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate
......
...@@ -9,8 +9,12 @@ ...@@ -9,8 +9,12 @@
#include "base/logging.h" #include "base/logging.h"
#import "ios/public/provider/chrome/browser/ui/infobar_view_protocol.h" #import "ios/public/provider/chrome/browser/ui/infobar_view_protocol.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@interface InfoBarController () { @interface InfoBarController () {
base::scoped_nsobject<UIView<InfoBarViewProtocol>> _infoBarView; UIView<InfoBarViewProtocol>* _infoBarView;
} }
@end @end
...@@ -33,7 +37,6 @@ ...@@ -33,7 +37,6 @@
- (void)dealloc { - (void)dealloc {
[_infoBarView removeFromSuperview]; [_infoBarView removeFromSuperview];
[super dealloc];
} }
- (int)barHeight { - (int)barHeight {
...@@ -46,9 +49,9 @@ ...@@ -46,9 +49,9 @@
_infoBarView = [self viewForDelegate:delegate frame:bounds]; _infoBarView = [self viewForDelegate:delegate frame:bounds];
} }
- (base::scoped_nsobject<UIView<InfoBarViewProtocol>>) - (UIView<InfoBarViewProtocol>*)viewForDelegate:
viewForDelegate:(infobars::InfoBarDelegate*)delegate (infobars::InfoBarDelegate*)delegate
frame:(CGRect)bounds { frame:(CGRect)bounds {
// Must be overriden in subclasses. // Must be overriden in subclasses.
NOTREACHED(); NOTREACHED();
return _infoBarView; return _infoBarView;
......
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
#include "ios/web/public/web_state/web_state.h" #include "ios/web/public/web_state/web_state.h"
#include "ui/base/page_transition_types.h" #include "ui/base/page_transition_types.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
DEFINE_WEB_STATE_USER_DATA_KEY(InfoBarManagerImpl); DEFINE_WEB_STATE_USER_DATA_KEY(InfoBarManagerImpl);
namespace { namespace {
......
...@@ -7,16 +7,19 @@ ...@@ -7,16 +7,19 @@
#include <memory> #include <memory>
#include <utility> #include <utility>
#include "base/mac/scoped_nsobject.h"
#include "components/infobars/core/confirm_infobar_delegate.h" #include "components/infobars/core/confirm_infobar_delegate.h"
#include "ios/chrome/browser/infobars/confirm_infobar_controller.h" #include "ios/chrome/browser/infobars/confirm_infobar_controller.h"
#include "ios/chrome/browser/infobars/infobar.h" #include "ios/chrome/browser/infobars/infobar.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
std::unique_ptr<infobars::InfoBar> CreateConfirmInfoBar( std::unique_ptr<infobars::InfoBar> CreateConfirmInfoBar(
std::unique_ptr<ConfirmInfoBarDelegate> delegate) { std::unique_ptr<ConfirmInfoBarDelegate> delegate) {
std::unique_ptr<InfoBarIOS> infobar(new InfoBarIOS(std::move(delegate))); std::unique_ptr<InfoBarIOS> infobar(new InfoBarIOS(std::move(delegate)));
base::scoped_nsobject<ConfirmInfoBarController> controller( ConfirmInfoBarController* controller =
[[ConfirmInfoBarController alloc] initWithDelegate:infobar.get()]); [[ConfirmInfoBarController alloc] initWithDelegate:infobar.get()];
infobar->SetController(controller); infobar->SetController(controller);
return std::move(infobar); return std::move(infobar);
} }
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#import "ios/chrome/browser/native_app_launcher/native_app_infobar_controller.h" #import "ios/chrome/browser/native_app_launcher/native_app_infobar_controller.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/native_app_launcher/native_app_infobar_delegate.h" #include "ios/chrome/browser/native_app_launcher/native_app_infobar_delegate.h"
#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_strings.h"
...@@ -33,9 +34,9 @@ ...@@ -33,9 +34,9 @@
#pragma mark - InfoBarController #pragma mark - InfoBarController
- (base::scoped_nsobject<UIView<InfoBarViewProtocol>>) - (UIView<InfoBarViewProtocol>*)viewForDelegate:
viewForDelegate:(infobars::InfoBarDelegate*)delegate (infobars::InfoBarDelegate*)delegate
frame:(CGRect)frame { frame:(CGRect)frame {
base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView; base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView;
nativeAppInfoBarDelegate_ = static_cast<NativeAppInfoBarDelegate*>(delegate); nativeAppInfoBarDelegate_ = static_cast<NativeAppInfoBarDelegate*>(delegate);
DCHECK(nativeAppInfoBarDelegate_); DCHECK(nativeAppInfoBarDelegate_);
...@@ -96,7 +97,7 @@ viewForDelegate:(infobars::InfoBarDelegate*)delegate ...@@ -96,7 +97,7 @@ viewForDelegate:(infobars::InfoBarDelegate*)delegate
break; break;
} }
} }
return infoBarView; return [[infoBarView retain] autorelease];
} }
- (void)infoBarButtonDidPress:(UIButton*)button { - (void)infoBarButtonDidPress:(UIButton*)button {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <memory> #include <memory>
#include <utility> #include <utility>
#include "base/mac/scoped_nsobject.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "components/infobars/core/infobar_manager.h" #include "components/infobars/core/infobar_manager.h"
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <utility> #include <utility>
#include "base/mac/scoped_nsobject.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
......
...@@ -13,7 +13,7 @@ class IOSChromeUpdatePasswordInfoBarDelegate; ...@@ -13,7 +13,7 @@ class IOSChromeUpdatePasswordInfoBarDelegate;
// the user whether they want to update their password. // the user whether they want to update their password.
@interface UpdatePasswordInfoBarController : ConfirmInfoBarController @interface UpdatePasswordInfoBarController : ConfirmInfoBarController
- (base::scoped_nsobject<UIView<InfoBarViewProtocol>>) - (UIView<InfoBarViewProtocol>*)
viewForDelegate:(IOSChromeUpdatePasswordInfoBarDelegate*)delegate viewForDelegate:(IOSChromeUpdatePasswordInfoBarDelegate*)delegate
frame:(CGRect)frame; frame:(CGRect)frame;
......
...@@ -39,7 +39,7 @@ NSUInteger kAccountTag = 10; ...@@ -39,7 +39,7 @@ NSUInteger kAccountTag = 10;
return self; return self;
} }
- (base::scoped_nsobject<UIView<InfoBarViewProtocol>>) - (UIView<InfoBarViewProtocol>*)
viewForDelegate:(IOSChromeUpdatePasswordInfoBarDelegate*)delegate viewForDelegate:(IOSChromeUpdatePasswordInfoBarDelegate*)delegate
frame:(CGRect)frame { frame:(CGRect)frame {
_delegate = delegate; _delegate = delegate;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "ios/chrome/browser/translate/after_translate_infobar_controller.h" #include "ios/chrome/browser/translate/after_translate_infobar_controller.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
...@@ -29,9 +30,9 @@ ...@@ -29,9 +30,9 @@
#pragma mark - #pragma mark -
#pragma mark InfoBarControllerProtocol #pragma mark InfoBarControllerProtocol
- (base::scoped_nsobject<UIView<InfoBarViewProtocol>>) - (UIView<InfoBarViewProtocol>*)viewForDelegate:
viewForDelegate:(infobars::InfoBarDelegate*)delegate (infobars::InfoBarDelegate*)delegate
frame:(CGRect)frame { frame:(CGRect)frame {
base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView; base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView;
_translateInfoBarDelegate = delegate->AsTranslateInfoBarDelegate(); _translateInfoBarDelegate = delegate->AsTranslateInfoBarDelegate();
DCHECK(_translateInfoBarDelegate); DCHECK(_translateInfoBarDelegate);
...@@ -89,7 +90,7 @@ ...@@ -89,7 +90,7 @@
target:self target:self
action:@selector(infoBarSwitchDidPress:)]; action:@selector(infoBarSwitchDidPress:)];
} }
return infoBarView; return [[infoBarView retain] autorelease];
} }
#pragma mark - Handling of User Events #pragma mark - Handling of User Events
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#import <UIKit/UIKit.h> #import <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 "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
...@@ -127,9 +128,9 @@ NSTimeInterval kPickerAnimationDurationInSeconds = 0.2; ...@@ -127,9 +128,9 @@ NSTimeInterval kPickerAnimationDurationInSeconds = 0.2;
#pragma mark - #pragma mark -
#pragma mark InfoBarControllerProtocol #pragma mark InfoBarControllerProtocol
- (base::scoped_nsobject<UIView<InfoBarViewProtocol>>) - (UIView<InfoBarViewProtocol>*)viewForDelegate:
viewForDelegate:(infobars::InfoBarDelegate*)delegate (infobars::InfoBarDelegate*)delegate
frame:(CGRect)frame { frame:(CGRect)frame {
base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView; base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView;
_translateInfoBarDelegate = delegate->AsTranslateInfoBarDelegate(); _translateInfoBarDelegate = delegate->AsTranslateInfoBarDelegate();
infoBarView.reset( infoBarView.reset(
...@@ -155,7 +156,7 @@ NSTimeInterval kPickerAnimationDurationInSeconds = 0.2; ...@@ -155,7 +156,7 @@ NSTimeInterval kPickerAnimationDurationInSeconds = 0.2;
tag2:TranslateInfoBarIOSTag::BEFORE_DENY tag2:TranslateInfoBarIOSTag::BEFORE_DENY
target:self target:self
action:@selector(infoBarButtonDidPress:)]; action:@selector(infoBarButtonDidPress:)];
return infoBarView; return [[infoBarView retain] autorelease];
} }
- (void)updateInfobarLabelOnView:(UIView<InfoBarViewProtocol>*)view { - (void)updateInfobarLabelOnView:(UIView<InfoBarViewProtocol>*)view {
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "ios/chrome/browser/translate/never_translate_infobar_controller.h" #include "ios/chrome/browser/translate/never_translate_infobar_controller.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
...@@ -28,9 +29,9 @@ ...@@ -28,9 +29,9 @@
#pragma mark - #pragma mark -
#pragma mark InfoBarControllerProtocol #pragma mark InfoBarControllerProtocol
- (base::scoped_nsobject<UIView<InfoBarViewProtocol>>) - (UIView<InfoBarViewProtocol>*)viewForDelegate:
viewForDelegate:(infobars::InfoBarDelegate*)delegate (infobars::InfoBarDelegate*)delegate
frame:(CGRect)frame { frame:(CGRect)frame {
base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView; base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView;
translate::TranslateInfoBarDelegate* translateInfoBarDelegate = translate::TranslateInfoBarDelegate* translateInfoBarDelegate =
delegate->AsTranslateInfoBarDelegate(); delegate->AsTranslateInfoBarDelegate();
...@@ -61,7 +62,7 @@ ...@@ -61,7 +62,7 @@
tag2:TranslateInfoBarIOSTag::DENY_WEBSITE tag2:TranslateInfoBarIOSTag::DENY_WEBSITE
target:self target:self
action:@selector(infoBarButtonDidPress:)]; action:@selector(infoBarButtonDidPress:)];
return infoBarView; return [[infoBarView retain] autorelease];
} }
#pragma mark - Handling of User Events #pragma mark - Handling of User Events
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "ios/chrome/browser/translate/translate_message_infobar_controller.h" #include "ios/chrome/browser/translate/translate_message_infobar_controller.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "components/translate/core/browser/translate_infobar_delegate.h" #include "components/translate/core/browser/translate_infobar_delegate.h"
#include "ios/chrome/browser/translate/translate_infobar_tags.h" #include "ios/chrome/browser/translate/translate_infobar_tags.h"
...@@ -21,9 +22,9 @@ ...@@ -21,9 +22,9 @@
@implementation TranslateMessageInfoBarController @implementation TranslateMessageInfoBarController
- (base::scoped_nsobject<UIView<InfoBarViewProtocol>>) - (UIView<InfoBarViewProtocol>*)viewForDelegate:
viewForDelegate:(infobars::InfoBarDelegate*)delegate (infobars::InfoBarDelegate*)delegate
frame:(CGRect)frame { frame:(CGRect)frame {
base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView; base::scoped_nsobject<UIView<InfoBarViewProtocol>> infoBarView;
translate::TranslateInfoBarDelegate* translateInfoBarDelegate = translate::TranslateInfoBarDelegate* translateInfoBarDelegate =
delegate->AsTranslateInfoBarDelegate(); delegate->AsTranslateInfoBarDelegate();
...@@ -49,7 +50,7 @@ ...@@ -49,7 +50,7 @@
target:self target:self
action:@selector(infoBarButtonDidPress:)]; action:@selector(infoBarButtonDidPress:)];
} }
return infoBarView; return [[infoBarView retain] autorelease];
} }
#pragma mark - Handling of User Events #pragma mark - Handling of User Events
......
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