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/location_arbitrator_impl.h" | 5 #include "content/browser/geolocation/location_arbitrator_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 | 64 |
65 void GeolocationArbitratorImpl::DoStartProviders() { | 65 void GeolocationArbitratorImpl::DoStartProviders() { |
66 for (ScopedVector<LocationProviderBase>::iterator i = providers_.begin(); | 66 for (ScopedVector<LocationProviderBase>::iterator i = providers_.begin(); |
67 i != providers_.end(); ++i) { | 67 i != providers_.end(); ++i) { |
68 (*i)->StartProvider(use_high_accuracy_); | 68 (*i)->StartProvider(use_high_accuracy_); |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 void GeolocationArbitratorImpl::StopProviders() { | 72 void GeolocationArbitratorImpl::StopProviders() { |
| 73 // Reset the reference location state (provider+position) |
| 74 // so that future starts use fresh locations from |
| 75 // the newly constructed providers. |
| 76 position_provider_ = NULL; |
| 77 position_ = Geoposition(); |
| 78 |
73 providers_.clear(); | 79 providers_.clear(); |
74 is_running_ = false; | 80 is_running_ = false; |
75 } | 81 } |
76 | 82 |
77 void GeolocationArbitratorImpl::OnAccessTokenStoresLoaded( | 83 void GeolocationArbitratorImpl::OnAccessTokenStoresLoaded( |
78 AccessTokenStore::AccessTokenSet access_token_set, | 84 AccessTokenStore::AccessTokenSet access_token_set, |
79 net::URLRequestContextGetter* context_getter) { | 85 net::URLRequestContextGetter* context_getter) { |
80 if (!is_running_ || !providers_.empty()) { | 86 if (!is_running_ || !providers_.empty()) { |
81 // A second StartProviders() call may have arrived before the first | 87 // A second StartProviders() call may have arrived before the first |
82 // completed. | 88 // completed. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 184 } |
179 } | 185 } |
180 return false; | 186 return false; |
181 } | 187 } |
182 | 188 |
183 bool GeolocationArbitratorImpl::HasPermissionBeenGranted() const { | 189 bool GeolocationArbitratorImpl::HasPermissionBeenGranted() const { |
184 return is_permission_granted_; | 190 return is_permission_granted_; |
185 } | 191 } |
186 | 192 |
187 } // namespace content | 193 } // namespace content |
OLD | NEW |