Roll src/third_party/skia ff271c2:b679ca8
[chromium-blink-merge.git] / content / renderer / geolocation_dispatcher.h
blob391e65d105d264a9d96ab27f620163c545ef6965
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.
5 #ifndef CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_
6 #define CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/common/geolocation_service.mojom.h"
10 #include "content/common/permission_service.mojom.h"
11 #include "content/public/renderer/render_frame_observer.h"
12 #include "third_party/WebKit/public/web/WebGeolocationClient.h"
13 #include "third_party/WebKit/public/web/WebGeolocationController.h"
15 namespace blink {
16 class WebGeolocationController;
17 class WebGeolocationPermissionRequest;
18 class WebGeolocationPermissionRequestManager;
19 class WebGeolocationPosition;
22 namespace content {
23 struct Geoposition;
25 // GeolocationDispatcher is a delegate for Geolocation messages used by
26 // WebKit.
27 // It's the complement of GeolocationDispatcherHost.
28 class GeolocationDispatcher
29 : public RenderFrameObserver,
30 public blink::WebGeolocationClient {
31 public:
32 explicit GeolocationDispatcher(RenderFrame* render_frame);
33 virtual ~GeolocationDispatcher();
35 private:
36 // WebGeolocationClient
37 virtual void startUpdating();
38 virtual void stopUpdating();
39 virtual void setEnableHighAccuracy(bool enable_high_accuracy);
40 virtual void setController(blink::WebGeolocationController* controller);
41 virtual bool lastPosition(blink::WebGeolocationPosition& position);
42 virtual void requestPermission(
43 const blink::WebGeolocationPermissionRequest& permissionRequest);
44 virtual void cancelPermissionRequest(
45 const blink::WebGeolocationPermissionRequest& permissionRequest);
47 void QueryNextPosition();
48 void OnPositionUpdate(MojoGeopositionPtr geoposition);
50 // Permission for using geolocation has been set.
51 void OnPermissionSet(int permission_request_id, PermissionStatus status);
53 scoped_ptr<blink::WebGeolocationController> controller_;
55 scoped_ptr<blink::WebGeolocationPermissionRequestManager>
56 pending_permissions_;
57 GeolocationServicePtr geolocation_service_;
58 bool enable_high_accuracy_;
59 PermissionServicePtr permission_service_;
62 } // namespace content
64 #endif // CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_