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

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

Issue 2839093002: Implemented new Translate API for purely Objective-C clients. (Closed)
Patch Set: merge Created 3 years, 7 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/translate_controller.h ('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.m
diff --git a/ios/web_view/shell/translate_controller.m b/ios/web_view/shell/translate_controller.m
deleted file mode 100644
index e28d0089282d7c3dfb9a593a323ecc0a0a81c229..0000000000000000000000000000000000000000
--- a/ios/web_view/shell/translate_controller.m
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "ios/web_view/shell/translate_controller.h"
-
-#import <ChromeWebView/ChromeWebView.h>
-#import <UIKit/UIKit.h>
-
-#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<CWVTranslateManager> translateManager;
-@end
-
-@implementation TranslateController
-
-@synthesize beforeTranslateActionSheet = _beforeTranslateActionSheet;
-@synthesize translateManager = _translateManager;
-
-- (void)dealloc {
- [_beforeTranslateActionSheet dismissViewControllerAnimated:YES
- completion:nil];
-}
-
-#pragma mark CWVTranslateDelegate methods
-
-- (void)translateStepChanged:(CRIWVTransateStep)step
- manager:(id<CWVTranslateManager>)manager {
- if (step == CRIWVTransateStepBeforeTranslate) {
- self.translateManager = manager;
- self.beforeTranslateActionSheet = [UIAlertController
- alertControllerWithTitle:nil
- message:@"Translate?"
- preferredStyle:UIAlertControllerStyleActionSheet];
- UIAlertAction* cancelAction =
- [UIAlertAction actionWithTitle:@"Nope."
- style:UIAlertActionStyleCancel
- handler:^(UIAlertAction* action) {
- self.beforeTranslateActionSheet = nil;
- self.translateManager = nil;
- }];
- [_beforeTranslateActionSheet addAction:cancelAction];
-
- UIAlertAction* translateAction =
- [UIAlertAction actionWithTitle:@"Yes!"
- style:UIAlertActionStyleDefault
- handler:^(UIAlertAction* action) {
- self.beforeTranslateActionSheet = nil;
- [_translateManager translate];
- self.translateManager = nil;
- }];
- [_beforeTranslateActionSheet addAction:translateAction];
-
- [[UIApplication sharedApplication].keyWindow.rootViewController
- presentViewController:_beforeTranslateActionSheet
- animated:YES
- completion:nil];
- }
-}
-
-@end
« no previous file with comments | « ios/web_view/shell/translate_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698