| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/geolocation/gps_location_provider_linux.h" | 5 #include "content/browser/geolocation/gps_location_provider_linux.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 void GpsLocationProviderLinux::GetPosition(Geoposition* position) { | 84 void GpsLocationProviderLinux::GetPosition(Geoposition* position) { |
| 85 DCHECK(position); | 85 DCHECK(position); |
| 86 *position = position_; | 86 *position = position_; |
| 87 DCHECK(position->IsInitialized()); | 87 DCHECK(position->IsInitialized()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void GpsLocationProviderLinux::UpdatePosition() { | 90 void GpsLocationProviderLinux::UpdatePosition() { |
| 91 ScheduleNextGpsPoll(0); | 91 ScheduleNextGpsPoll(0); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void GpsLocationProviderLinux::OnPermissionGranted( | |
| 95 const GURL& requesting_frame) { | |
| 96 } | |
| 97 | |
| 98 void GpsLocationProviderLinux::DoGpsPollTask() { | 94 void GpsLocationProviderLinux::DoGpsPollTask() { |
| 99 if (!gps_->Start()) { | 95 if (!gps_->Start()) { |
| 100 DLOG(WARNING) << "Couldn't start GPS provider."; | 96 DLOG(WARNING) << "Couldn't start GPS provider."; |
| 101 ScheduleNextGpsPoll(gpsd_reconnect_interval_millis_); | 97 ScheduleNextGpsPoll(gpsd_reconnect_interval_millis_); |
| 102 return; | 98 return; |
| 103 } | 99 } |
| 104 | 100 |
| 105 Geoposition new_position; | 101 Geoposition new_position; |
| 106 if (!gps_->Read(&new_position)) { | 102 if (!gps_->Read(&new_position)) { |
| 107 ScheduleNextGpsPoll(poll_period_stationary_millis_); | 103 ScheduleNextGpsPoll(poll_period_stationary_millis_); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 124 MessageLoop::current()->PostDelayedTask( | 120 MessageLoop::current()->PostDelayedTask( |
| 125 FROM_HERE, | 121 FROM_HERE, |
| 126 base::Bind(&GpsLocationProviderLinux::DoGpsPollTask, | 122 base::Bind(&GpsLocationProviderLinux::DoGpsPollTask, |
| 127 weak_factory_.GetWeakPtr()), | 123 weak_factory_.GetWeakPtr()), |
| 128 base::TimeDelta::FromMilliseconds(interval)); | 124 base::TimeDelta::FromMilliseconds(interval)); |
| 129 } | 125 } |
| 130 | 126 |
| 131 LocationProviderBase* NewSystemLocationProvider() { | 127 LocationProviderBase* NewSystemLocationProvider() { |
| 132 return new GpsLocationProviderLinux(LibGps::New); | 128 return new GpsLocationProviderLinux(LibGps::New); |
| 133 } | 129 } |
| OLD | NEW |