OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/local_discovery/service_discovery_client_mac.h" | 5 #include "chrome/browser/local_discovery/service_discovery_client_mac.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 #import <arpa/inet.h> | 8 #import <arpa/inet.h> |
9 #import <net/if_dl.h> | 9 #import <net/if_dl.h> |
10 | 10 |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 [netService startMonitoring]; | 424 [netService startMonitoring]; |
425 [services_ addObject:netService]; | 425 [services_ addObject:netService]; |
426 | 426 |
427 container_->OnServicesUpdate(local_discovery::ServiceWatcher::UPDATE_ADDED, | 427 container_->OnServicesUpdate(local_discovery::ServiceWatcher::UPDATE_ADDED, |
428 [[netService name] UTF8String]); | 428 [[netService name] UTF8String]); |
429 } | 429 } |
430 | 430 |
431 - (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser | 431 - (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser |
432 didRemoveService:(NSNetService *)netService | 432 didRemoveService:(NSNetService *)netService |
433 moreComing:(BOOL)moreServicesComing { | 433 moreComing:(BOOL)moreServicesComing { |
434 container_->OnServicesUpdate(local_discovery::ServiceWatcher::UPDATE_REMOVED, | |
435 [[netService name] UTF8String]); | |
436 | |
437 NSUInteger index = [services_ indexOfObject:netService]; | 434 NSUInteger index = [services_ indexOfObject:netService]; |
438 if (index != NSNotFound) { | 435 if (index != NSNotFound) { |
| 436 container_->OnServicesUpdate( |
| 437 local_discovery::ServiceWatcher::UPDATE_REMOVED, |
| 438 [[netService name] UTF8String]); |
| 439 |
439 // Stop monitoring this service for updates. | 440 // Stop monitoring this service for updates. |
440 [[services_ objectAtIndex:index] stopMonitoring]; | 441 [[services_ objectAtIndex:index] stopMonitoring]; |
441 [services_ removeObjectAtIndex:index]; | 442 [services_ removeObjectAtIndex:index]; |
442 } | 443 } |
443 } | 444 } |
444 | 445 |
445 - (void)netService:(NSNetService *)sender | 446 - (void)netService:(NSNetService *)sender |
446 didUpdateTXTRecordData:(NSData *)data { | 447 didUpdateTXTRecordData:(NSData *)data { |
447 container_->OnServicesUpdate(local_discovery::ServiceWatcher::UPDATE_CHANGED, | 448 container_->OnServicesUpdate(local_discovery::ServiceWatcher::UPDATE_CHANGED, |
448 [[sender name] UTF8String]); | 449 [[sender name] UTF8String]); |
(...skipping 15 matching lines...) Expand all Loading... |
464 container_->OnResolveUpdate(local_discovery::ServiceResolver::STATUS_SUCCESS); | 465 container_->OnResolveUpdate(local_discovery::ServiceResolver::STATUS_SUCCESS); |
465 } | 466 } |
466 | 467 |
467 - (void)netService:(NSNetService *)sender | 468 - (void)netService:(NSNetService *)sender |
468 didNotResolve:(NSDictionary *)errorDict { | 469 didNotResolve:(NSDictionary *)errorDict { |
469 container_->OnResolveUpdate( | 470 container_->OnResolveUpdate( |
470 local_discovery::ServiceResolver::STATUS_REQUEST_TIMEOUT); | 471 local_discovery::ServiceResolver::STATUS_REQUEST_TIMEOUT); |
471 } | 472 } |
472 | 473 |
473 @end | 474 @end |
OLD | NEW |