OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 } | 185 } |
186 | 186 |
187 return YES; | 187 return YES; |
188 } | 188 } |
189 | 189 |
190 @end | 190 @end |
191 | 191 |
192 namespace content { | 192 namespace content { |
193 | 193 |
194 CoreLocationDataProviderMac::CoreLocationDataProviderMac() { | 194 CoreLocationDataProviderMac::CoreLocationDataProviderMac() { |
195 if (MessageLoop::current() != | 195 if (base::MessageLoop::current() != |
196 GeolocationProvider::GetInstance()->message_loop()) { | 196 GeolocationProvider::GetInstance()->message_loop()) { |
197 NOTREACHED() << "CoreLocation data provider must be created on " | 197 NOTREACHED() << "CoreLocation data provider must be created on " |
198 "the Geolocation thread."; | 198 "the Geolocation thread."; |
199 } | 199 } |
200 provider_ = NULL; | 200 provider_ = NULL; |
201 wrapper_.reset([[CoreLocationWrapperMac alloc] initWithDataProvider:this]); | 201 wrapper_.reset([[CoreLocationWrapperMac alloc] initWithDataProvider:this]); |
202 } | 202 } |
203 | 203 |
204 CoreLocationDataProviderMac::~CoreLocationDataProviderMac() { | 204 CoreLocationDataProviderMac::~CoreLocationDataProviderMac() { |
205 } | 205 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 [wrapper_ startLocation]; | 240 [wrapper_ startLocation]; |
241 } | 241 } |
242 | 242 |
243 // Runs in BrowserThread::UI | 243 // Runs in BrowserThread::UI |
244 void CoreLocationDataProviderMac::StopUpdatingTask() { | 244 void CoreLocationDataProviderMac::StopUpdatingTask() { |
245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 245 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
246 [wrapper_ stopLocation]; | 246 [wrapper_ stopLocation]; |
247 } | 247 } |
248 | 248 |
249 void CoreLocationDataProviderMac::PositionUpdated(Geoposition position) { | 249 void CoreLocationDataProviderMac::PositionUpdated(Geoposition position) { |
250 DCHECK(MessageLoop::current() == | 250 DCHECK(base::MessageLoop::current() == |
251 GeolocationProvider::GetInstance()->message_loop()); | 251 GeolocationProvider::GetInstance()->message_loop()); |
252 if (provider_) | 252 if (provider_) |
253 provider_->SetPosition(&position); | 253 provider_->SetPosition(&position); |
254 } | 254 } |
255 | 255 |
256 } // namespace content | 256 } // namespace content |
OLD | NEW |