diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2011-02-28 10:27:33 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-07 02:41:28 -0800 |
commit | dd48f2e66a305d635324adfc9e4689bcccb66357 (patch) | |
tree | f19a15eb529da4e93f532bd7e9d06f1078b48fb1 | |
parent | c333b2ada42cf318abbbead318b8b86add98cb6d (diff) |
DRY refactorization with silly abstraction for {request,URL}WithURL.
-rw-r--r-- | UICaboodle/BrowserView.mm | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm index 9a067f7..201e854 100644 --- a/UICaboodle/BrowserView.mm +++ b/UICaboodle/BrowserView.mm @@ -498,22 +498,25 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se [super dealloc]; } -- (void) setURL:(NSURL *)url { - _assert(request_ == nil); +- (NSURL *) URLWithURL:(NSURL *)url { + return url; +} - request_ = [NSURLRequest - requestWithURL:url - cachePolicy:NSURLRequestUseProtocolCachePolicy +- (NSURLRequest *) requestWithURL:(NSURL *)url cachePolicy:(NSURLRequestCachePolicy)policy { + return [NSURLRequest + requestWithURL:[self URLWithURL:url] + cachePolicy:policy timeoutInterval:DefaultTimeout_ ]; } +- (void) setURL:(NSURL *)url { + _assert(request_ == nil); + request_ = [self requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy]; +} + - (void) loadURL:(NSURL *)url cachePolicy:(NSURLRequestCachePolicy)policy { - [self loadRequest:[NSURLRequest - requestWithURL:url - cachePolicy:policy - timeoutInterval:DefaultTimeout_ - ]]; + [self loadRequest:[self requestWithURL:url cachePolicy:policy]]; } - (void) loadURL:(NSURL *)url { |