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 "device/geolocation/geolocation_provider_impl.h" | 5 #include "device/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/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 GeolocationProviderImpl* GeolocationProviderImpl::GetInstance() { | 86 GeolocationProviderImpl* GeolocationProviderImpl::GetInstance() { |
87 return base::Singleton<GeolocationProviderImpl>::get(); | 87 return base::Singleton<GeolocationProviderImpl>::get(); |
88 } | 88 } |
89 | 89 |
90 GeolocationProviderImpl::GeolocationProviderImpl() | 90 GeolocationProviderImpl::GeolocationProviderImpl() |
91 : base::Thread("Geolocation"), | 91 : base::Thread("Geolocation"), |
92 user_did_opt_into_location_services_(false), | 92 user_did_opt_into_location_services_(false), |
93 ignore_location_updates_(false), | 93 ignore_location_updates_(false), |
94 main_task_runner_(base::ThreadTaskRunnerHandle::Get()) { | 94 main_task_runner_(base::ThreadTaskRunnerHandle::Get()) { |
95 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 95 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
96 high_accuracy_callbacks_.set_removal_callback( | 96 high_accuracy_callbacks_.set_removal_callback(base::Bind( |
97 base::Bind(&GeolocationProviderImpl::OnClientsChanged, | 97 &GeolocationProviderImpl::OnClientsChanged, base::Unretained(this))); |
98 base::Unretained(this))); | 98 low_accuracy_callbacks_.set_removal_callback(base::Bind( |
99 low_accuracy_callbacks_.set_removal_callback( | 99 &GeolocationProviderImpl::OnClientsChanged, base::Unretained(this))); |
100 base::Bind(&GeolocationProviderImpl::OnClientsChanged, | |
101 base::Unretained(this))); | |
102 } | 100 } |
103 | 101 |
104 GeolocationProviderImpl::~GeolocationProviderImpl() { | 102 GeolocationProviderImpl::~GeolocationProviderImpl() { |
105 Stop(); | 103 Stop(); |
106 DCHECK(!arbitrator_); | 104 DCHECK(!arbitrator_); |
107 } | 105 } |
108 | 106 |
109 bool GeolocationProviderImpl::OnGeolocationThread() const { | 107 bool GeolocationProviderImpl::OnGeolocationThread() const { |
110 return task_runner()->BelongsToCurrentThread(); | 108 return task_runner()->BelongsToCurrentThread(); |
111 } | 109 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 &GeolocationProviderImpl::OnLocationUpdate, base::Unretained(this)); | 189 &GeolocationProviderImpl::OnLocationUpdate, base::Unretained(this)); |
192 // Use the embedder's |g_delegate| or fall back to the default one. | 190 // Use the embedder's |g_delegate| or fall back to the default one. |
193 if (!g_delegate.Get()) | 191 if (!g_delegate.Get()) |
194 g_delegate.Get().reset(new GeolocationDelegate); | 192 g_delegate.Get().reset(new GeolocationDelegate); |
195 | 193 |
196 return base::WrapUnique( | 194 return base::WrapUnique( |
197 new LocationArbitratorImpl(callback, g_delegate.Get().get())); | 195 new LocationArbitratorImpl(callback, g_delegate.Get().get())); |
198 } | 196 } |
199 | 197 |
200 } // namespace device | 198 } // namespace device |
OLD | NEW |