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