summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/geolocation_dispatcher.cc
diff options
context:
space:
mode:
authorbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-18 19:33:11 +0000
committerbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-18 19:33:11 +0000
commit9384d383165e6e99e4430d9074a754ccebed34f9 (patch)
tree1dead35ee35b5b4119d713fe30f29586573d5b8e /chrome/renderer/geolocation_dispatcher.cc
parente989df19ef4bce3cd257ef77c19b0f3f4e1376bd (diff)
downloadchromium_src-9384d383165e6e99e4430d9074a754ccebed34f9.zip
chromium_src-9384d383165e6e99e4430d9074a754ccebed34f9.tar.gz
chromium_src-9384d383165e6e99e4430d9074a754ccebed34f9.tar.bz2
Revert 39366 - Initial Geolocation implementation
Adds IPC plumbing. Adds Infobar buttons for requesting permission TEST=geolocation_browsertest.cc Review URL: http://codereview.chromium.org/548188 TBR=bulach@chromium.org Review URL: http://codereview.chromium.org/646027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39374 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/geolocation_dispatcher.cc')
-rw-r--r--chrome/renderer/geolocation_dispatcher.cc104
1 files changed, 0 insertions, 104 deletions
diff --git a/chrome/renderer/geolocation_dispatcher.cc b/chrome/renderer/geolocation_dispatcher.cc
deleted file mode 100644
index fedad06..0000000
--- a/chrome/renderer/geolocation_dispatcher.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-// 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.
-
-#include "chrome/renderer/geolocation_dispatcher.h"
-
-#include "base/command_line.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/renderer/render_view.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebCString.h"
-
-using WebKit::WebFrame;
-
-GeolocationDispatcher::GeolocationDispatcher(RenderView* render_view)
- : render_view_(render_view) {
- render_view_->Send(new ViewHostMsg_Geolocation_RegisterDispatcher(
- render_view_->routing_id()));
-}
-
-GeolocationDispatcher::~GeolocationDispatcher() {
- render_view_->Send(new ViewHostMsg_Geolocation_UnregisterDispatcher(
- render_view_->routing_id()));
-}
-
-bool GeolocationDispatcher::OnMessageReceived(const IPC::Message& message) {
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(GeolocationDispatcher, message)
- IPC_MESSAGE_HANDLER(ViewMsg_Geolocation_PermissionSet,
- OnGeolocationPermissionSet)
- IPC_MESSAGE_HANDLER(ViewMsg_Geolocation_PositionUpdated,
- OnGeolocationPositionUpdated)
- IPC_MESSAGE_HANDLER(ViewMsg_Geolocation_Error, OnGeolocationError)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
-}
-
-void GeolocationDispatcher::requestPermissionForFrame(
- int bridge_id, const WebKit::WebURL& url) {
- render_view_->Send(new ViewHostMsg_Geolocation_RequestPermission(
- bridge_id, render_view_->routing_id(), GURL(url).GetOrigin()));
-}
-
-void GeolocationDispatcher::startUpdating(int bridge_id, bool hasHighAccuracy) {
- render_view_->Send(new ViewHostMsg_Geolocation_StartUpdating(
- bridge_id, render_view_->routing_id(), hasHighAccuracy));
-}
-
-void GeolocationDispatcher::stopUpdating(int bridge_id) {
- render_view_->Send(new ViewHostMsg_Geolocation_StopUpdating(
- bridge_id, render_view_->routing_id()));
-}
-
-void GeolocationDispatcher::suspend(int bridge_id) {
- render_view_->Send(new ViewHostMsg_Geolocation_Suspend(
- bridge_id, render_view_->routing_id()));
-}
-
-void GeolocationDispatcher::resume(int bridge_id) {
- render_view_->Send(new ViewHostMsg_Geolocation_Resume(
- bridge_id, render_view_->routing_id()));
-}
-
-int GeolocationDispatcher::attachBridge(
- WebKit::WebGeolocationServiceBridge* bridge) {
- return bridges_map_.Add(bridge);
-}
-
-void GeolocationDispatcher::dettachBridge(int bridge_id) {
- bridges_map_.Remove(bridge_id);
-}
-
-void GeolocationDispatcher::OnGeolocationPermissionSet(int bridge_id,
- bool allowed) {
- WebKit::WebGeolocationServiceBridge* bridge = bridges_map_.Lookup(bridge_id);
- if (bridge) {
- bridge->setIsAllowed(allowed);
- }
-}
-
-void GeolocationDispatcher::OnGeolocationPositionUpdated(
- const Geoposition& geoposition) {
- for (IDMap<WebKit::WebGeolocationServiceBridge>::iterator it(&bridges_map_);
- !it.IsAtEnd(); it.Advance()) {
- it.GetCurrentValue()->setLastPosition(
- geoposition.latitude, geoposition.longitude,
- geoposition.is_valid_altitude(), geoposition.altitude,
- geoposition.accuracy,
- geoposition.is_valid_altitude_accuracy(), geoposition.altitude_accuracy,
- geoposition.is_valid_heading(), geoposition.heading,
- geoposition.is_valid_speed(), geoposition.speed,
- geoposition.timestamp);
- }
-}
-
-void GeolocationDispatcher::OnGeolocationError(int code,
- const std::string& message) {
- for (IDMap<WebKit::WebGeolocationServiceBridge>::iterator it(&bridges_map_);
- !it.IsAtEnd(); it.Advance()) {
- it.GetCurrentValue()->setLastError(
- code, WebKit::WebString::fromUTF8(message));
- }
-}