| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/renderer/geolocation_dispatcher.h" | 5 #include "chrome/renderer/geolocation_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/renderer/render_view.h" | 9 #include "chrome/renderer/render_view.h" |
| 10 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 OnGeolocationPositionUpdated) | 32 OnGeolocationPositionUpdated) |
| 33 IPC_MESSAGE_HANDLER(ViewMsg_Geolocation_Error, OnGeolocationError) | 33 IPC_MESSAGE_HANDLER(ViewMsg_Geolocation_Error, OnGeolocationError) |
| 34 IPC_MESSAGE_UNHANDLED(handled = false) | 34 IPC_MESSAGE_UNHANDLED(handled = false) |
| 35 IPC_END_MESSAGE_MAP() | 35 IPC_END_MESSAGE_MAP() |
| 36 return handled; | 36 return handled; |
| 37 } | 37 } |
| 38 | 38 |
| 39 void GeolocationDispatcher::requestPermissionForFrame( | 39 void GeolocationDispatcher::requestPermissionForFrame( |
| 40 int bridge_id, const WebKit::WebURL& url) { | 40 int bridge_id, const WebKit::WebURL& url) { |
| 41 render_view_->Send(new ViewHostMsg_Geolocation_RequestPermission( | 41 render_view_->Send(new ViewHostMsg_Geolocation_RequestPermission( |
| 42 bridge_id, render_view_->routing_id(), GURL(url).GetOrigin())); | 42 render_view_->routing_id(), bridge_id, GURL(url).GetOrigin())); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void GeolocationDispatcher::startUpdating(int bridge_id, bool hasHighAccuracy) { | 45 void GeolocationDispatcher::startUpdating(int bridge_id, bool hasHighAccuracy) { |
| 46 render_view_->Send(new ViewHostMsg_Geolocation_StartUpdating( | 46 render_view_->Send(new ViewHostMsg_Geolocation_StartUpdating( |
| 47 bridge_id, render_view_->routing_id(), hasHighAccuracy)); | 47 render_view_->routing_id(), bridge_id, hasHighAccuracy)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void GeolocationDispatcher::stopUpdating(int bridge_id) { | 50 void GeolocationDispatcher::stopUpdating(int bridge_id) { |
| 51 render_view_->Send(new ViewHostMsg_Geolocation_StopUpdating( | 51 render_view_->Send(new ViewHostMsg_Geolocation_StopUpdating( |
| 52 bridge_id, render_view_->routing_id())); | 52 render_view_->routing_id(), bridge_id)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void GeolocationDispatcher::suspend(int bridge_id) { | 55 void GeolocationDispatcher::suspend(int bridge_id) { |
| 56 render_view_->Send(new ViewHostMsg_Geolocation_Suspend( | 56 render_view_->Send(new ViewHostMsg_Geolocation_Suspend( |
| 57 bridge_id, render_view_->routing_id())); | 57 render_view_->routing_id(), bridge_id)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void GeolocationDispatcher::resume(int bridge_id) { | 60 void GeolocationDispatcher::resume(int bridge_id) { |
| 61 render_view_->Send(new ViewHostMsg_Geolocation_Resume( | 61 render_view_->Send(new ViewHostMsg_Geolocation_Resume( |
| 62 bridge_id, render_view_->routing_id())); | 62 render_view_->routing_id(), bridge_id)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 int GeolocationDispatcher::attachBridge( | 65 int GeolocationDispatcher::attachBridge( |
| 66 WebKit::WebGeolocationServiceBridge* bridge) { | 66 WebKit::WebGeolocationServiceBridge* bridge) { |
| 67 return bridges_map_.Add(bridge); | 67 return bridges_map_.Add(bridge); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void GeolocationDispatcher::dettachBridge(int bridge_id) { | 70 void GeolocationDispatcher::dettachBridge(int bridge_id) { |
| 71 bridges_map_.Remove(bridge_id); | 71 bridges_map_.Remove(bridge_id); |
| 72 } | 72 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 95 } | 95 } |
| 96 | 96 |
| 97 void GeolocationDispatcher::OnGeolocationError(int code, | 97 void GeolocationDispatcher::OnGeolocationError(int code, |
| 98 const std::string& message) { | 98 const std::string& message) { |
| 99 for (IDMap<WebKit::WebGeolocationServiceBridge>::iterator it(&bridges_map_); | 99 for (IDMap<WebKit::WebGeolocationServiceBridge>::iterator it(&bridges_map_); |
| 100 !it.IsAtEnd(); it.Advance()) { | 100 !it.IsAtEnd(); it.Advance()) { |
| 101 it.GetCurrentValue()->setLastError( | 101 it.GetCurrentValue()->setLastError( |
| 102 code, WebKit::WebString::fromUTF8(message)); | 102 code, WebKit::WebString::fromUTF8(message)); |
| 103 } | 103 } |
| 104 } | 104 } |
| OLD | NEW |