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

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

Issue 11412194: Cleanup: MockGeolocationArbitrator for GeolocationProvider tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make suggested changes. Created 8 years, 1 month 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.cc b/content/browser/geolocation/location_arbitrator_impl.cc
similarity index 79%
rename from content/browser/geolocation/location_arbitrator.cc
rename to content/browser/geolocation/location_arbitrator_impl.cc
index 229e5adfdcdb8937bfd845d5dc39855674ce6249..97cae8e682e5115bf544f23b6790411a6a612cb7 100644
--- a/content/browser/geolocation/location_arbitrator.cc
+++ b/content/browser/geolocation/location_arbitrator_impl.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/browser/geolocation/location_arbitrator.h"
+#include "content/browser/geolocation/location_arbitrator_impl.h"
#include <map>
@@ -22,24 +22,24 @@ const char* kDefaultNetworkProviderUrl =
// To avoid oscillations, set this to twice the expected update interval of a
// a GPS-type location provider (in case it misses a beat) plus a little.
-const int64 GeolocationArbitrator::kFixStaleTimeoutMilliseconds =
+const int64 GeolocationArbitratorImpl::kFixStaleTimeoutMilliseconds =
11 * base::Time::kMillisecondsPerSecond;
-GeolocationArbitrator::GeolocationArbitrator(
+GeolocationArbitratorImpl::GeolocationArbitratorImpl(
GeolocationObserver* observer)
: observer_(observer),
position_provider_(NULL),
is_permission_granted_(false) {
}
-GeolocationArbitrator::~GeolocationArbitrator() {
+GeolocationArbitratorImpl::~GeolocationArbitratorImpl() {
}
-GURL GeolocationArbitrator::DefaultNetworkProviderURL() {
+GURL GeolocationArbitratorImpl::DefaultNetworkProviderURL() {
return GURL(kDefaultNetworkProviderUrl);
}
-void GeolocationArbitrator::OnPermissionGranted() {
+void GeolocationArbitratorImpl::OnPermissionGranted() {
is_permission_granted_ = true;
for (ScopedVector<LocationProviderBase>::iterator i = providers_.begin();
i != providers_.end(); ++i) {
@@ -47,32 +47,32 @@ void GeolocationArbitrator::OnPermissionGranted() {
}
}
-void GeolocationArbitrator::StartProviders(
+void GeolocationArbitratorImpl::StartProviders(
const GeolocationObserverOptions& options) {
// Stash options as OnAccessTokenStoresLoaded has not yet been called.
current_provider_options_ = options;
if (providers_.empty()) {
DCHECK(DefaultNetworkProviderURL().is_valid());
GetAccessTokenStore()->LoadAccessTokens(
- base::Bind(&GeolocationArbitrator::OnAccessTokenStoresLoaded,
+ base::Bind(&GeolocationArbitratorImpl::OnAccessTokenStoresLoaded,
base::Unretained(this)));
} else {
DoStartProviders();
}
}
-void GeolocationArbitrator::DoStartProviders() {
+void GeolocationArbitratorImpl::DoStartProviders() {
for (ScopedVector<LocationProviderBase>::iterator i = providers_.begin();
i != providers_.end(); ++i) {
(*i)->StartProvider(current_provider_options_.use_high_accuracy);
}
}
-void GeolocationArbitrator::StopProviders() {
+void GeolocationArbitratorImpl::StopProviders() {
providers_.clear();
}
-void GeolocationArbitrator::OnAccessTokenStoresLoaded(
+void GeolocationArbitratorImpl::OnAccessTokenStoresLoaded(
AccessTokenStore::AccessTokenSet access_token_set,
net::URLRequestContextGetter* context_getter) {
if (!providers_.empty()) {
@@ -95,7 +95,7 @@ void GeolocationArbitrator::OnAccessTokenStoresLoaded(
DoStartProviders();
}
-void GeolocationArbitrator::RegisterProvider(
+void GeolocationArbitratorImpl::RegisterProvider(
LocationProviderBase* provider) {
if (!provider)
return;
@@ -105,7 +105,7 @@ void GeolocationArbitrator::RegisterProvider(
providers_.push_back(provider);
}
-void GeolocationArbitrator::LocationUpdateAvailable(
+void GeolocationArbitratorImpl::LocationUpdateAvailable(
LocationProviderBase* provider) {
DCHECK(provider);
Geoposition new_position;
@@ -120,17 +120,17 @@ void GeolocationArbitrator::LocationUpdateAvailable(
observer_->OnLocationUpdate(position_);
}
-AccessTokenStore* GeolocationArbitrator::NewAccessTokenStore() {
+AccessTokenStore* GeolocationArbitratorImpl::NewAccessTokenStore() {
return GetContentClient()->browser()->CreateAccessTokenStore();
}
-AccessTokenStore* GeolocationArbitrator::GetAccessTokenStore() {
+AccessTokenStore* GeolocationArbitratorImpl::GetAccessTokenStore() {
if (!access_token_store_.get())
access_token_store_ = NewAccessTokenStore();
return access_token_store_.get();
}
-LocationProviderBase* GeolocationArbitrator::NewNetworkLocationProvider(
+LocationProviderBase* GeolocationArbitratorImpl::NewNetworkLocationProvider(
AccessTokenStore* access_token_store,
net::URLRequestContextGetter* context,
const GURL& url,
@@ -144,15 +144,15 @@ LocationProviderBase* GeolocationArbitrator::NewNetworkLocationProvider(
#endif
}
-LocationProviderBase* GeolocationArbitrator::NewSystemLocationProvider() {
+LocationProviderBase* GeolocationArbitratorImpl::NewSystemLocationProvider() {
return content::NewSystemLocationProvider();
}
-base::Time GeolocationArbitrator::GetTimeNow() const {
+base::Time GeolocationArbitratorImpl::GetTimeNow() const {
return base::Time::Now();
}
-bool GeolocationArbitrator::IsNewPositionBetter(
+bool GeolocationArbitratorImpl::IsNewPositionBetter(
const Geoposition& old_position, const Geoposition& new_position,
bool from_same_provider) const {
// Updates location_info if it's better than what we currently have,
@@ -178,7 +178,7 @@ bool GeolocationArbitrator::IsNewPositionBetter(
return false;
}
-bool GeolocationArbitrator::HasPermissionBeenGranted() const {
+bool GeolocationArbitratorImpl::HasPermissionBeenGranted() const {
return is_permission_granted_;
}

Powered by Google App Engine
This is Rietveld 408576698