Changeset 3246 for lang/objective-c/SafariHatenaBookmark/SHBController.m
- Timestamp:
- 12/18/07 02:31:48 (13 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/objective-c/SafariHatenaBookmark/SHBController.m
r3211 r3246 48 48 - (void) progressStarted: (NSNotification*) n 49 49 { 50 WebView* webView = [n object];51 WebDataSource* source = [[webView mainFrame] provisionalDataSource];52 if (! source) {53 // source = [[webView mainFrame] provisionalDataSource];54 }55 NSURL* cur_url = [[source request] URL];50 WebView* webView = [n object]; 51 WebDataSource* source = [[webView mainFrame] provisionalDataSource]; 52 if (! source) { 53 // source = [[webView mainFrame] provisionalDataSource]; 54 } 55 NSURL* cur_url = [[source request] URL]; 56 56 57 NSLog(@"progressStarted: cur_url = %@", cur_url);57 NSLog(@"progressStarted: cur_url = %@", cur_url); 58 58 59 59 // construct request … … 80 80 - (void) progressFinished: (NSNotification*) n 81 81 { 82 WebView* webView = [n object];83 //NSURL* url = WebFrameRequestURL([webView mainFrame]);84 WebDataSource* source = [[webView mainFrame] provisionalDataSource];85 if (! source) {86 // source = [[webView mainFrame] provisionalDataSource];87 }88 NSURL* url = [[source request] URL];89 NSLog(@"progressFinished: url = %@", url);82 WebView* webView = [n object]; 83 //NSURL* url = WebFrameRequestURL([webView mainFrame]); 84 WebDataSource* source = [[webView mainFrame] provisionalDataSource]; 85 if (! source) { 86 // source = [[webView mainFrame] provisionalDataSource]; 87 } 88 NSURL* url = [[source request] URL]; 89 NSLog(@"progressFinished: url = %@", url); 90 90 } 91 91 … … 118 118 // callbacks 119 119 - (void) connection : (NSURLConnection *) connection 120 didReceiveResponse : (NSURLResponse *) response {120 didReceiveResponse : (NSURLResponse *) response { 121 121 NSDictionary *dicHead = [(NSHTTPURLResponse *)response allHeaderFields]; 122 122 NSLog(@"didReceiveResponse : %@", [dicHead objectForKey:@"Status"]); … … 125 125 126 126 - (void) connection : (NSURLConnection *) connection 127 didReceiveData : (NSData *) data {127 didReceiveData : (NSData *) data { 128 128 [receivedData appendData:data]; 129 129 } 130 130 131 - (void) connection : (NSURLConnection *) connection132 didFailWithError : (NSError *) error {133 NSLog(@"didFailWithError 1");134 // [connection release];135 [receivedData release];136 NSLog(@"didFailWithError 2");131 - (void) connection : (NSURLConnection *) connection 132 didFailWithError : (NSError *) error { 133 NSLog(@"didFailWithError 1"); 134 // [connection release]; 135 [receivedData release]; 136 NSLog(@"didFailWithError 2"); 137 137 } 138 138 139 139 - (void) connectionDidFinishLoading:(NSURLConnection *)connection { 140 NSLog(@"connectionDidFinishLoading: succeeded to load %d bytes", [receivedData length]);140 NSLog(@"connectionDidFinishLoading: succeeded to load %d bytes", [receivedData length]); 141 141 NSString *result = [[NSString alloc] initWithData:receivedData encoding:NSUTF8StringEncoding]; 142 142 NSLog(@"connectionDidFinishLoading: result=%@", result); 143 id json = [result JSONValue];144 NSLog(@"connectionDidFinishLoading: id=%@", json);145 146 // [connection release];147 [receivedData release];143 //id json = [result JSONValue]; 144 //NSLog(@"connectionDidFinishLoading: id=%@", json); 145 146 // [connection release]; 147 [receivedData release]; 148 148 } 149 149 150 151 150 @end
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)