Show
Ignore:
Timestamp:
12/18/07 02:31:48 (13 months ago)
Author:
mootoh
Message:

re-writing with RubyCocoa?.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/objective-c/SafariHatenaBookmark/SHBController.m

    r3211 r3246  
    4848- (void) progressStarted: (NSNotification*) n 
    4949{ 
    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]; 
    5656 
    57     NSLog(@"progressStarted: cur_url = %@", cur_url); 
     57  NSLog(@"progressStarted: cur_url = %@", cur_url); 
    5858 
    5959  // construct request 
     
    8080- (void) progressFinished: (NSNotification*) n 
    8181{ 
    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); 
    9090} 
    9191 
     
    118118// callbacks 
    119119- (void) connection : (NSURLConnection *) connection 
    120          didReceiveResponse : (NSURLResponse *) response { 
     120didReceiveResponse : (NSURLResponse *) response { 
    121121  NSDictionary *dicHead = [(NSHTTPURLResponse *)response allHeaderFields]; 
    122122  NSLog(@"didReceiveResponse : %@", [dicHead objectForKey:@"Status"]); 
     
    125125 
    126126- (void) connection : (NSURLConnection *) connection 
    127          didReceiveData : (NSData *) data { 
     127didReceiveData : (NSData *) data { 
    128128  [receivedData appendData:data]; 
    129129} 
    130130 
    131  - (void) connection : (NSURLConnection *) connection  
    132         didFailWithError : (NSError *) error { 
    133         NSLog(@"didFailWithError 1"); 
    134         // [connection release]; 
    135         [receivedData release];  
    136         NSLog(@"didFailWithError 2"); 
     131- (void) connection : (NSURLConnection *) connection  
     132didFailWithError : (NSError *) error { 
     133  NSLog(@"didFailWithError 1"); 
     134  // [connection release]; 
     135  [receivedData release];        
     136  NSLog(@"didFailWithError 2"); 
    137137} 
    138138 
    139139- (void) connectionDidFinishLoading:(NSURLConnection *)connection { 
    140         NSLog(@"connectionDidFinishLoading: succeeded to load %d bytes", [receivedData length]); 
     140  NSLog(@"connectionDidFinishLoading: succeeded to load %d bytes", [receivedData length]); 
    141141  NSString *result = [[NSString alloc] initWithData:receivedData encoding:NSUTF8StringEncoding]; 
    142142  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]; 
    148148} 
    149149 
    150  
    151150@end