| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 base::Bind(&GeolocationProviderImpl::OnClientsChanged, | 87 base::Bind(&GeolocationProviderImpl::OnClientsChanged, |
| 88 base::Unretained(this))); | 88 base::Unretained(this))); |
| 89 } | 89 } |
| 90 | 90 |
| 91 GeolocationProviderImpl::~GeolocationProviderImpl() { | 91 GeolocationProviderImpl::~GeolocationProviderImpl() { |
| 92 Stop(); | 92 Stop(); |
| 93 DCHECK(!arbitrator_); | 93 DCHECK(!arbitrator_); |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool GeolocationProviderImpl::OnGeolocationThread() const { | 96 bool GeolocationProviderImpl::OnGeolocationThread() const { |
| 97 return base::MessageLoop::current() == message_loop(); | 97 return task_runner()->BelongsToCurrentThread(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void GeolocationProviderImpl::OnClientsChanged() { | 100 void GeolocationProviderImpl::OnClientsChanged() { |
| 101 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 101 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 102 base::Closure task; | 102 base::Closure task; |
| 103 if (high_accuracy_callbacks_.empty() && low_accuracy_callbacks_.empty()) { | 103 if (high_accuracy_callbacks_.empty() && low_accuracy_callbacks_.empty()) { |
| 104 DCHECK(IsRunning()); | 104 DCHECK(IsRunning()); |
| 105 if (!ignore_location_updates_) { | 105 if (!ignore_location_updates_) { |
| 106 // We have no more observers, so we clear the cached geoposition so that | 106 // We have no more observers, so we clear the cached geoposition so that |
| 107 // when the next observer is added we will not provide a stale position. | 107 // when the next observer is added we will not provide a stale position. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // Use the embedder's Delegate or fall back to the default one. | 180 // Use the embedder's Delegate or fall back to the default one. |
| 181 delegate_.reset(GetContentClient()->browser()->CreateGeolocationDelegate()); | 181 delegate_.reset(GetContentClient()->browser()->CreateGeolocationDelegate()); |
| 182 if (!delegate_) | 182 if (!delegate_) |
| 183 delegate_.reset(new GeolocationDelegate); | 183 delegate_.reset(new GeolocationDelegate); |
| 184 | 184 |
| 185 return base::WrapUnique( | 185 return base::WrapUnique( |
| 186 new LocationArbitratorImpl(callback, delegate_.get())); | 186 new LocationArbitratorImpl(callback, delegate_.get())); |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace content | 189 } // namespace content |
| OLD | NEW |