diff options
author | bartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-02 20:48:35 +0000 |
---|---|---|
committer | bartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-02 20:48:35 +0000 |
commit | 9fc4dabfb2dd3f2f7e9da2af8ae9f41b469e68f9 (patch) | |
tree | 3fd3f6a5d05d6c8755b8658a22de2b2a8acbfdd4 /content/renderer/geolocation_dispatcher.cc | |
parent | bfde7449259ccf84393fd6751fca30ea36eb0368 (diff) | |
download | chromium_src-9fc4dabfb2dd3f2f7e9da2af8ae9f41b469e68f9.zip chromium_src-9fc4dabfb2dd3f2f7e9da2af8ae9f41b469e68f9.tar.gz chromium_src-9fc4dabfb2dd3f2f7e9da2af8ae9f41b469e68f9.tar.bz2 |
Make the Geoposition helper struct public
This CL moves the Geoposition struct from content/common to public/content/common.h so that it can be shared by content and browser. The struct is placed in the |content| namespace and as required by the style guide, all methods except the constructor and Validate() are removed.
This paves the way for a follow-up CL in which the content will provide geolocation information to the browser.
BUG=chromium-os:22036
TEST=Chrome and tests build, run
Review URL: http://codereview.chromium.org/10316007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134989 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/geolocation_dispatcher.cc')
-rw-r--r-- | content/renderer/geolocation_dispatcher.cc | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/content/renderer/geolocation_dispatcher.cc b/content/renderer/geolocation_dispatcher.cc index d745ba4..9551a2f 100644 --- a/content/renderer/geolocation_dispatcher.cc +++ b/content/renderer/geolocation_dispatcher.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -112,35 +112,38 @@ void GeolocationDispatcher::OnPermissionSet(int bridge_id, bool is_allowed) { } // We have an updated geolocation position or error code. -void GeolocationDispatcher::OnPositionUpdated(const Geoposition& geoposition) { +void GeolocationDispatcher::OnPositionUpdated( + const content::Geoposition& geoposition) { // It is possible for the browser process to have queued an update message // before receiving the stop updating message. if (!updating_) return; - DCHECK(geoposition.IsInitialized()); - if (geoposition.IsValidFix()) { + if (geoposition.Validate()) { controller_->positionChanged( WebGeolocationPosition( geoposition.timestamp.ToDoubleT(), geoposition.latitude, geoposition.longitude, geoposition.accuracy, - geoposition.is_valid_altitude(), geoposition.altitude, - geoposition.is_valid_altitude_accuracy(), + // Lowest point on land is at approximately -400 meters. + geoposition.altitude > -10000., + geoposition.altitude, + geoposition.altitude_accuracy >= 0., geoposition.altitude_accuracy, - geoposition.is_valid_heading(), geoposition.heading, - geoposition.is_valid_speed(), geoposition.speed)); + geoposition.heading >= 0. && geoposition.heading <= 360., + geoposition.heading, + geoposition.speed >= 0., + geoposition.speed)); } else { WebGeolocationError::Error code; switch (geoposition.error_code) { - case Geoposition::ERROR_CODE_PERMISSION_DENIED: + case content::Geoposition::ERROR_CODE_PERMISSION_DENIED: code = WebGeolocationError::ErrorPermissionDenied; break; - case Geoposition::ERROR_CODE_POSITION_UNAVAILABLE: + case content::Geoposition::ERROR_CODE_POSITION_UNAVAILABLE: code = WebGeolocationError::ErrorPositionUnavailable; break; default: - DCHECK(false); NOTREACHED() << geoposition.error_code; return; } |