| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 int bridge_id, bool is_allowed) { | 106 int bridge_id, bool is_allowed) { |
| 107 WebGeolocationPermissionRequest permissionRequest; | 107 WebGeolocationPermissionRequest permissionRequest; |
| 108 if (!pending_permissions_->remove(bridge_id, permissionRequest)) | 108 if (!pending_permissions_->remove(bridge_id, permissionRequest)) |
| 109 return; | 109 return; |
| 110 permissionRequest.setIsAllowed(is_allowed); | 110 permissionRequest.setIsAllowed(is_allowed); |
| 111 } | 111 } |
| 112 | 112 |
| 113 // We have an updated geolocation position or error code. | 113 // We have an updated geolocation position or error code. |
| 114 void GeolocationDispatcher::OnGeolocationPositionUpdated( | 114 void GeolocationDispatcher::OnGeolocationPositionUpdated( |
| 115 const Geoposition& geoposition) { | 115 const Geoposition& geoposition) { |
| 116 DCHECK(updating_); | 116 // It is possible for the browser process to have queued an update message |
| 117 // before receiving the stop updating message. |
| 118 if (!updating_) |
| 119 return; |
| 120 |
| 117 DCHECK(geoposition.IsInitialized()); | 121 DCHECK(geoposition.IsInitialized()); |
| 118 if (geoposition.IsValidFix()) { | 122 if (geoposition.IsValidFix()) { |
| 119 controller_->positionChanged( | 123 controller_->positionChanged( |
| 120 WebGeolocationPosition( | 124 WebGeolocationPosition( |
| 121 geoposition.timestamp.ToDoubleT() * 1000.0, | 125 geoposition.timestamp.ToDoubleT() * 1000.0, |
| 122 geoposition.latitude, geoposition.longitude, | 126 geoposition.latitude, geoposition.longitude, |
| 123 geoposition.accuracy, | 127 geoposition.accuracy, |
| 124 geoposition.is_valid_altitude(), geoposition.altitude, | 128 geoposition.is_valid_altitude(), geoposition.altitude, |
| 125 geoposition.is_valid_altitude_accuracy(), | 129 geoposition.is_valid_altitude_accuracy(), |
| 126 geoposition.altitude_accuracy, | 130 geoposition.altitude_accuracy, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 138 default: | 142 default: |
| 139 DCHECK(false); | 143 DCHECK(false); |
| 140 NOTREACHED() << geoposition.error_code; | 144 NOTREACHED() << geoposition.error_code; |
| 141 return; | 145 return; |
| 142 } | 146 } |
| 143 controller_->errorOccurred( | 147 controller_->errorOccurred( |
| 144 WebGeolocationError( | 148 WebGeolocationError( |
| 145 code, WebKit::WebString::fromUTF8(geoposition.error_message))); | 149 code, WebKit::WebString::fromUTF8(geoposition.error_message))); |
| 146 } | 150 } |
| 147 } | 151 } |
| OLD | NEW |