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 #ifndef CONTENT_CHILD_GEOFENCING_GEOFENCING_DISPATCHER_H_ | 5 #ifndef CONTENT_CHILD_GEOFENCING_GEOFENCING_DISPATCHER_H_ |
6 #define CONTENT_CHILD_GEOFENCING_GEOFENCING_DISPATCHER_H_ | 6 #define CONTENT_CHILD_GEOFENCING_GEOFENCING_DISPATCHER_H_ |
7 | 7 |
8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "content/child/worker_task_runner.h" | 11 #include "content/child/worker_task_runner.h" |
12 #include "content/common/geofencing_status.h" | 12 #include "content/common/geofencing_status.h" |
13 #include "third_party/WebKit/public/platform/WebGeofencingProvider.h" | 13 #include "third_party/WebKit/public/platform/WebGeofencingProvider.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class MessageLoop; | 16 class MessageLoop; |
17 class TaskRunner; | 17 class TaskRunner; |
18 } | 18 } |
19 | 19 |
20 namespace IPC { | 20 namespace IPC { |
21 class Message; | 21 class Message; |
22 } | 22 } |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 class ThreadSafeSender; | 25 class ThreadSafeSender; |
26 | 26 |
27 class GeofencingDispatcher : public WorkerTaskRunner::Observer { | 27 class GeofencingDispatcher : public WorkerTaskRunner::Observer { |
28 public: | 28 public: |
29 explicit GeofencingDispatcher(ThreadSafeSender* sender); | 29 explicit GeofencingDispatcher(ThreadSafeSender* sender); |
30 virtual ~GeofencingDispatcher(); | 30 ~GeofencingDispatcher() override; |
31 | 31 |
32 bool Send(IPC::Message* msg); | 32 bool Send(IPC::Message* msg); |
33 void OnMessageReceived(const IPC::Message& msg); | 33 void OnMessageReceived(const IPC::Message& msg); |
34 | 34 |
35 // Corresponding to WebGeofencingProvider methods. | 35 // Corresponding to WebGeofencingProvider methods. |
36 void RegisterRegion(const blink::WebString& region_id, | 36 void RegisterRegion(const blink::WebString& region_id, |
37 const blink::WebCircularGeofencingRegion& region, | 37 const blink::WebCircularGeofencingRegion& region, |
38 blink::WebGeofencingCallbacks* callbacks); | 38 blink::WebGeofencingCallbacks* callbacks); |
39 void UnregisterRegion(const blink::WebString& region_id, | 39 void UnregisterRegion(const blink::WebString& region_id, |
40 blink::WebGeofencingCallbacks* callbacks); | 40 blink::WebGeofencingCallbacks* callbacks); |
(...skipping 15 matching lines...) Expand all Loading... |
56 void OnUnregisterRegionComplete(int thread_id, | 56 void OnUnregisterRegionComplete(int thread_id, |
57 int request_id, | 57 int request_id, |
58 GeofencingStatus status); | 58 GeofencingStatus status); |
59 void OnGetRegisteredRegionsComplete( | 59 void OnGetRegisteredRegionsComplete( |
60 int thread_id, | 60 int thread_id, |
61 int request_id, | 61 int request_id, |
62 GeofencingStatus status, | 62 GeofencingStatus status, |
63 const std::map<std::string, blink::WebCircularGeofencingRegion>& regions); | 63 const std::map<std::string, blink::WebCircularGeofencingRegion>& regions); |
64 | 64 |
65 // WorkerTaskRunner::Observer implementation. | 65 // WorkerTaskRunner::Observer implementation. |
66 virtual void OnWorkerRunLoopStopped() override; | 66 void OnWorkerRunLoopStopped() override; |
67 | 67 |
68 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 68 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
69 IDMap<blink::WebGeofencingCallbacks, IDMapOwnPointer> | 69 IDMap<blink::WebGeofencingCallbacks, IDMapOwnPointer> |
70 region_registration_requests_; | 70 region_registration_requests_; |
71 IDMap<blink::WebGeofencingCallbacks, IDMapOwnPointer> | 71 IDMap<blink::WebGeofencingCallbacks, IDMapOwnPointer> |
72 region_unregistration_requests_; | 72 region_unregistration_requests_; |
73 IDMap<blink::WebGeofencingRegionsCallbacks, IDMapOwnPointer> | 73 IDMap<blink::WebGeofencingRegionsCallbacks, IDMapOwnPointer> |
74 get_registered_regions_requests_; | 74 get_registered_regions_requests_; |
75 | 75 |
76 DISALLOW_COPY_AND_ASSIGN(GeofencingDispatcher); | 76 DISALLOW_COPY_AND_ASSIGN(GeofencingDispatcher); |
77 }; | 77 }; |
78 | 78 |
79 } // namespace content | 79 } // namespace content |
80 | 80 |
81 #endif // CONTENT_CHILD_GEOFENCING_GEOFENCING_DISPATCHER_H_ | 81 #endif // CONTENT_CHILD_GEOFENCING_GEOFENCING_DISPATCHER_H_ |
OLD | NEW |