cc: Make picture pile base thread safe.
[chromium-blink-merge.git] / content / renderer / geolocation_dispatcher.h
blob53fa1514e26f25a500dd0ba9590a1e78d387eed0
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/public/renderer/render_frame_observer.h"
10 #include "third_party/WebKit/public/web/WebGeolocationClient.h"
11 #include "third_party/WebKit/public/web/WebGeolocationController.h"
13 namespace blink {
14 class WebGeolocationController;
15 class WebGeolocationPermissionRequest;
16 class WebGeolocationPermissionRequestManager;
17 class WebGeolocationPosition;
20 namespace content {
21 struct Geoposition;
23 // GeolocationDispatcher is a delegate for Geolocation messages used by
24 // WebKit.
25 // It's the complement of GeolocationDispatcherHost.
26 class GeolocationDispatcher : public RenderFrameObserver,
27 public blink::WebGeolocationClient {
28 public:
29 explicit GeolocationDispatcher(RenderFrame* render_frame);
30 virtual ~GeolocationDispatcher();
32 private:
33 // RenderFrame::Observer implementation.
34 bool OnMessageReceived(const IPC::Message& message) override;
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 // Permission for using geolocation has been set.
48 void OnPermissionSet(int bridge_id, bool is_allowed);
50 // We have an updated geolocation position or error code.
51 void OnPositionUpdated(const content::Geoposition& geoposition);
53 scoped_ptr<blink::WebGeolocationController> controller_;
55 scoped_ptr<blink::WebGeolocationPermissionRequestManager>
56 pending_permissions_;
57 bool enable_high_accuracy_;
58 bool updating_;
61 } // namespace content
63 #endif // CONTENT_RENDERER_GEOLOCATION_DISPATCHER_H_