Chromium Code Reviews| Index: ios/chrome/browser/translate/before_translate_infobar_controller.mm |
| diff --git a/ios/chrome/browser/translate/before_translate_infobar_controller.mm b/ios/chrome/browser/translate/before_translate_infobar_controller.mm |
| index 462ef17ab43d714057479988d2f310030333c780..a02af6846b36321a77954c9f8665add527152239 100644 |
| --- a/ios/chrome/browser/translate/before_translate_infobar_controller.mm |
| +++ b/ios/chrome/browser/translate/before_translate_infobar_controller.mm |
| @@ -7,6 +7,7 @@ |
| #include <stddef.h> |
| #import <UIKit/UIKit.h> |
| +#include "base/ios/weak_nsobject.h" |
| #include "base/logging.h" |
| #include "base/mac/scoped_nsobject.h" |
| #include "base/strings/sys_string_conversions.h" |
| @@ -172,9 +173,13 @@ - (void)updateInfobarLabelOnView:(InfoBarView*)view { |
| NSString* label = |
| l10n_util::GetNSStringF(IDS_TRANSLATE_INFOBAR_BEFORE_MESSAGE_IOS, |
| originalLanguageWithLink, targetLanguageWithLink); |
| + |
| + base::WeakNSObject<BeforeTranslateInfoBarController> weakSelf(self); |
| [view addLabel:label |
| action:^(NSUInteger tag) { |
| - [self infobarLinkDidPress:tag]; |
| + base::scoped_nsobject<BeforeTranslateInfoBarController> strongSelf( |
| + [weakSelf retain]); |
| + [strongSelf infobarLinkDidPress:tag]; |
|
sdefresne
2017/06/12 14:14:24
ditto
|
| }]; |
| } |