| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_ | |
| 6 #define CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "content/public/renderer/render_frame_observer.h" | |
| 11 #include "third_party/WebKit/public/platform/modules/geolocation/geolocation.moj
om.h" | |
| 12 #include "third_party/WebKit/public/platform/modules/permissions/permission.mojo
m.h" | |
| 13 #include "third_party/WebKit/public/web/WebGeolocationClient.h" | |
| 14 #include "third_party/WebKit/public/web/WebGeolocationController.h" | |
| 15 | |
| 16 namespace blink { | |
| 17 class WebGeolocationController; | |
| 18 class WebGeolocationPermissionRequest; | |
| 19 class WebGeolocationPermissionRequestManager; | |
| 20 class WebGeolocationPosition; | |
| 21 } | |
| 22 | |
| 23 namespace content { | |
| 24 struct Geoposition; | |
| 25 | |
| 26 // GeolocationDispatcher is a delegate for Geolocation messages used by | |
| 27 // WebKit. | |
| 28 // It's the complement of GeolocationDispatcherHost. | |
| 29 class GeolocationDispatcher | |
| 30 : public RenderFrameObserver, | |
| 31 public blink::WebGeolocationClient { | |
| 32 public: | |
| 33 explicit GeolocationDispatcher(RenderFrame* render_frame); | |
| 34 ~GeolocationDispatcher() override; | |
| 35 | |
| 36 private: | |
| 37 // WebGeolocationClient | |
| 38 void startUpdating() override; | |
| 39 void stopUpdating() override; | |
| 40 void setEnableHighAccuracy(bool enable_high_accuracy) override; | |
| 41 void setController(blink::WebGeolocationController* controller) override; | |
| 42 bool lastPosition(blink::WebGeolocationPosition& position) override; | |
| 43 void requestPermission( | |
| 44 const blink::WebGeolocationPermissionRequest& permissionRequest) override; | |
| 45 void cancelPermissionRequest( | |
| 46 const blink::WebGeolocationPermissionRequest& permissionRequest) override; | |
| 47 | |
| 48 void QueryNextPosition(); | |
| 49 void OnPositionUpdate(blink::mojom::GeopositionPtr geoposition); | |
| 50 | |
| 51 // Permission for using geolocation has been set. | |
| 52 void OnPermissionSet(int permission_request_id, | |
| 53 blink::mojom::PermissionStatus status); | |
| 54 | |
| 55 std::unique_ptr<blink::WebGeolocationController> controller_; | |
| 56 | |
| 57 size_t num_pending_permission_requests_ = 0; | |
| 58 std::unique_ptr<blink::WebGeolocationPermissionRequestManager> | |
| 59 pending_permissions_; | |
| 60 blink::mojom::GeolocationServicePtr geolocation_service_; | |
| 61 bool enable_high_accuracy_; | |
| 62 blink::mojom::PermissionServicePtr permission_service_; | |
| 63 }; | |
| 64 | |
| 65 } // namespace content | |
| 66 | |
| 67 #endif // CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_ | |
| OLD | NEW |