]> git.saurik.com Git - cydia.git/blob - UICaboodle/BrowserView.h
Reimplement APT marking as I finally understand how it works.
[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 UIProgressIndicator;
19 @class UIScroller;
20 @class UIDocumentWebView;
21
22 @class WebView;
23
24 @class Database;
25 @class IndirectDelegate;
26
27 @protocol CYWebViewDelegate <UIWebViewDelegate>
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 @end
42
43 @interface CYWebView : UIWebView
44 - (id<CYWebViewDelegate>) delegate;
45 @end
46
47 @interface WebScriptObject (UICaboodle)
48 - (NSUInteger) count;
49 - (id) objectAtIndex:(unsigned)index;
50 @end
51
52 @protocol BrowserControllerDelegate
53 - (CYViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag;
54 @end
55
56 @interface BrowserController : CYViewController <
57 CYWebViewDelegate,
58 HookProtocol,
59 UIWebViewDelegate
60 > {
61 _transient CYWebView *webview_;
62 _transient UIScrollView *scroller_;
63
64 UIProgressIndicator *indicator_;
65 IndirectDelegate *indirect_;
66 NSURLAuthenticationChallenge *challenge_;
67
68 bool error_;
69 NSURLRequest *request_;
70
71 _transient NSNumber *sensitive_;
72
73 NSString *title_;
74 NSMutableSet *loading_;
75
76 // XXX: NSString * or UIImage *
77 id custom_;
78 NSString *style_;
79
80 WebScriptObject *function_;
81 WebScriptObject *closer_;
82
83 float width_;
84 Class class_;
85
86 UIBarButtonItem *reloaditem_;
87 UIBarButtonItem *loadingitem_;
88 }
89
90 + (void) _initialize;
91
92 - (void) loadURL:(NSURL *)url cachePolicy:(NSURLRequestCachePolicy)policy;
93 - (void) loadURL:(NSURL *)url;
94
95 - (void) loadRequest:(NSURLRequest *)request;
96 - (void) reloadURL;
97 - (bool) isLoading;
98
99 - (id) init;
100 - (id) initWithWidth:(float)width;
101 - (id) initWithWidth:(float)width ofClass:(Class)_class;
102
103 - (void) callFunction:(WebScriptObject *)function;
104
105 - (void) webView:(WebView *)view didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame;
106 - (NSURLRequest *) webView:(WebView *)view resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response fromDataSource:(WebDataSource *)source;
107
108 + (float) defaultWidth;
109
110 - (void) setButtonImage:(NSString *)button withStyle:(NSString *)style toFunction:(id)function;
111 - (void) setButtonTitle:(NSString *)button withStyle:(NSString *)style toFunction:(id)function;
112 - (void) setPopupHook:(id)function;
113
114 - (void) alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button;
115 - (void) customButtonClicked;
116 - (void) applyRightButton;
117
118 - (void) _didStartLoading;
119 - (void) _didFinishLoading;
120
121 - (void) close;
122
123 @end