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

Unified Diff: device/geolocation/location_arbitrator_impl.cc

Issue 2226143002: Gets rid of the LocationArbitrator interface, in preference for LocationProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removes LocationArbitrator.h Created 4 years, 4 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: device/geolocation/location_arbitrator_impl.cc
diff --git a/device/geolocation/location_arbitrator_impl.cc b/device/geolocation/location_arbitrator_impl.cc
index a61a4a3ab22a867fba5d272f7d9961b12776bf23..d83cd27a114efa0fd1ab4a34cc8f13f1f0b626ea 100644
--- a/device/geolocation/location_arbitrator_impl.cc
+++ b/device/geolocation/location_arbitrator_impl.cc
@@ -5,6 +5,8 @@
#include "device/geolocation/location_arbitrator_impl.h"
#include <map>
+#include <memory>
+#include <utility>
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -51,7 +53,7 @@ void LocationArbitratorImpl::OnPermissionGranted() {
provider->OnPermissionGranted();
}
-void LocationArbitratorImpl::StartProviders(bool enable_high_accuracy) {
+bool LocationArbitratorImpl::StartProvider(bool enable_high_accuracy) {
// Stash options as OnAccessTokenStoresLoaded has not yet been called.
is_running_ = true;
enable_high_accuracy_ = enable_high_accuracy;
@@ -67,10 +69,11 @@ void LocationArbitratorImpl::StartProviders(bool enable_high_accuracy) {
base::Bind(&LocationArbitratorImpl::OnAccessTokenStoresLoaded,
base::Unretained(this)));
access_token_store->LoadAccessTokens(token_store_callback_.callback());
- return;
+ return true;
}
}
DoStartProviders();
Wez 2016/08/09 01:17:04 Looks like it might be worthwhile to have DoStartP
CJ 2016/08/11 22:06:43 Done.
+ return true;
}
void LocationArbitratorImpl::DoStartProviders() {
@@ -86,7 +89,7 @@ void LocationArbitratorImpl::DoStartProviders() {
provider->StartProvider(enable_high_accuracy_);
}
-void LocationArbitratorImpl::StopProviders() {
+void LocationArbitratorImpl::StopProvider() {
// Reset the reference location state (provider+position)
// so that future starts use fresh locations from
// the newly constructed providers.
@@ -140,6 +143,23 @@ void LocationArbitratorImpl::OnLocationUpdate(const LocationProvider* provider,
arbitrator_update_callback_.Run(position_);
}
+void LocationArbitratorImpl::RequestRefresh() {
+ if (is_permission_granted_) {
+ for (const auto& provider : providers_)
+ provider->RequestRefresh();
Wez 2016/08/09 01:17:04 nit: Interesting that there are no other RequestRe
CJ 2016/08/11 22:06:43 Done.
+ }
+}
+
+void LocationArbitratorImpl::GetPosition(Geoposition* position) {
+ DCHECK(position);
Wez 2016/08/09 01:17:04 nit: No need to DCHECK - you're about to assign to
CJ 2016/08/11 22:06:43 Done.
+ position = &position_;
Wez 2016/08/09 01:17:04 This isn't doing what you intend. You're setting
CJ 2016/08/11 22:06:43 Done.
+}
+
+void LocationArbitratorImpl::SetUpdateCallback(
+ const LocationProviderUpdateCallback& callback) {
+ provider_update_callback_ = callback;
+}
+
scoped_refptr<AccessTokenStore> LocationArbitratorImpl::NewAccessTokenStore() {
return delegate_->CreateAccessTokenStore();
}

Powered by Google App Engine
This is Rietveld 408576698