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

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: Added a TODO Created 4 years, 5 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"
17 18
18 namespace content { 19 namespace content {
19 20
20 GeolocationProvider* GeolocationProvider::GetInstance() { 21 GeolocationProvider* GeolocationProvider::GetInstance() {
21 return GeolocationProviderImpl::GetInstance(); 22 return GeolocationProviderImpl::GetInstance();
22 } 23 }
23 24
24 std::unique_ptr<GeolocationProvider::Subscription> 25 std::unique_ptr<GeolocationProvider::Subscription>
25 GeolocationProviderImpl::AddLocationUpdateCallback( 26 GeolocationProviderImpl::AddLocationUpdateCallback(
26 const LocationUpdateCallback& callback, 27 const LocationUpdateCallback& callback,
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 168
168 void GeolocationProviderImpl::CleanUp() { 169 void GeolocationProviderImpl::CleanUp() {
169 DCHECK(OnGeolocationThread()); 170 DCHECK(OnGeolocationThread());
170 arbitrator_.reset(); 171 arbitrator_.reset();
171 } 172 }
172 173
173 std::unique_ptr<LocationArbitrator> 174 std::unique_ptr<LocationArbitrator>
174 GeolocationProviderImpl::CreateArbitrator() { 175 GeolocationProviderImpl::CreateArbitrator() {
175 LocationArbitratorImpl::LocationUpdateCallback callback = base::Bind( 176 LocationArbitratorImpl::LocationUpdateCallback callback = base::Bind(
176 &GeolocationProviderImpl::OnLocationUpdate, base::Unretained(this)); 177 &GeolocationProviderImpl::OnLocationUpdate, base::Unretained(this));
177 return base::WrapUnique(new LocationArbitratorImpl(callback)); 178
179 // Use the embedder's Delegate or fall back to the default one.
180 delegate_.reset(GetContentClient()->browser()->CreateGeolocationDelegate());
181 if (!delegate_)
182 delegate_.reset(new GeolocationProvider::Delegate);
183
184 return base::WrapUnique(
185 new LocationArbitratorImpl(callback, delegate_.get()));
178 } 186 }
179 187
180 } // namespace content 188 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/geolocation/geolocation_provider_impl.h ('k') | content/browser/geolocation/location_arbitrator_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698