From 81b14e7a8d0690e65701b96d305e12eef9afa71f Mon Sep 17 00:00:00 2001 From: "jhawkins@chromium.org" Date: Fri, 7 Oct 2011 21:18:36 +0000 Subject: 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 --- content/browser/geolocation/access_token_store.cc | 2 +- content/browser/geolocation/access_token_store.h | 7 ++++--- content/browser/geolocation/fake_access_token_store.cc | 2 +- content/browser/geolocation/location_arbitrator.cc | 6 ++++-- 4 files changed, 10 insertions(+), 7 deletions(-) (limited to 'content/browser/geolocation') 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 > request( new CancelableRequest(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 -#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, // Map of server URLs to associated access token. typedef std::map AccessTokenSet; - typedef Callback2::Type + typedef base::Callback 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, // 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 +#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(); } -- cgit v1.1