Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Unified Diff: content/browser/geolocation/location_arbitrator_impl.cc

Issue 2129313002: Geolocation cleanup: corrects uses of content::AccessTokenStore* and net::URLRequestContextGetter* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed StartTestStepFromClientThread() Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/geolocation/location_arbitrator_impl.cc
diff --git a/content/browser/geolocation/location_arbitrator_impl.cc b/content/browser/geolocation/location_arbitrator_impl.cc
index a5c87eaf76e6187ea7164bd2954da23a04058fae..44d911f7aeadfb6078f4623bd193583096a9ab68 100644
--- a/content/browser/geolocation/location_arbitrator_impl.cc
+++ b/content/browser/geolocation/location_arbitrator_impl.cc
@@ -36,7 +36,7 @@ LocationArbitratorImpl::LocationArbitratorImpl(
provider_update_callback_(
base::Bind(&LocationArbitratorImpl::OnLocationUpdate,
base::Unretained(this))),
- position_provider_(NULL),
+ position_provider_(nullptr),
is_permission_granted_(false),
is_running_(false) {}
@@ -61,7 +61,8 @@ void LocationArbitratorImpl::StartProviders(bool enable_high_accuracy) {
if (providers_.empty()) {
RegisterSystemProvider();
- AccessTokenStore* access_token_store = GetAccessTokenStore();
+ const scoped_refptr<AccessTokenStore> access_token_store =
+ GetAccessTokenStore();
if (access_token_store && delegate_->UseNetworkLocationProviders()) {
DCHECK(DefaultNetworkProviderURL().is_valid());
token_store_callback_.Reset(
@@ -91,7 +92,7 @@ void LocationArbitratorImpl::StopProviders() {
// Reset the reference location state (provider+position)
// so that future starts use fresh locations from
// the newly constructed providers.
- position_provider_ = NULL;
+ position_provider_ = nullptr;
position_ = Geoposition();
providers_.clear();
@@ -100,7 +101,7 @@ void LocationArbitratorImpl::StopProviders() {
void LocationArbitratorImpl::OnAccessTokenStoresLoaded(
AccessTokenStore::AccessTokenMap access_token_map,
- net::URLRequestContextGetter* context_getter) {
+ const scoped_refptr<net::URLRequestContextGetter>& context_getter) {
// If there are no access tokens, boot strap it with the default server URL.
if (access_token_map.empty())
access_token_map[DefaultNetworkProviderURL()];
@@ -141,25 +142,25 @@ void LocationArbitratorImpl::OnLocationUpdate(const LocationProvider* provider,
arbitrator_update_callback_.Run(position_);
}
-AccessTokenStore* LocationArbitratorImpl::NewAccessTokenStore() {
+scoped_refptr<AccessTokenStore> LocationArbitratorImpl::NewAccessTokenStore() {
return delegate_->CreateAccessTokenStore();
}
-AccessTokenStore* LocationArbitratorImpl::GetAccessTokenStore() {
- if (!access_token_store_.get())
+scoped_refptr<AccessTokenStore> LocationArbitratorImpl::GetAccessTokenStore() {
+ if (!access_token_store_)
access_token_store_ = NewAccessTokenStore();
- return access_token_store_.get();
+ return access_token_store_;
}
std::unique_ptr<LocationProvider>
LocationArbitratorImpl::NewNetworkLocationProvider(
- AccessTokenStore* access_token_store,
- net::URLRequestContextGetter* context,
+ const scoped_refptr<AccessTokenStore>& access_token_store,
+ const scoped_refptr<net::URLRequestContextGetter>& context,
const GURL& url,
const base::string16& access_token) {
#if defined(OS_ANDROID)
// Android uses its own SystemLocationProvider.
- return NULL;
+ return nullptr;
#else
return base::WrapUnique(new NetworkLocationProvider(
access_token_store, context, url, access_token));
@@ -169,9 +170,9 @@ LocationArbitratorImpl::NewNetworkLocationProvider(
std::unique_ptr<LocationProvider>
LocationArbitratorImpl::NewSystemLocationProvider() {
#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
- return NULL;
+ return nullptr;
#else
- return base::WrapUnique(content::NewSystemLocationProvider());
+ return content::NewSystemLocationProvider();
#endif
}

Powered by Google App Engine
This is Rietveld 408576698