OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/geofencing/geofencing_service.h" | 5 #include "content/browser/geofencing/geofencing_service.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/location.h" | 9 #include "base/location.h" |
8 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
9 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
11 #include "content/browser/geofencing/geofencing_provider.h" | 13 #include "content/browser/geofencing/geofencing_provider.h" |
12 #include "content/browser/geofencing/geofencing_registration_delegate.h" | 14 #include "content/browser/geofencing/geofencing_registration_delegate.h" |
13 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
14 #include "third_party/WebKit/public/platform/WebCircularGeofencingRegion.h" | 16 #include "third_party/WebKit/public/platform/WebCircularGeofencingRegion.h" |
15 | 17 |
16 namespace content { | 18 namespace content { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 case Registration::STATE_SHOULD_UNREGISTER_AND_DELETE: | 135 case Registration::STATE_SHOULD_UNREGISTER_AND_DELETE: |
134 // Should not happen. | 136 // Should not happen. |
135 NOTREACHED(); | 137 NOTREACHED(); |
136 break; | 138 break; |
137 } | 139 } |
138 } | 140 } |
139 | 141 |
140 void GeofencingServiceImpl::SetProviderForTesting( | 142 void GeofencingServiceImpl::SetProviderForTesting( |
141 scoped_ptr<GeofencingProvider> provider) { | 143 scoped_ptr<GeofencingProvider> provider) { |
142 DCHECK(!provider_.get()); | 144 DCHECK(!provider_.get()); |
143 provider_ = provider.Pass(); | 145 provider_ = std::move(provider); |
144 } | 146 } |
145 | 147 |
146 int GeofencingServiceImpl::RegistrationCountForTesting() { | 148 int GeofencingServiceImpl::RegistrationCountForTesting() { |
147 return registrations_.size(); | 149 return registrations_.size(); |
148 } | 150 } |
149 | 151 |
150 bool GeofencingServiceImpl::EnsureProvider() { | 152 bool GeofencingServiceImpl::EnsureProvider() { |
151 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 153 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
152 | 154 |
153 if (!provider_) { | 155 if (!provider_) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 registration_iterator->second.delegate->RegistrationFinished( | 194 registration_iterator->second.delegate->RegistrationFinished( |
193 geofencing_registration_id, status); | 195 geofencing_registration_id, status); |
194 | 196 |
195 if (status != GEOFENCING_STATUS_OK) { | 197 if (status != GEOFENCING_STATUS_OK) { |
196 // Registration failed, remove from our book-keeping. | 198 // Registration failed, remove from our book-keeping. |
197 registrations_.erase(registration_iterator); | 199 registrations_.erase(registration_iterator); |
198 } | 200 } |
199 } | 201 } |
200 | 202 |
201 } // namespace content | 203 } // namespace content |
OLD | NEW |