]> git.saurik.com Git - cydia.git/blame - UICaboodle/BrowserView.h
Simplify memory management of Source.
[cydia.git] / UICaboodle / BrowserView.h
CommitLineData
a9dbe12c
JF
1#import <UICaboodle/RVPage.h>
2#import <UICaboodle/RVBook.h>
3
4#import <UIKit/UIKit.h>
ab398adf 5
22f8bed9 6#include <WebKit/DOMNodeList.h>
22f8bed9 7#include <WebKit/WebFrame.h>
22f8bed9 8#include <WebKit/WebScriptObject.h>
c21004b9 9#include <WebKit/WebView.h>
22f8bed9
JF
10
11#import <JavaScriptCore/JavaScriptCore.h>
12
46d3a5cf
JF
13#include "substrate.h"
14
ab398adf
JF
15@class NSMutableArray;
16@class NSString;
17@class NSURL;
18@class NSURLRequest;
19
ab398adf 20@class UIScroller;
facbc56d 21@class UIDocumentWebView;
ab398adf 22
a9543575
JF
23@class WebView;
24
ab398adf 25@class Database;
facbc56d 26@class IndirectDelegate;
43f3d7f6 27
2634b249 28@protocol CYWebViewDelegate <UIWebViewDelegate>
72bdb258 29- (void) webView:(WebView *)view addMessageToConsole:(NSDictionary *)message;
2634b249
JF
30- (void) webView:(WebView *)view decidePolicyForNavigationAction:(NSDictionary *)action request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener;
31- (void) webView:(WebView *)view decidePolicyForNewWindowAction:(NSDictionary *)action request:(NSURLRequest *)request newFrameName:(NSString *)name decisionListener:(id<WebPolicyDecisionListener>)listener;
32- (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame;
33- (void) webView:(WebView *)view didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
34- (void) webView:(WebView *)view didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame;
35- (void) webView:(WebView *)view didFinishLoadForFrame:(WebFrame *)frame;
36- (void) webView:(WebView *)view didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame;
37- (void) webView:(WebView *)view didStartProvisionalLoadForFrame:(WebFrame *)frame;
38- (NSURLRequest *) webView:(WebView *)view resource:(id)resource willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source;
39- (void) webViewClose:(WebView *)view;
40- (bool) webView:(WebView *)view shouldRunJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame;
41- (bool) webView:(WebView *)view shouldRunJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame;
42- (bool) webView:(WebView *)view shouldRunJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)text initiatedByFrame:(WebFrame *)frame;
7e37a676 43- (void) webViewUpdateViewSettings:(UIWebView *)view;
2634b249
JF
44@end
45
46@interface CYWebView : UIWebView
47- (id<CYWebViewDelegate>) delegate;
48@end
49
43f3d7f6 50@interface WebScriptObject (UICaboodle)
96f3833b 51- (NSUInteger) count;
43f3d7f6
JF
52- (id) objectAtIndex:(unsigned)index;
53@end
54
2e6c1426 55@protocol BrowserControllerDelegate
54043703
JF
56- (void) retainNetworkActivityIndicator;
57- (void) releaseNetworkActivityIndicator;
028dbd1c 58- (CYViewController *) pageForURL:(NSURL *)url forExternal:(BOOL)external;
43f3d7f6 59@end
ab398adf 60
9b623dac 61@interface BrowserController : CYViewController <
2634b249
JF
62 CYWebViewDelegate,
63 HookProtocol,
64 UIWebViewDelegate
c21004b9 65> {
3931b718
JF
66 _transient CYWebView *webview_;
67 _transient UIScrollView *scroller_;
2634b249 68
7a11fbb9 69 UIActivityIndicatorView *indicator_;
facbc56d 70 IndirectDelegate *indirect_;
0ce617c8 71 NSURLAuthenticationChallenge *challenge_;
fe468f45
JF
72
73 bool error_;
a374f380 74 _H<NSURLRequest> request_;
ab398adf 75
3931b718 76 _transient NSNumber *sensitive_;
2634b249 77
ab398adf 78 NSString *title_;
caa427d1 79 NSMutableSet *loading_;
a0376fc1 80
2634b249 81 // XXX: NSString * or UIImage *
46d3a5cf
JF
82 _H<NSObject> custom_;
83 _H<NSString> style_;
caa427d1 84
46d3a5cf 85 _H<WebScriptObject> function_;
12b59862 86 WebScriptObject *closer_;
3e9c9e85
JF
87
88 float width_;
245cce8a 89 Class class_;
bc11cf5b 90
2634b249
JF
91 UIBarButtonItem *reloaditem_;
92 UIBarButtonItem *loadingitem_;
5cdfcd6f
JF
93
94 bool visible_;
95 bool hidesNavigationBar_;
ab398adf
JF
96}
97
ea173384
JF
98+ (void) _initialize;
99
eb09425a
JF
100- (void) setURL:(NSURL *)url;
101
ab398adf
JF
102- (void) loadURL:(NSURL *)url cachePolicy:(NSURLRequestCachePolicy)policy;
103- (void) loadURL:(NSURL *)url;
104
105- (void) loadRequest:(NSURLRequest *)request;
12b59862 106- (bool) isLoading;
ab398adf 107
b13b8664
JF
108- (void) reloadURLWithCache:(BOOL)cache;
109- (void) reloadURL;
110
b5e7eebb 111- (id) init;
eb09425a 112- (id) initWithURL:(NSURL *)url;
b5e7eebb
GP
113- (id) initWithWidth:(float)width;
114- (id) initWithWidth:(float)width ofClass:(Class)_class;
ab398adf 115
caa427d1
JF
116- (void) callFunction:(WebScriptObject *)function;
117
2634b249
JF
118- (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame;
119- (NSURLRequest *) webView:(WebView *)view resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source;
43f3d7f6 120
3e9c9e85
JF
121+ (float) defaultWidth;
122
caa427d1
JF
123- (void) setButtonImage:(NSString *)button withStyle:(NSString *)style toFunction:(id)function;
124- (void) setButtonTitle:(NSString *)button withStyle:(NSString *)style toFunction:(id)function;
caa427d1 125- (void) setPopupHook:(id)function;
5cdfcd6f 126- (void) setHidesNavigationBar:(bool)value;
caa427d1 127
c21004b9 128- (void) alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button;
a5938ea5 129- (void) customButtonClicked;
c21004b9
JF
130- (void) applyRightButton;
131
2634b249
JF
132- (void) _didStartLoading;
133- (void) _didFinishLoading;
134
c21004b9
JF
135- (void) close;
136
f196b921
JF
137- (void) dispatchEvent:(NSString *)event;
138
8dbdaafa
JF
139- (void) setViewportWidthOnMainThread:(float)value;
140
a5938ea5 141@end