| 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/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 8 #include "base/message_loop/message_loop.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" |
| 9 #include "content/browser/geofencing/geofencing_provider.h" | 11 #include "content/browser/geofencing/geofencing_provider.h" |
| 10 #include "content/browser/geofencing/geofencing_registration_delegate.h" | 12 #include "content/browser/geofencing/geofencing_registration_delegate.h" |
| 11 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 12 #include "third_party/WebKit/public/platform/WebCircularGeofencingRegion.h" | 14 #include "third_party/WebKit/public/platform/WebCircularGeofencingRegion.h" |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| 15 | 17 |
| 16 namespace { | 18 namespace { |
| 17 | 19 |
| 18 void RunSoon(const base::Closure& callback) { | 20 void RunSoon(const base::Closure& callback) { |
| 19 if (!callback.is_null()) | 21 if (!callback.is_null()) |
| 20 base::MessageLoop::current()->PostTask(FROM_HERE, callback); | 22 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback); |
| 21 } | 23 } |
| 22 | 24 |
| 23 } // namespace | 25 } // namespace |
| 24 | 26 |
| 25 struct GeofencingServiceImpl::Registration { | 27 struct GeofencingServiceImpl::Registration { |
| 26 Registration(); | 28 Registration(); |
| 27 Registration(const blink::WebCircularGeofencingRegion& region, | 29 Registration(const blink::WebCircularGeofencingRegion& region, |
| 28 int64 geofencing_registration_id, | 30 int64 geofencing_registration_id, |
| 29 GeofencingRegistrationDelegate* delegate); | 31 GeofencingRegistrationDelegate* delegate); |
| 30 | 32 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 registration_iterator->second.delegate->RegistrationFinished( | 192 registration_iterator->second.delegate->RegistrationFinished( |
| 191 geofencing_registration_id, status); | 193 geofencing_registration_id, status); |
| 192 | 194 |
| 193 if (status != GEOFENCING_STATUS_OK) { | 195 if (status != GEOFENCING_STATUS_OK) { |
| 194 // Registration failed, remove from our book-keeping. | 196 // Registration failed, remove from our book-keeping. |
| 195 registrations_.erase(registration_iterator); | 197 registrations_.erase(registration_iterator); |
| 196 } | 198 } |
| 197 } | 199 } |
| 198 | 200 |
| 199 } // namespace content | 201 } // namespace content |
| OLD | NEW |