1 /* Cydia - iPhone UIKit Front-End for Debian APT
2 * Copyright (C) 2008-2015 Jay Freeman (saurik)
5 /* GNU General Public License, Version 3 {{{ */
7 * Cydia is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation, either version 3 of the License,
10 * or (at your option) any later version.
12 * Cydia is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Cydia. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef CyteKit_WebViewController_H
23 #define CyteKit_WebViewController_H
25 #include "CyteKit/ViewController.h"
26 #include "CyteKit/WebView.h"
28 #include <UIKit/UIKit.h>
29 #include <MessageUI/MessageUI.h>
31 #include <Menes/ObjectHandle.h>
33 @
class IndirectDelegate
;
35 @protocol CyteWebViewControllerDelegate
36 - (void) retainNetworkActivityIndicator
;
37 - (void) releaseNetworkActivityIndicator
;
38 - (CyteViewController
*) pageForURL
:(NSURL
*)url forExternal
:(BOOL
)external withReferrer
:(NSString
*)referrer
;
42 @interface CyteWebViewController
: CyteViewController
<
44 MFMailComposeViewControllerDelegate
,
47 _H
<CyteWebView
, 1> webview_
;
48 _transient UIScrollView
*scroller_
;
50 _H
<UIActivityIndicatorView
> indicator_
;
51 _H
<IndirectDelegate
, 1> indirect_
;
52 _H
<NSURLAuthenticationChallenge
> challenge_
;
55 _H
<NSURLRequest
> request_
;
58 _transient NSNumber
*sensitive_
;
62 _H
<NSMutableSet
> loading_
;
64 _H
<NSMutableSet
> registered_
;
67 // XXX: NSString * or UIImage *
71 _H
<WebScriptObject
> function_
;
76 _H
<UIBarButtonItem
> reloaditem_
;
77 _H
<UIBarButtonItem
> loadingitem_
;
80 bool hidesNavigationBar_
;
81 bool allowsNavigationAction_
;
86 - (CyteWebView
*) webView
;
88 - (void) setRequest
:(NSURLRequest
*)request
;
89 - (void) setURL
:(NSURL
*)url
;
90 - (void) setURL
:(NSURL
*)url withReferrer
:(NSString
*)referrer
;
92 - (void) loadURL
:(NSURL
*)url cachePolicy
:(NSURLRequestCachePolicy
)policy
;
93 - (void) loadURL
:(NSURL
*)url
;
95 - (void) loadRequest
:(NSURLRequest
*)request
;
100 - (id
) initWithURL
:(NSURL
*)url
;
101 - (id
) initWithRequest
:(NSURLRequest
*)request
;
103 - (id
) initWithWidth
:(float)width
;
104 - (id
) initWithWidth
:(float)width ofClass
:(Class
)_class
;
106 - (void) callFunction
:(WebScriptObject
*)function
;
107 - (void) reloadURLWithCache
:(BOOL
)cache
;
109 - (void) webView
:(WebView
*)view didClearWindowObject
:(WebScriptObject
*)window forFrame
:(WebFrame
*)frame
;
111 - (NSURLRequest
*) webView
:(WebView
*)view resource
:(id
)identifier willSendRequest
:(NSURLRequest
*)request redirectResponse
:(NSURLResponse
*)response fromDataSource
:(WebDataSource
*)source
;
112 - (NSURLRequest
*) webThreadWebView
:(WebView
*)view resource
:(id
)identifier willSendRequest
:(NSURLRequest
*)request redirectResponse
:(NSURLResponse
*)response fromDataSource
:(WebDataSource
*)source
;
114 + (float) defaultWidth
;
116 - (void) setButtonImage
:(NSString
*)button withStyle
:(NSString
*)style toFunction
:(id
)function
;
117 - (void) setButtonTitle
:(NSString
*)button withStyle
:(NSString
*)style toFunction
:(id
)function
;
118 - (void) setHidesNavigationBar
:(bool)value
;
120 - (void) alertView
:(UIAlertView
*)alert clickedButtonAtIndex
:(NSInteger
)button
;
121 - (void) customButtonClicked
;
123 - (void) applyRightButton
;
124 - (UIBarButtonItem
*) customButton
;
125 - (UIBarButtonItem
*) rightButton
;
127 - (void) applyLeftButton
;
128 - (UIBarButtonItem
*) leftButton
;
130 - (void) removeButton
;
132 - (void) _didStartLoading
;
133 - (void) _didFinishLoading
;
137 - (void) dispatchEvent
:(NSString
*)event
;
139 - (void) setViewportWidthOnMainThread
:(float)value
;
141 - (void) setScrollAlwaysBounceVertical
:(bool)value
;
142 - (void) setScrollIndicatorStyle
:(UIScrollViewIndicatorStyle
)style
;
144 - (void) registerFrame
:(WebFrame
*)frame
;
148 #endif//CyteKit_WebViewController_H