]>
Commit | Line | Data |
---|---|---|
819a0ab1 JF |
1 | /* Cydia - iPhone UIKit Front-End for Debian APT |
2 | * Copyright (C) 2008-2011 Jay Freeman (saurik) | |
3 | */ | |
4 | ||
5 | /* Modified BSD License {{{ */ | |
6 | /* | |
7 | * Redistribution and use in source and binary | |
8 | * forms, with or without modification, are permitted | |
9 | * provided that the following conditions are met: | |
10 | * | |
11 | * 1. Redistributions of source code must retain the | |
12 | * above copyright notice, this list of conditions | |
13 | * and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the | |
15 | * above copyright notice, this list of conditions | |
16 | * and the following disclaimer in the documentation | |
17 | * and/or other materials provided with the | |
18 | * distribution. | |
19 | * 3. The name of the author may not be used to endorse | |
20 | * or promote products derived from this software | |
21 | * without specific prior written permission. | |
22 | * | |
23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' | |
24 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | |
25 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
26 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE | |
28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
29 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
30 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
33 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | |
34 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
35 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
36 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
37 | */ | |
38 | /* }}} */ | |
39 | ||
d458596e JF |
40 | #ifndef CyteKit_WebViewController_H |
41 | #define CyteKit_WebViewController_H | |
819a0ab1 | 42 | |
d458596e JF |
43 | #include "CyteKit/ViewController.h" |
44 | #include "CyteKit/WebView.h" | |
819a0ab1 JF |
45 | |
46 | #include <UIKit/UIKit.h> | |
ab398adf | 47 | |
435cb857 | 48 | #include <CydiaSubstrate/CydiaSubstrate.h> |
46d3a5cf | 49 | |
facbc56d | 50 | @class IndirectDelegate; |
43f3d7f6 | 51 | |
09e89a8a | 52 | @protocol CyteWebViewControllerDelegate |
54043703 JF |
53 | - (void) retainNetworkActivityIndicator; |
54 | - (void) releaseNetworkActivityIndicator; | |
cd79e8cf | 55 | - (CyteViewController *) pageForURL:(NSURL *)url forExternal:(BOOL)external; |
302bf91c | 56 | - (void) unloadData; |
43f3d7f6 | 57 | @end |
ab398adf | 58 | |
cd79e8cf | 59 | @interface CyteWebViewController : CyteViewController < |
1ee69bb4 | 60 | CyteWebViewDelegate, |
2634b249 | 61 | UIWebViewDelegate |
c21004b9 | 62 | > { |
1ee69bb4 | 63 | _transient CyteWebView *webview_; |
3931b718 | 64 | _transient UIScrollView *scroller_; |
2634b249 | 65 | |
7a11fbb9 | 66 | UIActivityIndicatorView *indicator_; |
facbc56d | 67 | IndirectDelegate *indirect_; |
0ce617c8 | 68 | NSURLAuthenticationChallenge *challenge_; |
fe468f45 JF |
69 | |
70 | bool error_; | |
a374f380 | 71 | _H<NSURLRequest> request_; |
ab398adf | 72 | |
3931b718 | 73 | _transient NSNumber *sensitive_; |
2634b249 | 74 | |
ab398adf | 75 | NSString *title_; |
caa427d1 | 76 | NSMutableSet *loading_; |
a0376fc1 | 77 | |
2634b249 | 78 | // XXX: NSString * or UIImage * |
46d3a5cf JF |
79 | _H<NSObject> custom_; |
80 | _H<NSString> style_; | |
caa427d1 | 81 | |
46d3a5cf | 82 | _H<WebScriptObject> function_; |
3e9c9e85 JF |
83 | |
84 | float width_; | |
245cce8a | 85 | Class class_; |
bc11cf5b | 86 | |
2634b249 JF |
87 | UIBarButtonItem *reloaditem_; |
88 | UIBarButtonItem *loadingitem_; | |
5cdfcd6f JF |
89 | |
90 | bool visible_; | |
91 | bool hidesNavigationBar_; | |
8366df5e | 92 | bool allowsNavigationAction_; |
ab398adf JF |
93 | } |
94 | ||
ea173384 JF |
95 | + (void) _initialize; |
96 | ||
eb09425a JF |
97 | - (void) setURL:(NSURL *)url; |
98 | ||
ab398adf JF |
99 | - (void) loadURL:(NSURL *)url cachePolicy:(NSURLRequestCachePolicy)policy; |
100 | - (void) loadURL:(NSURL *)url; | |
101 | ||
102 | - (void) loadRequest:(NSURLRequest *)request; | |
12b59862 | 103 | - (bool) isLoading; |
ab398adf | 104 | |
b13b8664 JF |
105 | - (void) reloadURLWithCache:(BOOL)cache; |
106 | - (void) reloadURL; | |
107 | ||
b5e7eebb | 108 | - (id) init; |
eb09425a | 109 | - (id) initWithURL:(NSURL *)url; |
b5e7eebb GP |
110 | - (id) initWithWidth:(float)width; |
111 | - (id) initWithWidth:(float)width ofClass:(Class)_class; | |
ab398adf | 112 | |
caa427d1 JF |
113 | - (void) callFunction:(WebScriptObject *)function; |
114 | ||
2634b249 JF |
115 | - (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame; |
116 | - (NSURLRequest *) webView:(WebView *)view resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source; | |
43f3d7f6 | 117 | |
3e9c9e85 JF |
118 | + (float) defaultWidth; |
119 | ||
caa427d1 JF |
120 | - (void) setButtonImage:(NSString *)button withStyle:(NSString *)style toFunction:(id)function; |
121 | - (void) setButtonTitle:(NSString *)button withStyle:(NSString *)style toFunction:(id)function; | |
5cdfcd6f | 122 | - (void) setHidesNavigationBar:(bool)value; |
caa427d1 | 123 | |
c21004b9 | 124 | - (void) alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button; |
a5938ea5 | 125 | - (void) customButtonClicked; |
d53628b6 | 126 | |
c21004b9 | 127 | - (void) applyRightButton; |
29756674 | 128 | - (UIBarButtonItem *) customButton; |
d53628b6 | 129 | - (UIBarButtonItem *) rightButton; |
c21004b9 | 130 | |
2634b249 JF |
131 | - (void) _didStartLoading; |
132 | - (void) _didFinishLoading; | |
133 | ||
c21004b9 JF |
134 | - (void) close; |
135 | ||
f196b921 JF |
136 | - (void) dispatchEvent:(NSString *)event; |
137 | ||
8dbdaafa JF |
138 | - (void) setViewportWidthOnMainThread:(float)value; |
139 | ||
a5938ea5 | 140 | @end |
819a0ab1 | 141 | |
d458596e | 142 | #endif//CyteKit_WebViewController_H |