summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/geolocation_dispatcher.h
diff options
context:
space:
mode:
authorbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-19 12:11:28 +0000
committerbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-19 12:11:28 +0000
commit58c321dd57a1fc00c2c51b0a8b6e547fdf32aa74 (patch)
treecdd273a38ba1b449952d5701e6ceb6f46142c073 /chrome/renderer/geolocation_dispatcher.h
parent2375d294b30e5d0b0bc63d26a417203959ef32af (diff)
downloadchromium_src-58c321dd57a1fc00c2c51b0a8b6e547fdf32aa74.zip
chromium_src-58c321dd57a1fc00c2c51b0a8b6e547fdf32aa74.tar.gz
chromium_src-58c321dd57a1fc00c2c51b0a8b6e547fdf32aa74.tar.bz2
Second try for:
http://src.chromium.org/viewvc/chrome?view=rev&revision=39374 Initial Geolocation implementation Adds IPC plumbing. Adds Infobar buttons for requesting permission This change specifically: ui_test_utils::WaitForAppModalDialog registers for listening to notifications too late, i.e., after the dialog had been triggered. Exposes AppModalDialogObserver so that we can register, trigger the dialog, then wait for it. Review URL: http://codereview.chromium.org/647048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/geolocation_dispatcher.h')
-rw-r--r--chrome/renderer/geolocation_dispatcher.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/chrome/renderer/geolocation_dispatcher.h b/chrome/renderer/geolocation_dispatcher.h
new file mode 100644
index 0000000..31fdab4c
--- /dev/null
+++ b/chrome/renderer/geolocation_dispatcher.h
@@ -0,0 +1,57 @@
+// 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 "chrome/common/geoposition.h"
+#include "ipc/ipc_message.h"
+#include "googleurl/src/gurl.h"
+#include "third_party/WebKit/WebKit/chromium/public/GeolocationServiceBridgeChromium.h"
+
+class GURL;
+class RenderView;
+
+// 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);
+ void startUpdating(int bridge_id, bool hasHighAccuracy);
+ 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_