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

Side by Side Diff: content/browser/geolocation/geolocation_provider_impl.cc

Issue 2028823002: Refactor to make BlimpLocationProvider accessible to content layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Makes testing override location provider accessible 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/geolocation/geolocation_provider_impl.h" 5 #include "content/browser/geolocation/geolocation_provider_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
15 #include "content/browser/geolocation/location_arbitrator_impl.h" 15 #include "content/browser/geolocation/location_arbitrator_impl.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/content_browser_client.h"
18 #include "content/public/common/content_client.h"
17 19
18 namespace content { 20 namespace content {
19 21
20 GeolocationProvider* GeolocationProvider::GetInstance() { 22 GeolocationProvider* GeolocationProvider::GetInstance() {
21 return GeolocationProviderImpl::GetInstance(); 23 return GeolocationProviderImpl::GetInstance();
22 } 24 }
23 25
24 std::unique_ptr<GeolocationProvider::Subscription> 26 std::unique_ptr<GeolocationProvider::Subscription>
25 GeolocationProviderImpl::AddLocationUpdateCallback( 27 GeolocationProviderImpl::AddLocationUpdateCallback(
26 const LocationUpdateCallback& callback, 28 const LocationUpdateCallback& callback,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 128
127 void GeolocationProviderImpl::StopProviders() { 129 void GeolocationProviderImpl::StopProviders() {
128 DCHECK(OnGeolocationThread()); 130 DCHECK(OnGeolocationThread());
129 DCHECK(arbitrator_); 131 DCHECK(arbitrator_);
130 arbitrator_->StopProviders(); 132 arbitrator_->StopProviders();
131 } 133 }
132 134
133 void GeolocationProviderImpl::StartProviders(bool enable_high_accuracy) { 135 void GeolocationProviderImpl::StartProviders(bool enable_high_accuracy) {
134 DCHECK(OnGeolocationThread()); 136 DCHECK(OnGeolocationThread());
135 DCHECK(arbitrator_); 137 DCHECK(arbitrator_);
136 arbitrator_->StartProviders(enable_high_accuracy); 138 arbitrator_->StartProviders(
139 enable_high_accuracy,
140 GetContentClient()->browser()->UseNetworkLocationProviders());
137 } 141 }
138 142
139 void GeolocationProviderImpl::InformProvidersPermissionGranted() { 143 void GeolocationProviderImpl::InformProvidersPermissionGranted() {
140 DCHECK(IsRunning()); 144 DCHECK(IsRunning());
141 if (!OnGeolocationThread()) { 145 if (!OnGeolocationThread()) {
142 task_runner()->PostTask( 146 task_runner()->PostTask(
143 FROM_HERE, 147 FROM_HERE,
144 base::Bind(&GeolocationProviderImpl::InformProvidersPermissionGranted, 148 base::Bind(&GeolocationProviderImpl::InformProvidersPermissionGranted,
145 base::Unretained(this))); 149 base::Unretained(this)));
146 return; 150 return;
(...skipping 24 matching lines...) Expand all
171 } 175 }
172 176
173 std::unique_ptr<LocationArbitrator> 177 std::unique_ptr<LocationArbitrator>
174 GeolocationProviderImpl::CreateArbitrator() { 178 GeolocationProviderImpl::CreateArbitrator() {
175 LocationArbitratorImpl::LocationUpdateCallback callback = base::Bind( 179 LocationArbitratorImpl::LocationUpdateCallback callback = base::Bind(
176 &GeolocationProviderImpl::OnLocationUpdate, base::Unretained(this)); 180 &GeolocationProviderImpl::OnLocationUpdate, base::Unretained(this));
177 return base::WrapUnique(new LocationArbitratorImpl(callback)); 181 return base::WrapUnique(new LocationArbitratorImpl(callback));
178 } 182 }
179 183
180 } // namespace content 184 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698