| 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 #ifndef IOS_WEB_VIEW_PUBLIC_CRIWV_WEB_VIEW_H_ | 4 #ifndef IOS_WEB_VIEW_PUBLIC_CRIWV_WEB_VIEW_H_ |
| 5 #define IOS_WEB_VIEW_PUBLIC_CRIWV_WEB_VIEW_H_ | 5 #define IOS_WEB_VIEW_PUBLIC_CRIWV_WEB_VIEW_H_ |
| 6 | 6 |
| 7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 | 8 |
| 9 @protocol CRIWVWebViewDelegate; | 9 @protocol CRIWVWebViewDelegate; |
| 10 | 10 |
| 11 // Primary objective-c interface for web/. Just like a WKWebView, but better. | 11 // A web view component (like WKWebView) which uses iOS Chromium's web view |
| 12 // implementation. |
| 13 // |
| 14 // In addition to WKWebView features, it allows Translate, Find In Page, |
| 15 // Customizable Context Menus, and maybe more. |
| 16 // |
| 12 // Concrete instances can be created through CRIWV. | 17 // Concrete instances can be created through CRIWV. |
| 13 @protocol CRIWVWebView<NSObject> | 18 @interface CRIWVWebView : UIView |
| 14 | 19 |
| 15 // The view used to display web content. | 20 // The view used to display web content. |
| 16 @property(nonatomic, readonly) UIView* view; | 21 @property(nonatomic, readonly) UIView* view; |
| 17 | 22 |
| 18 // This web view's delegate. | 23 // This web view's delegate. |
| 19 @property(nonatomic, readwrite, assign) id<CRIWVWebViewDelegate> delegate; | 24 @property(nonatomic, readwrite, assign) id<CRIWVWebViewDelegate> delegate; |
| 20 | 25 |
| 21 // Whether or not this web view can go backwards or forwards. | 26 // Whether or not this web view can go backwards or forwards. |
| 22 @property(nonatomic, readonly) BOOL canGoBack; | 27 @property(nonatomic, readonly) BOOL canGoBack; |
| 23 @property(nonatomic, readonly) BOOL canGoForward; | 28 @property(nonatomic, readonly) BOOL canGoForward; |
| 24 | 29 |
| 25 // Whether or not this web view is loading a page. | 30 // Whether or not this web view is loading a page. |
| 26 @property(nonatomic, readonly) BOOL isLoading; | 31 @property(nonatomic, readonly) BOOL isLoading; |
| 27 | 32 |
| 28 // The current URL, for display to the user. | 33 // The current URL, for display to the user. |
| 29 @property(nonatomic, readonly) NSURL* visibleURL; | 34 @property(nonatomic, readonly) NSURL* visibleURL; |
| 30 | 35 |
| 31 // The current page title. | 36 // The current page title. |
| 32 @property(nonatomic, readonly) NSString* pageTitle; | 37 @property(nonatomic, readonly) NSString* pageTitle; |
| 33 | 38 |
| 34 // The current load progress, as a fraction between 0 and 1. This value is | 39 // The current load progress, as a fraction between 0 and 1. This value is |
| 35 // undefined if the web view is not currently loading. | 40 // undefined if the web view is not currently loading. |
| 36 @property(nonatomic, readonly) CGFloat loadProgress; | 41 @property(nonatomic, readonly) CGFloat loadProgress; |
| 37 | 42 |
| 43 - (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; |
| 44 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; |
| 45 |
| 38 // Navigates backwards or forwards by one page. Does nothing if the | 46 // Navigates backwards or forwards by one page. Does nothing if the |
| 39 // corresponding |canGoBack| or |canGoForward| method returns NO. | 47 // corresponding |canGoBack| or |canGoForward| method returns NO. |
| 40 - (void)goBack; | 48 - (void)goBack; |
| 41 - (void)goForward; | 49 - (void)goForward; |
| 42 | 50 |
| 43 // Reloads the current page. | 51 // Reloads the current page. |
| 44 - (void)reload; | 52 - (void)reload; |
| 45 | 53 |
| 46 // Stops loading the current page. | 54 // Stops loading the current page. |
| 47 - (void)stopLoading; | 55 - (void)stopLoading; |
| 48 | 56 |
| 49 // Loads the given |url| in this web view. | 57 // Loads the given |url| in this web view. |
| 50 - (void)loadURL:(NSURL*)url; | 58 - (void)loadURL:(NSURL*)url; |
| 51 | 59 |
| 52 // Evaluates a JavaScript string. | 60 // Evaluates a JavaScript string. |
| 53 // The completion handler is invoked when script evaluation completes. | 61 // The completion handler is invoked when script evaluation completes. |
| 54 - (void)evaluateJavaScript:(NSString*)javaScriptString | 62 - (void)evaluateJavaScript:(NSString*)javaScriptString |
| 55 completionHandler:(void (^)(id, NSError*))completionHandler; | 63 completionHandler:(void (^)(id, NSError*))completionHandler; |
| 56 | 64 |
| 57 @end | 65 @end |
| 58 | 66 |
| 59 #endif // IOS_WEB_VIEW_PUBLIC_CRIWV_WEB_VIEW_H_ | 67 #endif // IOS_WEB_VIEW_PUBLIC_CRIWV_WEB_VIEW_H_ |
| OLD | NEW |