blob: d2a71400fd5047e76ccff3cf08751172b9012f75 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_RENDERER_GEOLOCATION_DISPATCHER_H_
#define CHROME_RENDERER_GEOLOCATION_DISPATCHER_H_
#include "base/basictypes.h"
#include "base/id_map.h"
#include "ipc/ipc_message.h"
#include "googleurl/src/gurl.h"
#include "third_party/WebKit/WebKit/chromium/public/GeolocationServiceBridgeChromium.h"
class GURL;
class RenderView;
struct Geoposition;
// GeolocationDispatcher is a delegate for Geolocation messages used by
// WebKit.
// It's the complement of GeolocationDispatcherHost (owned by RenderViewHost).
class GeolocationDispatcher : public WebKit::WebGeolocationServiceInterface {
public:
explicit GeolocationDispatcher(RenderView* render_view);
virtual ~GeolocationDispatcher();
// Called to possibly handle the incoming IPC message. Returns true if
// handled. Called in render thread.
bool OnMessageReceived(const IPC::Message& msg);
// WebKit::GeolocationServiceInterfaceChromium.
void requestPermissionForFrame(int bridge_id, const WebKit::WebURL& url);
// TODO(bulach): remove this method once we roll:
// https://bugs.webkit.org/show_bug.cgi?id=36012.
void startUpdating(int bridge_id, bool enableHighAccuracy);
void startUpdating(
int bridge_id, const WebKit::WebURL& url, bool enableHighAccuracy);
void stopUpdating(int bridge_id);
void suspend(int bridge_id);
void resume(int bridge_id);
int attachBridge(WebKit::WebGeolocationServiceBridge* geolocation_service);
void dettachBridge(int bridge_id);
private:
// Permission for using geolocation has been set.
void OnGeolocationPermissionSet(int bridge_id, bool is_allowed);
// We have an updated geolocation position.
void OnGeolocationPositionUpdated(const Geoposition& geoposition);
// An error has happened when fetching a geolocation position.
void OnGeolocationError(int code, const std::string& message);
RenderView* render_view_;
// The geolocation services attached to this dispatcher.
IDMap<WebKit::WebGeolocationServiceBridge> bridges_map_;
DISALLOW_COPY_AND_ASSIGN(GeolocationDispatcher);
};
#endif // CHROME_RENDERER_GEOLOCATION_DISPATCHER_H_
|