From 666b66392f20bd72ed9617d74dcd78fe83db8710 Mon Sep 17 00:00:00 2001 From: "mvanouwerkerk@chromium.org" Date: Wed, 21 Aug 2013 18:55:46 +0000 Subject: Convert NetworkLocationRequest::ListenerInterface to a callback. Review URL: https://chromiumcodereview.appspot.com/23183008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218788 0039d316-1c4b-4281-b951-d872f2087c98 --- .../browser/geolocation/network_location_request.h | 27 +++++++++------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'content/browser/geolocation/network_location_request.h') diff --git a/content/browser/geolocation/network_location_request.h b/content/browser/geolocation/network_location_request.h index 36e843b..56a6004 100644 --- a/content/browser/geolocation/network_location_request.h +++ b/content/browser/geolocation/network_location_request.h @@ -27,25 +27,20 @@ class NetworkLocationRequest : private net::URLFetcherDelegate { public: // ID passed to URLFetcher::Create(). Used for testing. CONTENT_EXPORT static int url_fetcher_id_for_tests; - // Interface for receiving callbacks from a NetworkLocationRequest object. - class ListenerInterface { - public: - // Updates the listener with a new position. server_error indicates whether - // was a server or network error - either no response or a 500 error code. - virtual void LocationResponseAvailable( - const Geoposition& position, - bool server_error, - const string16& access_token, - const WifiData& wifi_data) = 0; - - protected: - virtual ~ListenerInterface() {} - }; + + // Called when a new geo position is available. The second argument indicates + // whether there was a server error or not. It is true when there was a + // server or network error - either no response or a 500 error code. + typedef base::Callback + LocationResponseCallback; // |url| is the server address to which the request wil be sent. NetworkLocationRequest(net::URLRequestContextGetter* context, const GURL& url, - ListenerInterface* listener); + LocationResponseCallback callback); virtual ~NetworkLocationRequest(); // Makes a new request. Returns true if the new request was successfully @@ -62,7 +57,7 @@ class NetworkLocationRequest : private net::URLFetcherDelegate { virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; scoped_refptr url_context_; - ListenerInterface* listener_; + LocationResponseCallback callback_; const GURL url_; scoped_ptr url_fetcher_; -- cgit v1.1