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 #include "content/browser/geolocation/geolocation_provider_impl.h" | 5 #include "content/browser/geolocation/geolocation_provider_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 delete arbitrator_; | 226 delete arbitrator_; |
227 arbitrator_ = NULL; | 227 arbitrator_ = NULL; |
228 } | 228 } |
229 | 229 |
230 LocationArbitrator* GeolocationProviderImpl::CreateArbitrator() { | 230 LocationArbitrator* GeolocationProviderImpl::CreateArbitrator() { |
231 LocationArbitratorImpl::LocationUpdateCallback callback = base::Bind( | 231 LocationArbitratorImpl::LocationUpdateCallback callback = base::Bind( |
232 &GeolocationProviderImpl::OnLocationUpdate, base::Unretained(this)); | 232 &GeolocationProviderImpl::OnLocationUpdate, base::Unretained(this)); |
233 return new LocationArbitratorImpl(callback); | 233 return new LocationArbitratorImpl(callback); |
234 } | 234 } |
235 | 235 |
| 236 void GeolocationProviderImpl::PauseAllLocationUpdateCallbacks() { |
| 237 if (!IsRunning()) return; |
| 238 if (!OnGeolocationThread()) { |
| 239 message_loop()->PostTask( |
| 240 FROM_HERE, |
| 241 base::Bind(&GeolocationProviderImpl::PauseAllLocationUpdateCallbacks, |
| 242 base::Unretained(this))); |
| 243 return; |
| 244 } |
| 245 |
| 246 DCHECK(OnGeolocationThread()); |
| 247 DCHECK(arbitrator_); |
| 248 arbitrator_->PauseProviders(); |
| 249 } |
| 250 |
| 251 void GeolocationProviderImpl::ResumeAllLocationUpdateCallbacks() { |
| 252 if (!IsRunning()) return; |
| 253 if (!OnGeolocationThread()) { |
| 254 message_loop()->PostTask( |
| 255 FROM_HERE, |
| 256 base::Bind(&GeolocationProviderImpl::ResumeAllLocationUpdateCallbacks, |
| 257 base::Unretained(this))); |
| 258 return; |
| 259 } |
| 260 |
| 261 DCHECK(OnGeolocationThread()); |
| 262 DCHECK(arbitrator_); |
| 263 arbitrator_->ResumeProviders(); |
| 264 } |
| 265 |
236 } // namespace content | 266 } // namespace content |
OLD | NEW |