Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: ios/chrome/browser/translate/after_translate_infobar_controller.mm

Issue 2952403002: [ObjC ARC] Converts ios/chrome/browser/translate:translate to ARC. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/translate/after_translate_infobar_controller.mm
diff --git a/ios/chrome/browser/translate/after_translate_infobar_controller.mm b/ios/chrome/browser/translate/after_translate_infobar_controller.mm
index e4d57c1c13d5339850d7abdcef9882de1f6349da..a14bb2a1828281b96f052125aa554366639384c3 100644
--- a/ios/chrome/browser/translate/after_translate_infobar_controller.mm
+++ b/ios/chrome/browser/translate/after_translate_infobar_controller.mm
@@ -4,7 +4,6 @@
#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/utf_string_conversions.h"
#include "components/strings/grit/components_strings.h"
@@ -15,6 +14,10 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/image/image.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
namespace {
enum AlwaysTranslateSwitchState {
ALWAYS_TRANSLATE_SWITCH_NOT_CHANGED,
@@ -40,11 +43,11 @@ enum AlwaysTranslateSwitchState {
- (InfoBarView*)viewForDelegate:(infobars::InfoBarDelegate*)delegate
frame:(CGRect)frame {
- base::scoped_nsobject<InfoBarView> infoBarView;
+ InfoBarView* infoBarView;
_translateInfoBarDelegate = delegate->AsTranslateInfoBarDelegate();
DCHECK(_translateInfoBarDelegate);
- infoBarView.reset(
- [[InfoBarView alloc] initWithFrame:frame delegate:self.delegate]);
+ infoBarView =
+ [[InfoBarView alloc] initWithFrame:frame delegate:self.delegate];
// Icon
gfx::Image icon = _translateInfoBarDelegate->GetIcon();
if (!icon.IsEmpty())
@@ -68,9 +71,9 @@ enum AlwaysTranslateSwitchState {
NSString* original = base::SysUTF16ToNSString(stdOriginal);
NSString* target = base::SysUTF16ToNSString(
_translateInfoBarDelegate->target_language_name());
- base::scoped_nsobject<NSString> label(
+ NSString* label =
[[NSString alloc] initWithFormat:@"%@ %@ %@%@ %@.", label1, original,
- label2, label3, target]);
+ label2, label3, target];
[infoBarView addLabel:label];
// Close button.
[infoBarView addCloseButtonWithTag:TranslateInfoBarIOSTag::CLOSE
@@ -98,7 +101,7 @@ enum AlwaysTranslateSwitchState {
target:self
action:@selector(infoBarSwitchDidPress:)];
}
- return [[infoBarView retain] autorelease];
+ return infoBarView;
}
#pragma mark - Handling of User Events
« no previous file with comments | « ios/chrome/browser/translate/BUILD.gn ('k') | ios/chrome/browser/translate/before_translate_infobar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698