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

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

Issue 2098553002: Geolocation: extract ContentBrowserClient methods specific to Geolocation into a class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a TODO Created 4 years, 6 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 edd26d3fd079dcb78dd46a218571b2b8d27fab17..cd2c20afad94d83c95ce37da3047488999a6e2aa 100644
--- a/content/browser/geolocation/location_arbitrator_impl.cc
+++ b/content/browser/geolocation/location_arbitrator_impl.cc
@@ -12,7 +12,6 @@
#include "build/build_config.h"
#include "content/browser/geolocation/network_location_provider.h"
#include "content/public/browser/access_token_store.h"
-#include "content/public/browser/content_browser_client.h"
#include "content/public/common/content_client.h"
#include "url/gurl.h"
@@ -29,15 +28,16 @@ const int64_t LocationArbitratorImpl::kFixStaleTimeoutMilliseconds =
11 * base::Time::kMillisecondsPerSecond;
LocationArbitratorImpl::LocationArbitratorImpl(
- const LocationUpdateCallback& callback)
- : arbitrator_update_callback_(callback),
+ const LocationUpdateCallback& callback,
+ GeolocationProvider::Delegate* delegate)
+ : delegate_(delegate),
+ arbitrator_update_callback_(callback),
provider_update_callback_(
base::Bind(&LocationArbitratorImpl::OnLocationUpdate,
base::Unretained(this))),
position_provider_(NULL),
is_permission_granted_(false),
- is_running_(false) {
-}
+ is_running_(false) {}
LocationArbitratorImpl::~LocationArbitratorImpl() {
}
@@ -61,8 +61,7 @@ void LocationArbitratorImpl::StartProviders(bool enable_high_accuracy) {
RegisterSystemProvider();
AccessTokenStore* access_token_store = GetAccessTokenStore();
- if (access_token_store &&
- GetContentClient()->browser()->UseNetworkLocationProviders()) {
+ if (access_token_store && delegate_->UseNetworkLocationProviders()) {
DCHECK(DefaultNetworkProviderURL().is_valid());
token_store_callback_.Reset(
base::Bind(&LocationArbitratorImpl::OnAccessTokenStoresLoaded,
@@ -122,8 +121,8 @@ void LocationArbitratorImpl::RegisterProvider(
}
void LocationArbitratorImpl::RegisterSystemProvider() {
- std::unique_ptr<LocationProvider> provider = base::WrapUnique(
- GetContentClient()->browser()->OverrideSystemLocationProvider());
+ std::unique_ptr<LocationProvider> provider =
+ base::WrapUnique(delegate_->OverrideSystemLocationProvider());
if (!provider)
provider = NewSystemLocationProvider();
RegisterProvider(std::move(provider));
@@ -142,7 +141,7 @@ void LocationArbitratorImpl::OnLocationUpdate(const LocationProvider* provider,
}
AccessTokenStore* LocationArbitratorImpl::NewAccessTokenStore() {
- return GetContentClient()->browser()->CreateAccessTokenStore();
+ return delegate_->CreateAccessTokenStore();
}
AccessTokenStore* LocationArbitratorImpl::GetAccessTokenStore() {

Powered by Google App Engine
This is Rietveld 408576698