OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2010 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 CHROME_RENDERER_GEOLOCATION_DISPATCHER_H_ | |
6 #define CHROME_RENDERER_GEOLOCATION_DISPATCHER_H_ | |
7 #pragma once | |
8 | |
9 #if defined(ENABLE_CLIENT_BASED_GEOLOCATION) | |
10 | |
11 #include "base/scoped_ptr.h" | |
12 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationClient.h" | |
13 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationController.h" | |
14 | |
15 class RenderView; | |
16 struct Geoposition; | |
17 | |
18 namespace WebKit { | |
19 class WebGeolocationController; | |
20 class WebGeolocationPermissionRequest; | |
21 class WebGeolocationPermissionRequestManager; | |
22 class WebGeolocationPosition; | |
23 class WebSecurityOrigin; | |
24 } | |
25 | |
26 namespace IPC { | |
27 class Message; | |
28 } | |
29 | |
30 // GeolocationDispatcher is a delegate for Geolocation messages used by | |
31 // WebKit. | |
32 // It's the complement of GeolocationDispatcher (owned by RenderViewHost). | |
bulach
2010/12/13 14:49:50
s/GeolocationDispatcher/GeolocationDispatcherHost/
| |
33 class GeolocationDispatcher : public WebKit::WebGeolocationClient { | |
34 public: | |
35 explicit GeolocationDispatcher(RenderView* render_view); | |
36 virtual ~GeolocationDispatcher(); | |
37 | |
38 // IPC | |
39 bool OnMessageReceived(const IPC::Message& message); | |
40 | |
41 // WebGeolocationClient | |
42 virtual void geolocationDestroyed(); | |
43 virtual void startUpdating(); | |
44 virtual void stopUpdating(); | |
45 virtual void setEnableHighAccuracy(bool enable_high_accuracy); | |
46 virtual void setController(WebKit::WebGeolocationController* controller); | |
47 virtual bool lastPosition(WebKit::WebGeolocationPosition& position); | |
48 virtual void requestPermission( | |
49 const WebKit::WebGeolocationPermissionRequest& permissionRequest); | |
50 virtual void cancelPermissionRequest( | |
51 const WebKit::WebGeolocationPermissionRequest& permissionRequest); | |
52 | |
53 private: | |
54 // Permission for using geolocation has been set. | |
55 void OnGeolocationPermissionSet(int bridge_id, bool is_allowed); | |
56 | |
57 // We have an updated geolocation position or error code. | |
58 void OnGeolocationPositionUpdated(const Geoposition& geoposition); | |
59 | |
60 // GeolocationDispatcher is owned by RenderView. Back pointer for IPC. | |
61 RenderView* render_view_; | |
62 | |
63 // The controller_ is valid for the lifetime of the underlying | |
64 // WebCore::GeolocationController. geolocationDestroyed() is | |
65 // invoked when the underlying object is destroyed. | |
66 scoped_ptr< WebKit::WebGeolocationController> controller_; | |
67 | |
68 scoped_ptr<WebKit::WebGeolocationPermissionRequestManager> | |
69 pending_permissions_; | |
70 bool enable_high_accuracy_; | |
71 bool updating_; | |
72 }; | |
73 #endif // ENABLE_CLIENT_BASED_GEOLOCATION | |
74 | |
75 #endif // CHROME_RENDERER_GEOLOCATION_DISPATCHER_H_ | |
OLD | NEW |