Chromium Code Reviews| 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/web_state/ui/crw_ui_simple_web_view_controller.h" | 5 #import "ios/web/web_state/ui/crw_ui_simple_web_view_controller.h" |
| 6 | 6 |
| 7 #include "base/ios/weak_nsobject.h" | 7 #include "base/ios/weak_nsobject.h" |
| 8 #import "base/logging.h" | 8 #import "base/logging.h" |
| 9 #import "base/mac/scoped_nsobject.h" | 9 #import "base/mac/scoped_nsobject.h" |
| 10 | 10 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 - (id<CRWSimpleWebViewControllerDelegate>)delegate { | 65 - (id<CRWSimpleWebViewControllerDelegate>)delegate { |
| 66 return _delegate.get(); | 66 return _delegate.get(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 - (void)loadPDFAtFilePath:(NSString*)filePath { | 69 - (void)loadPDFAtFilePath:(NSString*)filePath { |
| 70 DCHECK([[NSFileManager defaultManager] fileExistsAtPath:filePath]); | 70 DCHECK([[NSFileManager defaultManager] fileExistsAtPath:filePath]); |
| 71 NSData* data = [NSData dataWithContentsOfFile:filePath]; | 71 NSData* data = [NSData dataWithContentsOfFile:filePath]; |
| 72 [_webView loadData:data | 72 [_webView loadData:data |
| 73 MIMEType:@"application/pdf" | 73 MIMEType:@"application/pdf" |
| 74 textEncodingName:@"utf-8" | 74 textEncodingName:@"utf-8" |
| 75 baseURL:nil]; | 75 baseURL:[[NSURL alloc] initWithString:@""]]; |
|
shreyasv1
2015/06/10 15:14:34
This is a memory leak? autorelease or wrap in a sc
justincohen
2015/06/10 15:21:11
Done
| |
| 76 } | 76 } |
| 77 | 77 |
| 78 - (void)evaluateJavaScript:(NSString*)script | 78 - (void)evaluateJavaScript:(NSString*)script |
| 79 stringResultHandler:(web::JavaScriptCompletion)handler { | 79 stringResultHandler:(web::JavaScriptCompletion)handler { |
| 80 web::EvaluateJavaScript(_webView, script, handler); | 80 web::EvaluateJavaScript(_webView, script, handler); |
| 81 } | 81 } |
| 82 | 82 |
| 83 #pragma mark - | 83 #pragma mark - |
| 84 #pragma mark UIWebViewDelegateMethods | 84 #pragma mark UIWebViewDelegateMethods |
| 85 | 85 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 97 | 97 |
| 98 - (void)webViewDidFinishLoad:(UIWebView*)webView { | 98 - (void)webViewDidFinishLoad:(UIWebView*)webView { |
| 99 if (![_delegate respondsToSelector:@selector(simpleWebViewController: | 99 if (![_delegate respondsToSelector:@selector(simpleWebViewController: |
| 100 titleMayHaveChanged:)]) { | 100 titleMayHaveChanged:)]) { |
| 101 return; | 101 return; |
| 102 } | 102 } |
| 103 [_delegate simpleWebViewController:self titleMayHaveChanged:self.title]; | 103 [_delegate simpleWebViewController:self titleMayHaveChanged:self.title]; |
| 104 } | 104 } |
| 105 | 105 |
| 106 @end | 106 @end |
| OLD | NEW |