| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Implements a WLAN API binding for CoreWLAN, as available on OSX 10.6 | 5 // Implements a WLAN API binding for CoreWLAN, as available on OSX 10.6 |
| 6 | 6 |
| 7 #include "content/browser/geolocation/wifi_data_provider_mac.h" | 7 #include "content/browser/geolocation/wifi_data_provider_mac.h" |
| 8 | 8 |
| 9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
| 10 #import <Foundation/Foundation.h> | 10 #import <Foundation/Foundation.h> |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 void* dl_handle = dlopen([[bundle_ executablePath] fileSystemRepresentation], | 82 void* dl_handle = dlopen([[bundle_ executablePath] fileSystemRepresentation], |
| 83 RTLD_LAZY | RTLD_LOCAL); | 83 RTLD_LAZY | RTLD_LOCAL); |
| 84 if (dl_handle) { | 84 if (dl_handle) { |
| 85 NSString* key = *reinterpret_cast<NSString**>(dlsym(dl_handle, | 85 NSString* key = *reinterpret_cast<NSString**>(dlsym(dl_handle, |
| 86 "kCWScanKeyMerge")); | 86 "kCWScanKeyMerge")); |
| 87 if (key) | 87 if (key) |
| 88 merge_key_.reset([key copy]); | 88 merge_key_.reset([key copy]); |
| 89 } | 89 } |
| 90 // "Leak" dl_handle rather than dlclose it, to ensure |merge_key_| | 90 // "Leak" dl_handle rather than dlclose it, to ensure |merge_key_| |
| 91 // remains valid. | 91 // remains valid. |
| 92 if (!merge_key_.get()) { | 92 if (!merge_key_) { |
| 93 // Fall back to a known-working value should the lookup fail (if | 93 // Fall back to a known-working value should the lookup fail (if |
| 94 // this value is itself wrong it's not the end of the world, we might just | 94 // this value is itself wrong it's not the end of the world, we might just |
| 95 // get very slightly lower quality location fixes due to SSID merges). | 95 // get very slightly lower quality location fixes due to SSID merges). |
| 96 DLOG(WARNING) << "Could not dynamically load the CoreWLAN merge key"; | 96 DLOG(WARNING) << "Could not dynamically load the CoreWLAN merge key"; |
| 97 merge_key_.reset([@"SCAN_MERGE" retain]); | 97 merge_key_.reset([@"SCAN_MERGE" retain]); |
| 98 } | 98 } |
| 99 | 99 |
| 100 return true; | 100 return true; |
| 101 } | 101 } |
| 102 | 102 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 178 |
| 179 WifiDataProviderCommon::WlanApiInterface* NewCoreWlanApi() { | 179 WifiDataProviderCommon::WlanApiInterface* NewCoreWlanApi() { |
| 180 scoped_ptr<CoreWlanApi> self(new CoreWlanApi); | 180 scoped_ptr<CoreWlanApi> self(new CoreWlanApi); |
| 181 if (self->Init()) | 181 if (self->Init()) |
| 182 return self.release(); | 182 return self.release(); |
| 183 | 183 |
| 184 return NULL; | 184 return NULL; |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace content | 187 } // namespace content |
| OLD | NEW |