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