summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjoth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-02 12:25:55 +0000
committerjoth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-02 12:25:55 +0000
commit9d274dce508da36dd586236d0a313a9bd7212c12 (patch)
tree79ae941765f5ea3a183be67600d8f021571b08e7 /chrome/browser
parenta7d741f037a118e2eaca628dc3fbbd61eb7211b1 (diff)
downloadchromium_src-9d274dce508da36dd586236d0a313a9bd7212c12.zip
chromium_src-9d274dce508da36dd586236d0a313a9bd7212c12.tar.gz
chromium_src-9d274dce508da36dd586236d0a313a9bd7212c12.tar.bz2
Remove obsolete code:
- InformListenersOfMovement not required as WebKit has no way to trigger timeouts when movement is detected but cannot be resolved to a location. - Error message in gps_open() does not have any additional information Review URL: http://codereview.chromium.org/2450002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48711 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/geolocation/gps_location_provider_linux.cc6
-rw-r--r--chrome/browser/geolocation/gps_location_provider_linux.h1
-rw-r--r--chrome/browser/geolocation/libgps_wrapper_linux.cc28
-rw-r--r--chrome/browser/geolocation/libgps_wrapper_linux.h4
-rw-r--r--chrome/browser/geolocation/location_provider.cc9
-rw-r--r--chrome/browser/geolocation/location_provider.h9
-rw-r--r--chrome/browser/geolocation/mock_location_provider.h1
7 files changed, 18 insertions, 40 deletions
diff --git a/chrome/browser/geolocation/gps_location_provider_linux.cc b/chrome/browser/geolocation/gps_location_provider_linux.cc
index 3876369..5d96414 100644
--- a/chrome/browser/geolocation/gps_location_provider_linux.cc
+++ b/chrome/browser/geolocation/gps_location_provider_linux.cc
@@ -55,11 +55,11 @@ bool GpsLocationProviderLinux::StartProvider() {
position_.error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE;
gps_.reset(libgps_factory_());
if (gps_ == NULL) {
- LOG(WARNING) << "libgps.so could not be loaded";
+ DLOG(WARNING) << "libgps.so could not be loaded";
return false;
}
- if (!gps_->Start(&error_msg_)) {
- LOG(WARNING) << "Couldn't start GPS provider: " << error_msg_;
+ if (!gps_->Start()) {
+ DLOG(WARNING) << "Couldn't start GPS provider.";
return false;
}
ScheduleNextGpsPoll(0);
diff --git a/chrome/browser/geolocation/gps_location_provider_linux.h b/chrome/browser/geolocation/gps_location_provider_linux.h
index 816062e..0772ec6 100644
--- a/chrome/browser/geolocation/gps_location_provider_linux.h
+++ b/chrome/browser/geolocation/gps_location_provider_linux.h
@@ -45,7 +45,6 @@ class GpsLocationProviderLinux : public LocationProviderBase {
const LibGpsFactory libgps_factory_;
scoped_ptr<LibGps> gps_;
- std::string error_msg_;
Geoposition position_;
// Holder for the tasks which run on the thread; takes care of cleanup.
diff --git a/chrome/browser/geolocation/libgps_wrapper_linux.cc b/chrome/browser/geolocation/libgps_wrapper_linux.cc
index 271b46f..20bcbf2 100644
--- a/chrome/browser/geolocation/libgps_wrapper_linux.cc
+++ b/chrome/browser/geolocation/libgps_wrapper_linux.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/geolocation/libgps_wrapper_linux.h"
#include <dlfcn.h>
+#include <errno.h>
#include "chrome/common/geoposition.h"
#include "base/logging.h"
@@ -20,7 +21,7 @@ LibGpsLibraryLoader* TryToOpen(const char* lib,
if (wrapper->Init(mode))
return wrapper.release();
} else {
- DLOG(INFO) << "Could not open " << lib << ": " << dlerror();
+ LOG(INFO) << "Could not open " << lib << ": " << dlerror();
}
return NULL;
}
@@ -48,10 +49,15 @@ LibGps* LibGps::New() {
return NULL;
}
-bool LibGps::Start(std::string* error_out) {
- if (!library().open(NULL, NULL, error_out))
+bool LibGps::Start() {
+ errno = 0;
+ if (!library().open(NULL, NULL)) {
+ // See gps.h NL_NOxxx for definition of gps_open() error numbers.
+ LOG(INFO) << "gps_open() failed: " << errno;
return false;
+ }
if (!StartStreaming()) {
+ LOG(INFO) << "StartStreaming failed";
library().close();
return false;
}
@@ -144,23 +150,15 @@ LibGpsLibraryLoader::~LibGpsLibraryLoader() {
}
}
-bool LibGpsLibraryLoader::open(const char* host, const char* port,
- std::string* error_out) {
- DCHECK(!gps_data_) << "libgps handle already opened";
+bool LibGpsLibraryLoader::open(const char* host, const char* port) {
+ DCHECK(!gps_data_) << "libgps already opened";
DCHECK(gps_open_) << "Must call Init() first";
- std::string dummy;
- if (!error_out) error_out = &dummy;
-
gps_data_ = gps_open_(host, port);
- if (!gps_data_) { // GPS session was not created.
- *error_out = "gps_open failed";
- close();
- }
- return gps_data_;
+ return is_open();
}
void LibGpsLibraryLoader::close() {
- if (gps_data_) {
+ if (is_open()) {
DCHECK(gps_close_);
gps_close_(gps_data_);
gps_data_ = NULL;
diff --git a/chrome/browser/geolocation/libgps_wrapper_linux.h b/chrome/browser/geolocation/libgps_wrapper_linux.h
index f49b20d..a2d9a0b 100644
--- a/chrome/browser/geolocation/libgps_wrapper_linux.h
+++ b/chrome/browser/geolocation/libgps_wrapper_linux.h
@@ -28,7 +28,7 @@ class LibGps {
// failure.
static LibGps* New();
- bool Start(std::string* error_out);
+ bool Start();
void Stop();
bool Poll();
bool GetPosition(Geoposition* position);
@@ -80,7 +80,7 @@ class LibGpsLibraryLoader {
bool Init(InitMode requirement);
// Analogs of gps_xxx methods in gps.h
- bool open(const char* host, const char* port, std::string* error_out);
+ bool open(const char* host, const char* port);
void close();
int poll();
int query(const char* fmt);
diff --git a/chrome/browser/geolocation/location_provider.cc b/chrome/browser/geolocation/location_provider.cc
index 858963f..cdfd797 100644
--- a/chrome/browser/geolocation/location_provider.cc
+++ b/chrome/browser/geolocation/location_provider.cc
@@ -56,15 +56,6 @@ void LocationProviderBase::UpdateListeners() {
}
}
-void LocationProviderBase::InformListenersOfMovement() {
- DCHECK(CalledOnValidThread());
- for (ListenerMap::const_iterator iter = listeners_.begin();
- iter != listeners_.end();
- ++iter) {
- iter->first->MovementDetected(this);
- }
-}
-
// Currently only Linux has a GPS provider.
#if !defined(OS_LINUX)
LocationProviderBase* NewGpsLocationProvider() {
diff --git a/chrome/browser/geolocation/location_provider.h b/chrome/browser/geolocation/location_provider.h
index 6d8d6a7..803f6b2 100644
--- a/chrome/browser/geolocation/location_provider.h
+++ b/chrome/browser/geolocation/location_provider.h
@@ -34,13 +34,6 @@ class LocationProviderBase : public NonThreadSafe {
// fatal error has occurred. Providers should call this for new listeners
// as soon as a position is available.
virtual void LocationUpdateAvailable(LocationProviderBase* provider) = 0;
- // Used to inform listener that movement has been detected. If obtaining the
- // position succeeds, this will be followed by a call to
- // LocationUpdateAvailable. Some providers may not be able to detect
- // movement before a new fix is obtained, so will never call this method.
- // Note that this is not called in response to registration of a new
- // listener.
- virtual void MovementDetected(LocationProviderBase* provider) = 0;
protected:
virtual ~ListenerInterface() {}
@@ -80,8 +73,6 @@ class LocationProviderBase : public NonThreadSafe {
// Inform listeners that a new position or error is available, using
// LocationUpdateAvailable.
void UpdateListeners();
- // Inform listeners that movement has been detected, using MovementDetected.
- void InformListenersOfMovement();
private:
// The listeners registered to this provider. For each listener, we store a
diff --git a/chrome/browser/geolocation/mock_location_provider.h b/chrome/browser/geolocation/mock_location_provider.h
index 99ee378..256e0b2 100644
--- a/chrome/browser/geolocation/mock_location_provider.h
+++ b/chrome/browser/geolocation/mock_location_provider.h
@@ -17,7 +17,6 @@ class MockLocationProvider : public LocationProviderBase {
~MockLocationProvider();
using LocationProviderBase::UpdateListeners;
- using LocationProviderBase::InformListenersOfMovement;
// LocationProviderBase implementation.
virtual bool StartProvider();