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

Unified Diff: ios/web_view/shell/translate_controller.mm

Issue 2665653003: Convert ios/web_view to ARC. (Closed)
Patch Set: Respond to comments. Created 3 years, 11 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
« no previous file with comments | « ios/web_view/shell/shell_view_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web_view/shell/translate_controller.mm
diff --git a/ios/web_view/shell/translate_controller.mm b/ios/web_view/shell/translate_controller.mm
index 23ec4c93a658e7b9eca586f81cd794f0a0771e3b..98bc51bce606b0d846414ace6b139504f2d090ca 100644
--- a/ios/web_view/shell/translate_controller.mm
+++ b/ios/web_view/shell/translate_controller.mm
@@ -7,21 +7,27 @@
#import <UIKit/UIKit.h>
#include "base/logging.h"
-#import "base/mac/scoped_nsobject.h"
#import "ios/web_view/public/criwv_translate_manager.h"
-@interface TranslateController () {
- base::scoped_nsobject<UIAlertController> _beforeTranslateActionSheet;
- base::scoped_nsprotocol<id<CRIWVTranslateManager>> _translateManager;
-}
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+@interface TranslateController ()
+// Action Sheet to prompt user whether or not the page should be translated.
+@property (nonatomic, strong) UIAlertController* beforeTranslateActionSheet;
+// Manager which performs the translation of the content.
+@property (nonatomic, strong) id<CRIWVTranslateManager> translateManager;
@end
@implementation TranslateController
+@synthesize beforeTranslateActionSheet = _beforeTranslateActionSheet;
+@synthesize translateManager = _translateManager;
+
- (void)dealloc {
[_beforeTranslateActionSheet dismissViewControllerAnimated:YES
completion:nil];
- [super dealloc];
}
#pragma mark CRIWVTranslateDelegate methods
@@ -31,19 +37,19 @@
if (step == CRIWVTransateStepBeforeTranslate) {
DCHECK(!_translateManager);
DCHECK(!_beforeTranslateActionSheet);
- _translateManager.reset([manager retain]);
- _beforeTranslateActionSheet.reset([[UIAlertController
+ self.translateManager = manager;
+ self.beforeTranslateActionSheet = [UIAlertController
alertControllerWithTitle:nil
message:@"Translate?"
- preferredStyle:UIAlertControllerStyleActionSheet] retain]);
+ preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction* cancelAction =
[UIAlertAction actionWithTitle:@"Nope."
style:UIAlertActionStyleCancel
handler:^(UIAlertAction* action) {
DCHECK(_beforeTranslateActionSheet);
- _beforeTranslateActionSheet.reset();
+ self.beforeTranslateActionSheet = nil;
DCHECK(_translateManager);
- _translateManager.reset();
+ self.translateManager = nil;
}];
[_beforeTranslateActionSheet addAction:cancelAction];
@@ -52,10 +58,10 @@
style:UIAlertActionStyleDefault
handler:^(UIAlertAction* action) {
DCHECK(_beforeTranslateActionSheet);
- _beforeTranslateActionSheet.reset();
+ self.beforeTranslateActionSheet = nil;
DCHECK(_translateManager);
[_translateManager translate];
- _translateManager.reset();
+ self.translateManager = nil;
}];
[_beforeTranslateActionSheet addAction:translateAction];
« no previous file with comments | « ios/web_view/shell/shell_view_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698