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

Side by Side Diff: content/browser/geolocation/geolocation_provider_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: Changing to ContentBrowserClient::GetGeolocationServiceOverrides and impl'd in the 6 impl's. Unitte… 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/browser_thread.h"
Michael van Ouwerkerk 2016/06/24 13:57:18 nit: delete this duplicated include
mcasas 2016/06/24 19:25:52 Done.
18 #include "content/public/browser/content_browser_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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 169
168 void GeolocationProviderImpl::CleanUp() { 170 void GeolocationProviderImpl::CleanUp() {
169 DCHECK(OnGeolocationThread()); 171 DCHECK(OnGeolocationThread());
170 arbitrator_.reset(); 172 arbitrator_.reset();
171 } 173 }
172 174
173 std::unique_ptr<LocationArbitrator> 175 std::unique_ptr<LocationArbitrator>
174 GeolocationProviderImpl::CreateArbitrator() { 176 GeolocationProviderImpl::CreateArbitrator() {
175 LocationArbitratorImpl::LocationUpdateCallback callback = base::Bind( 177 LocationArbitratorImpl::LocationUpdateCallback callback = base::Bind(
176 &GeolocationProviderImpl::OnLocationUpdate, base::Unretained(this)); 178 &GeolocationProviderImpl::OnLocationUpdate, base::Unretained(this));
177 return base::WrapUnique(new LocationArbitratorImpl(callback)); 179
180 // Use the embedder for service overrides or fall back to the default ones.
181 GeolocationProvider::ServiceOverrides* service_overrides =
182 GetContentClient()->browser()->GetGeolocationServiceOverrides();
183 if (!service_overrides)
184 service_overrides = new GeolocationProvider::ServiceOverrides;
185
186 return base::WrapUnique(
187 new LocationArbitratorImpl(callback, service_overrides));
178 } 188 }
179 189
180 } // namespace content 190 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698