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_OLD_H_ | |
6 #define CHROME_RENDERER_GEOLOCATION_DISPATCHER_OLD_H_ | |
7 #pragma once | |
8 | |
9 #if !defined(ENABLE_CLIENT_BASED_GEOLOCATION) | |
10 // TODO(jknotten): Remove this class once the new client-based implementation is | |
11 // checked in (see http://crbug.com/59908). | |
12 | |
13 #include "base/basictypes.h" | |
14 #include "base/id_map.h" | |
15 #include "ipc/ipc_channel.h" | |
16 #include "googleurl/src/gurl.h" | |
17 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationService.h" | |
18 | |
19 class GURL; | |
20 class RenderView; | |
21 struct Geoposition; | |
22 | |
23 // GeolocationDispatcherOld is a delegate for Geolocation messages used by | |
24 // WebKit. | |
25 // It's the complement of GeolocationDispatcherHostOld (owned by | |
26 // RenderViewHost). | |
27 | |
28 class GeolocationDispatcherOld : public WebKit::WebGeolocationService, | |
29 public IPC::Channel::Listener { | |
30 public: | |
31 explicit GeolocationDispatcherOld(RenderView* render_view); | |
32 virtual ~GeolocationDispatcherOld(); | |
33 | |
34 // IPC::Channel::Listener implementation | |
35 bool OnMessageReceived(const IPC::Message& msg); | |
36 | |
37 // WebKit::WebGeolocationService. | |
38 virtual void requestPermissionForFrame(int bridge_id, | |
39 const WebKit::WebURL& url); | |
40 virtual void cancelPermissionRequestForFrame( | |
41 int bridge_id, const WebKit::WebURL& url); | |
42 virtual void startUpdating( | |
43 int bridge_id, const WebKit::WebURL& url, bool enableHighAccuracy); | |
44 virtual void stopUpdating(int bridge_id); | |
45 virtual void suspend(int bridge_id); | |
46 virtual void resume(int bridge_id); | |
47 virtual int attachBridge( | |
48 WebKit::WebGeolocationServiceBridge* geolocation_service); | |
49 virtual void detachBridge(int bridge_id); | |
50 | |
51 private: | |
52 // Permission for using geolocation has been set. | |
53 void OnGeolocationPermissionSet(int bridge_id, bool is_allowed); | |
54 | |
55 // We have an updated geolocation position or error code. | |
56 void OnGeolocationPositionUpdated(const Geoposition& geoposition); | |
57 | |
58 RenderView* render_view_; | |
59 | |
60 // The geolocation services attached to this dispatcher. | |
61 IDMap<WebKit::WebGeolocationServiceBridge> bridges_map_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(GeolocationDispatcherOld); | |
64 }; | |
65 | |
66 #endif // ENABLE_CLIENT_BASED_GEOLOCATION | |
67 | |
68 #endif // CHROME_RENDERER_GEOLOCATION_DISPATCHER_OLD_H_ | |
OLD | NEW |