summaryrefslogtreecommitdiffstats
path: root/content/browser/geolocation/network_location_request.h
diff options
context:
space:
mode:
authormvanouwerkerk@chromium.org <mvanouwerkerk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-21 18:55:46 +0000
committermvanouwerkerk@chromium.org <mvanouwerkerk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-21 18:55:46 +0000
commit666b66392f20bd72ed9617d74dcd78fe83db8710 (patch)
tree21f5f008ff4bced985edd65dfad42189d4367943 /content/browser/geolocation/network_location_request.h
parenta3c1d451969ce6a8f3d87eb627b21296b10a4d86 (diff)
downloadchromium_src-666b66392f20bd72ed9617d74dcd78fe83db8710.zip
chromium_src-666b66392f20bd72ed9617d74dcd78fe83db8710.tar.gz
chromium_src-666b66392f20bd72ed9617d74dcd78fe83db8710.tar.bz2
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
Diffstat (limited to 'content/browser/geolocation/network_location_request.h')
-rw-r--r--content/browser/geolocation/network_location_request.h27
1 files changed, 11 insertions, 16 deletions
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<void(const Geoposition& /* position */,
+ bool /* server_error */,
+ const string16& /* access_token */,
+ const WifiData& /* wifi_data */)>
+ 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<net::URLRequestContextGetter> url_context_;
- ListenerInterface* listener_;
+ LocationResponseCallback callback_;
const GURL url_;
scoped_ptr<net::URLFetcher> url_fetcher_;