| 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. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 NSBundle* bundle_; | 75 NSBundle* bundle_; |
| 76 Class locationManagerClass_; | 76 Class locationManagerClass_; |
| 77 id locationManager_; | 77 id locationManager_; |
| 78 CoreLocationDataProviderMac* dataProvider_; | 78 CoreLocationDataProviderMac* dataProvider_; |
| 79 } | 79 } |
| 80 | 80 |
| 81 - (id)initWithDataProvider:(CoreLocationDataProviderMac*)dataProvider; | 81 - (id)initWithDataProvider:(CoreLocationDataProviderMac*)dataProvider; |
| 82 - (void)dealloc; | 82 - (void)dealloc; |
| 83 | 83 |
| 84 // Can be called from any thread since it does not require an NSRunLoop. However | 84 // Can be called from any thread since it does not require an NSRunLoop. However |
| 85 // it is not threadsafe to receive concurrent calls until after it's first | 85 // it is not threadsafe to receive concurrent calls until after a first |
| 86 // successful call (to avoid |bundle_| being double initialized) | 86 // successful call (to avoid |bundle_| being double initialized) |
| 87 - (BOOL)locationDataAvailable; | 87 - (BOOL)locationDataAvailable; |
| 88 | 88 |
| 89 // These should always be called from BrowserThread::UI | 89 // These should always be called from BrowserThread::UI |
| 90 - (void)startLocation; | 90 - (void)startLocation; |
| 91 - (void)stopLocation; | 91 - (void)stopLocation; |
| 92 | 92 |
| 93 // These should only be called by CLLocationManager | 93 // These should only be called by CLLocationManager |
| 94 - (void)locationManager:(CLLocationManager*)manager | 94 - (void)locationManager:(CLLocationManager*)manager |
| 95 didUpdateToLocation:(CLLocation*)newLocation | 95 didUpdateToLocation:(CLLocation*)newLocation |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 241 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 242 [wrapper_ stopLocation]; | 242 [wrapper_ stopLocation]; |
| 243 } | 243 } |
| 244 | 244 |
| 245 void CoreLocationDataProviderMac::PositionUpdated(Geoposition position) { | 245 void CoreLocationDataProviderMac::PositionUpdated(Geoposition position) { |
| 246 DCHECK(MessageLoop::current() == | 246 DCHECK(MessageLoop::current() == |
| 247 GeolocationProvider::GetInstance()->message_loop()); | 247 GeolocationProvider::GetInstance()->message_loop()); |
| 248 if (provider_) | 248 if (provider_) |
| 249 provider_->SetPosition(&position); | 249 provider_->SetPosition(&position); |
| 250 } | 250 } |
| OLD | NEW |