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 // This file contains the class definitions for the CoreLocation data provider | 5 // This file contains the class definitions for the CoreLocation data provider |
6 // class and the accompanying Objective C wrapper class. This data provider | 6 // class and the accompanying Objective C wrapper class. This data provider |
7 // is used to allow the CoreLocation wrapper to run on the UI thread, since | 7 // is used to allow the CoreLocation wrapper to run on the UI thread, since |
8 // CLLocationManager's start and stop updating methods must be called from a | 8 // CLLocationManager's start and stop updating methods must be called from a |
9 // thread with an active NSRunLoop. Currently only the UI thread appears to | 9 // thread with an active NSRunLoop. Currently only the UI thread appears to |
10 // fill that requirement. | 10 // fill that requirement. |
11 | 11 |
12 #include "content/browser/geolocation/core_location_data_provider_mac.h" | 12 #include "content/browser/geolocation/core_location_data_provider_mac.h" |
13 | 13 |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "content/browser/geolocation/core_location_provider_mac.h" | 17 #include "content/browser/geolocation/core_location_provider_mac.h" |
18 #include "content/browser/geolocation/geolocation_provider.h" | 18 #include "content/browser/geolocation/geolocation_provider.h" |
19 | 19 |
| 20 using content::BrowserThread; |
| 21 |
20 // A few required declarations since the CoreLocation headers are not available | 22 // A few required declarations since the CoreLocation headers are not available |
21 // with the Mac OS X 10.5 SDK. | 23 // with the Mac OS X 10.5 SDK. |
22 // TODO(jorgevillatoro): Remove these declarations when we build against 10.6 | 24 // TODO(jorgevillatoro): Remove these declarations when we build against 10.6 |
23 | 25 |
24 // This idea was borrowed from wifi_data_provider_corewlan_mac.mm | 26 // This idea was borrowed from wifi_data_provider_corewlan_mac.mm |
25 typedef double CLLocationDegrees; | 27 typedef double CLLocationDegrees; |
26 typedef double CLLocationAccuracy; | 28 typedef double CLLocationAccuracy; |
27 typedef double CLLocationSpeed; | 29 typedef double CLLocationSpeed; |
28 typedef double CLLocationDirection; | 30 typedef double CLLocationDirection; |
29 typedef double CLLocationDistance; | 31 typedef double CLLocationDistance; |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 241 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
240 [wrapper_ stopLocation]; | 242 [wrapper_ stopLocation]; |
241 } | 243 } |
242 | 244 |
243 void CoreLocationDataProviderMac::PositionUpdated(Geoposition position) { | 245 void CoreLocationDataProviderMac::PositionUpdated(Geoposition position) { |
244 DCHECK(MessageLoop::current() == | 246 DCHECK(MessageLoop::current() == |
245 GeolocationProvider::GetInstance()->message_loop()); | 247 GeolocationProvider::GetInstance()->message_loop()); |
246 if (provider_) | 248 if (provider_) |
247 provider_->SetPosition(&position); | 249 provider_->SetPosition(&position); |
248 } | 250 } |
OLD | NEW |