| 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 "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 GeofencingServiceImpl::GeofencingServiceImpl() : next_registration_id_(0) { | 67 GeofencingServiceImpl::GeofencingServiceImpl() : next_registration_id_(0) { |
| 68 } | 68 } |
| 69 | 69 |
| 70 GeofencingServiceImpl::~GeofencingServiceImpl() { | 70 GeofencingServiceImpl::~GeofencingServiceImpl() { |
| 71 } | 71 } |
| 72 | 72 |
| 73 GeofencingServiceImpl* GeofencingServiceImpl::GetInstance() { | 73 GeofencingServiceImpl* GeofencingServiceImpl::GetInstance() { |
| 74 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 74 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 75 return Singleton<GeofencingServiceImpl>::get(); | 75 return base::Singleton<GeofencingServiceImpl>::get(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 bool GeofencingServiceImpl::IsServiceAvailable() { | 78 bool GeofencingServiceImpl::IsServiceAvailable() { |
| 79 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 79 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 80 return EnsureProvider(); | 80 return EnsureProvider(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 int64 GeofencingServiceImpl::RegisterRegion( | 83 int64 GeofencingServiceImpl::RegisterRegion( |
| 84 const blink::WebCircularGeofencingRegion& region, | 84 const blink::WebCircularGeofencingRegion& region, |
| 85 GeofencingRegistrationDelegate* delegate) { | 85 GeofencingRegistrationDelegate* delegate) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 registration_iterator->second.delegate->RegistrationFinished( | 192 registration_iterator->second.delegate->RegistrationFinished( |
| 193 geofencing_registration_id, status); | 193 geofencing_registration_id, status); |
| 194 | 194 |
| 195 if (status != GEOFENCING_STATUS_OK) { | 195 if (status != GEOFENCING_STATUS_OK) { |
| 196 // Registration failed, remove from our book-keeping. | 196 // Registration failed, remove from our book-keeping. |
| 197 registrations_.erase(registration_iterator); | 197 registrations_.erase(registration_iterator); |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace content | 201 } // namespace content |
| OLD | NEW |