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

Side by Side Diff: ios/web_view/shell/shell_view_controller.m

Issue 2839093002: Implemented new Translate API for purely Objective-C clients. (Closed)
Patch Set: Added some error handling. Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/web_view/shell/shell_view_controller.h" 5 #import "ios/web_view/shell/shell_view_controller.h"
6 6
7 #import <ChromeWebView/ChromeWebView.h> 7 #import <ChromeWebView/ChromeWebView.h>
8 #import <MobileCoreServices/MobileCoreServices.h> 8 #import <MobileCoreServices/MobileCoreServices.h>
9 9
10 #import "ios/web_view/shell/translate_controller.h" 10 #import "ios/web_view/shell/translate_controller.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 [CWVWebView setUserAgentProduct:@"Dummy/1.0"]; 148 [CWVWebView setUserAgentProduct:@"Dummy/1.0"];
149 149
150 CWVWebViewConfiguration* configuration = 150 CWVWebViewConfiguration* configuration =
151 [CWVWebViewConfiguration defaultConfiguration]; 151 [CWVWebViewConfiguration defaultConfiguration];
152 self.webView = [[CWVWebView alloc] initWithFrame:[_containerView bounds] 152 self.webView = [[CWVWebView alloc] initWithFrame:[_containerView bounds]
153 configuration:configuration]; 153 configuration:configuration];
154 // Gives a restoration identifier so that state restoration works. 154 // Gives a restoration identifier so that state restoration works.
155 _webView.restorationIdentifier = @"webView"; 155 _webView.restorationIdentifier = @"webView";
156 _webView.navigationDelegate = self; 156 _webView.navigationDelegate = self;
157 _webView.UIDelegate = self; 157 _webView.UIDelegate = self;
158 _translateController = [[TranslateController alloc] init]; 158 _translateController = [[TranslateController alloc] init];
Hiroshi Ichikawa 2017/04/26 08:40:57 Can you maybe rename this class and the variable n
jzw1 2017/04/27 04:54:02 Done.
159 _webView.translationDelegate = _translateController; 159 _webView.translationController.delegate = _translateController;
160 160
161 [_webView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | 161 [_webView setAutoresizingMask:UIViewAutoresizingFlexibleWidth |
162 UIViewAutoresizingFlexibleHeight]; 162 UIViewAutoresizingFlexibleHeight];
163 [_containerView addSubview:_webView]; 163 [_containerView addSubview:_webView];
164 164
165 NSURLRequest* request = [NSURLRequest 165 NSURLRequest* request = [NSURLRequest
166 requestWithURL:[NSURL URLWithString:@"https://www.google.com/"]]; 166 requestWithURL:[NSURL URLWithString:@"https://www.google.com/"]];
167 [_webView loadRequest:request]; 167 [_webView loadRequest:request];
168 } 168 }
169 169
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // TODO(crbug.com/679895): Add some visual indication that the page load has 378 // TODO(crbug.com/679895): Add some visual indication that the page load has
379 // finished. 379 // finished.
380 [self updateToolbar]; 380 [self updateToolbar];
381 } 381 }
382 382
383 - (void)webViewWebContentProcessDidTerminate:(CWVWebView*)webView { 383 - (void)webViewWebContentProcessDidTerminate:(CWVWebView*)webView {
384 NSLog(@"webViewWebContentProcessDidTerminate"); 384 NSLog(@"webViewWebContentProcessDidTerminate");
385 } 385 }
386 386
387 @end 387 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698