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