| 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 "chrome/renderer/render_view.h" | 7 #include "chrome/renderer/render_view.h" |
| 8 #include "ipc/ipc_message.h" | 8 #include "ipc/ipc_message.h" |
| 9 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationPermissionRequ
est.h" | 9 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationPermissionRequ
est.h" |
| 10 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationPermissionRequ
estManager.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationPermissionRequ
estManager.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 IPC_END_MESSAGE_MAP() | 35 IPC_END_MESSAGE_MAP() |
| 36 return handled; | 36 return handled; |
| 37 } | 37 } |
| 38 | 38 |
| 39 void GeolocationDispatcher::geolocationDestroyed() { | 39 void GeolocationDispatcher::geolocationDestroyed() { |
| 40 controller_.reset(); | 40 controller_.reset(); |
| 41 DCHECK(!updating_); | 41 DCHECK(!updating_); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void GeolocationDispatcher::startUpdating() { | 44 void GeolocationDispatcher::startUpdating() { |
| 45 // TODO(jknotten): Remove url and bridge_id from StartUpdating message | |
| 46 // once we have switched over to client-based geolocation. | |
| 47 GURL url; | 45 GURL url; |
| 48 render_view_->Send(new ViewHostMsg_Geolocation_StartUpdating( | 46 render_view_->Send(new ViewHostMsg_Geolocation_StartUpdating( |
| 49 render_view_->routing_id(), -1, url, enable_high_accuracy_)); | 47 render_view_->routing_id(), url, enable_high_accuracy_)); |
| 50 updating_ = true; | 48 updating_ = true; |
| 51 } | 49 } |
| 52 | 50 |
| 53 void GeolocationDispatcher::stopUpdating() { | 51 void GeolocationDispatcher::stopUpdating() { |
| 54 // TODO(jknotten): Remove url and bridge_id from StopUpdating message | |
| 55 // once we have switched over to client-based geolocation. | |
| 56 render_view_->Send(new ViewHostMsg_Geolocation_StopUpdating( | 52 render_view_->Send(new ViewHostMsg_Geolocation_StopUpdating( |
| 57 render_view_->routing_id(), -1)); | 53 render_view_->routing_id())); |
| 58 updating_ = false; | 54 updating_ = false; |
| 59 } | 55 } |
| 60 | 56 |
| 61 void GeolocationDispatcher::setEnableHighAccuracy(bool enable_high_accuracy) { | 57 void GeolocationDispatcher::setEnableHighAccuracy(bool enable_high_accuracy) { |
| 62 // GeolocationController calls setEnableHighAccuracy(true) before | 58 // GeolocationController calls setEnableHighAccuracy(true) before |
| 63 // startUpdating in response to the first high-accuracy Geolocation | 59 // startUpdating in response to the first high-accuracy Geolocation |
| 64 // subscription. When the last high-accuracy Geolocation unsubscribes | 60 // subscription. When the last high-accuracy Geolocation unsubscribes |
| 65 // it calls setEnableHighAccuracy(false) after stopUpdating. | 61 // it calls setEnableHighAccuracy(false) after stopUpdating. |
| 66 bool has_changed = enable_high_accuracy_ != enable_high_accuracy; | 62 bool has_changed = enable_high_accuracy_ != enable_high_accuracy; |
| 67 enable_high_accuracy_ = enable_high_accuracy; | 63 enable_high_accuracy_ = enable_high_accuracy; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 default: | 138 default: |
| 143 DCHECK(false); | 139 DCHECK(false); |
| 144 NOTREACHED() << geoposition.error_code; | 140 NOTREACHED() << geoposition.error_code; |
| 145 return; | 141 return; |
| 146 } | 142 } |
| 147 controller_->errorOccurred( | 143 controller_->errorOccurred( |
| 148 WebGeolocationError( | 144 WebGeolocationError( |
| 149 code, WebKit::WebString::fromUTF8(geoposition.error_message))); | 145 code, WebKit::WebString::fromUTF8(geoposition.error_message))); |
| 150 } | 146 } |
| 151 } | 147 } |
| OLD | NEW |