| OLD | NEW |
| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 message:@"" | 196 message:@"" |
| 197 preferredStyle:UIAlertControllerStyleActionSheet]; | 197 preferredStyle:UIAlertControllerStyleActionSheet]; |
| 198 | 198 |
| 199 [alertController | 199 [alertController |
| 200 addAction:[UIAlertAction actionWithTitle:@"Reload" | 200 addAction:[UIAlertAction actionWithTitle:@"Reload" |
| 201 style:UIAlertActionStyleDefault | 201 style:UIAlertActionStyleDefault |
| 202 handler:^(UIAlertAction* action) { | 202 handler:^(UIAlertAction* action) { |
| 203 [_webView reload]; | 203 [_webView reload]; |
| 204 }]]; | 204 }]]; |
| 205 | 205 |
| 206 // Removes the web view from the view hierarchy and deallocates it. For |
| 207 // testing deallocation behavior, because there have been multiple crash bugs |
| 208 // on deallocation of CWVWebView. |
| 209 [alertController |
| 210 addAction:[UIAlertAction actionWithTitle:@"Deallocate web view" |
| 211 style:UIAlertActionStyleDefault |
| 212 handler:^(UIAlertAction* action) { |
| 213 [_webView removeFromSuperview]; |
| 214 _webView = nil; |
| 215 }]]; |
| 216 |
| 206 [self presentViewController:alertController animated:YES completion:nil]; | 217 [self presentViewController:alertController animated:YES completion:nil]; |
| 207 } | 218 } |
| 208 | 219 |
| 209 - (BOOL)textFieldShouldReturn:(UITextField*)field { | 220 - (BOOL)textFieldShouldReturn:(UITextField*)field { |
| 210 NSURLRequest* request = | 221 NSURLRequest* request = |
| 211 [NSURLRequest requestWithURL:[NSURL URLWithString:[field text]]]; | 222 [NSURLRequest requestWithURL:[NSURL URLWithString:[field text]]]; |
| 212 [_webView loadRequest:request]; | 223 [_webView loadRequest:request]; |
| 213 [field resignFirstResponder]; | 224 [field resignFirstResponder]; |
| 214 [self updateToolbar]; | 225 [self updateToolbar]; |
| 215 return YES; | 226 return YES; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 // TODO(crbug.com/679895): Add some visual indication that the page load has | 389 // TODO(crbug.com/679895): Add some visual indication that the page load has |
| 379 // finished. | 390 // finished. |
| 380 [self updateToolbar]; | 391 [self updateToolbar]; |
| 381 } | 392 } |
| 382 | 393 |
| 383 - (void)webViewWebContentProcessDidTerminate:(CWVWebView*)webView { | 394 - (void)webViewWebContentProcessDidTerminate:(CWVWebView*)webView { |
| 384 NSLog(@"webViewWebContentProcessDidTerminate"); | 395 NSLog(@"webViewWebContentProcessDidTerminate"); |
| 385 } | 396 } |
| 386 | 397 |
| 387 @end | 398 @end |
| OLD | NEW |