Add ICU message format support
[chromium-blink-merge.git] / ios / web / web_state / ui / crw_simple_web_view_controller.h
blob3f9e336233cf4def7e0ec8083c66df59e8188cda
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
3 // found in the LICENSE file.
5 #ifndef IOS_WEB_WEB_STATE_UI_CRW_SIMPLE_WEB_VIEW_CONTROLLER_H_
6 #define IOS_WEB_WEB_STATE_UI_CRW_SIMPLE_WEB_VIEW_CONTROLLER_H_
8 #import <UIKit/UIKit.h>
10 #import "ios/web/web_state/ui/web_view_js_utils.h"
12 @protocol CRWSimpleWebViewControllerDelegate;
14 #pragma mark -
15 #pragma mark Web View Protocol
16 // An abstraction for interacting with a web view without having to know if it's
17 // a UIWebView or a WKWebView internally.
18 @protocol CRWSimpleWebViewController<NSObject>
20 // The page title, meant for display to the user. Will return nil if not
21 // available.
22 @property(nonatomic, readonly) NSString* title;
24 // The web view associated with this controller.
25 @property(nonatomic, readonly) UIView* view;
27 // The web view's scroll view.
28 @property(nonatomic, readonly) UIScrollView* scrollView;
30 // The delegate that recieves page lifecycle callbacks
31 @property(nonatomic, weak) id<CRWSimpleWebViewControllerDelegate> delegate;
33 // Reloads any displayed data to ensure the view is up to date.
34 - (void)reload;
36 // Loads a request in the WebView.
37 - (void)loadRequest:(NSURLRequest*)request;
39 // Loads an HTML document in the web view. |baseURL| is a URL that is used to
40 // resolve relative URLs within the document.
41 - (void)loadHTMLString:(NSString*)html baseURL:(NSURL*)baseURL;
43 // Loads a PDF file from the application sandbox. A file must exist at
44 // |filePath|.
45 - (void)loadPDFAtFilePath:(NSString*)filePath;
47 // Evaluates the supplied JavaScript in the web view. Calls |completionHandler|
48 // with results of the evaluation. The |completionHandler| can be nil.
49 - (void)evaluateJavaScript:(NSString*)script
50 stringResultHandler:(web::JavaScriptCompletion)handler;
52 @end
54 #pragma mark -
55 #pragma mark Delegate Protocol
56 // CRWSimpleWebViewController delegate protocol for subscribing to page
57 // lifecycle events.
58 @protocol CRWSimpleWebViewControllerDelegate<NSObject>
60 @optional
61 // Called to decide if the CRWSimpleWebViewController should load a request.
62 - (BOOL)simpleWebViewController:
63 (id<CRWSimpleWebViewController>)simpleWebViewController
64 shouldStartLoadWithRequest:(NSURLRequest*)request;
66 // Called when the title changes. Can be called with nil value for |title|.
67 // Note: This call is not accurate all the time for the UIWebView case. The
68 // delegate method is not guaranteed to be called even if the title has changed.
69 // Clients should structure their code around it.
70 - (void)simpleWebViewController:
71 (id<CRWSimpleWebViewController>)simpleWebViewController
72 titleMayHaveChanged:(NSString*)title;
74 @end
76 #endif // IOS_WEB_WEB_STATE_UI_CRW_SIMPLE_WEB_VIEW_CONTROLLER_H_