diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-07 21:18:36 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-07 21:18:36 +0000 |
commit | 81b14e7a8d0690e65701b96d305e12eef9afa71f (patch) | |
tree | 2156612a6bf2363a9a5e212b4a1e13207ea6b6e9 /content/browser/geolocation | |
parent | 9861d5279456c0e4f1d0d526aa363580d9315118 (diff) | |
download | chromium_src-81b14e7a8d0690e65701b96d305e12eef9afa71f.zip chromium_src-81b14e7a8d0690e65701b96d305e12eef9afa71f.tar.gz chromium_src-81b14e7a8d0690e65701b96d305e12eef9afa71f.tar.bz2 |
base::Bind: Cleanups in geolocation/.
BUG=none
TEST=none
R=csilv@chromium.org
Review URL: http://codereview.chromium.org/8199012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104563 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/geolocation')
4 files changed, 10 insertions, 7 deletions
diff --git a/content/browser/geolocation/access_token_store.cc b/content/browser/geolocation/access_token_store.cc index be1e578..45d0203 100644 --- a/content/browser/geolocation/access_token_store.cc +++ b/content/browser/geolocation/access_token_store.cc @@ -12,7 +12,7 @@ AccessTokenStore::~AccessTokenStore() { AccessTokenStore::Handle AccessTokenStore::LoadAccessTokens( CancelableRequestConsumerBase* consumer, - LoadAccessTokensCallbackType* callback) { + const LoadAccessTokensCallbackType& callback) { scoped_refptr<CancelableRequest<LoadAccessTokensCallbackType> > request( new CancelableRequest<LoadAccessTokensCallbackType>(callback)); AddRequest(request, consumer); diff --git a/content/browser/geolocation/access_token_store.h b/content/browser/geolocation/access_token_store.h index 804f22b..2089dfb 100644 --- a/content/browser/geolocation/access_token_store.h +++ b/content/browser/geolocation/access_token_store.h @@ -16,7 +16,7 @@ #include <map> -#include "base/callback_old.h" +#include "base/callback.h" #include "base/memory/ref_counted.h" #include "base/string16.h" #include "content/browser/cancelable_request.h" @@ -36,8 +36,9 @@ class AccessTokenStore : public base::RefCountedThreadSafe<AccessTokenStore>, // Map of server URLs to associated access token. typedef std::map<GURL, string16> AccessTokenSet; - typedef Callback2<AccessTokenSet, net::URLRequestContextGetter*>::Type + typedef base::Callback<void(AccessTokenSet, net::URLRequestContextGetter*)> LoadAccessTokensCallbackType; + // |callback| will be invoked once per LoadAccessTokens call, after existing // access tokens have been loaded from persistent store. As a convenience the // URLRequestContextGetter is also supplied as an argument in |callback|, as @@ -47,7 +48,7 @@ class AccessTokenStore : public base::RefCountedThreadSafe<AccessTokenStore>, // Returns a handle which can subsequently be used with CancelRequest(). CONTENT_EXPORT Handle LoadAccessTokens( CancelableRequestConsumerBase* consumer, - LoadAccessTokensCallbackType* callback); + const LoadAccessTokensCallbackType& callback); virtual void SaveAccessToken( const GURL& server_url, const string16& access_token) = 0; diff --git a/content/browser/geolocation/fake_access_token_store.cc b/content/browser/geolocation/fake_access_token_store.cc index 548c127..4b2dc53 100644 --- a/content/browser/geolocation/fake_access_token_store.cc +++ b/content/browser/geolocation/fake_access_token_store.cc @@ -19,7 +19,7 @@ FakeAccessTokenStore::FakeAccessTokenStore() { void FakeAccessTokenStore::NotifyDelegateTokensLoaded() { CHECK(request_ != NULL); net::URLRequestContextGetter* context_getter = NULL; - request_->ForwardResult(MakeTuple(access_token_set_, context_getter)); + request_->ForwardResult(access_token_set_, context_getter); request_ = NULL; } diff --git a/content/browser/geolocation/location_arbitrator.cc b/content/browser/geolocation/location_arbitrator.cc index 0160e4e..2765cdc 100644 --- a/content/browser/geolocation/location_arbitrator.cc +++ b/content/browser/geolocation/location_arbitrator.cc @@ -6,6 +6,8 @@ #include <map> +#include "base/bind.h" +#include "base/bind_helpers.h" #include "content/browser/geolocation/arbitrator_dependency_factory.h" namespace { @@ -63,8 +65,8 @@ void GeolocationArbitrator::StartProviders( DCHECK(GURL(kDefaultNetworkProviderUrl).is_valid()); access_token_store_->LoadAccessTokens( &request_consumer_, - NewCallback(this, - &GeolocationArbitrator::OnAccessTokenStoresLoaded)); + base::Bind(&GeolocationArbitrator::OnAccessTokenStoresLoaded, + base::Unretained(this))); } else { DoStartProviders(); } |