| OLD | NEW |
| 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 #include "content/public/browser/content_browser_client.h" |
| 18 #include "content/public/browser/geolocation_delegate.h" |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 | 21 |
| 21 GeolocationProvider* GeolocationProvider::GetInstance() { | 22 GeolocationProvider* GeolocationProvider::GetInstance() { |
| 22 return GeolocationProviderImpl::GetInstance(); | 23 return GeolocationProviderImpl::GetInstance(); |
| 23 } | 24 } |
| 24 | 25 |
| 25 std::unique_ptr<GeolocationProvider::Subscription> | 26 std::unique_ptr<GeolocationProvider::Subscription> |
| 26 GeolocationProviderImpl::AddLocationUpdateCallback( | 27 GeolocationProviderImpl::AddLocationUpdateCallback( |
| 27 const LocationUpdateCallback& callback, | 28 const LocationUpdateCallback& callback, |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 } | 173 } |
| 173 | 174 |
| 174 std::unique_ptr<LocationArbitrator> | 175 std::unique_ptr<LocationArbitrator> |
| 175 GeolocationProviderImpl::CreateArbitrator() { | 176 GeolocationProviderImpl::CreateArbitrator() { |
| 176 LocationArbitratorImpl::LocationUpdateCallback callback = base::Bind( | 177 LocationArbitratorImpl::LocationUpdateCallback callback = base::Bind( |
| 177 &GeolocationProviderImpl::OnLocationUpdate, base::Unretained(this)); | 178 &GeolocationProviderImpl::OnLocationUpdate, base::Unretained(this)); |
| 178 | 179 |
| 179 // Use the embedder's Delegate or fall back to the default one. | 180 // Use the embedder's Delegate or fall back to the default one. |
| 180 delegate_.reset(GetContentClient()->browser()->CreateGeolocationDelegate()); | 181 delegate_.reset(GetContentClient()->browser()->CreateGeolocationDelegate()); |
| 181 if (!delegate_) | 182 if (!delegate_) |
| 182 delegate_.reset(new GeolocationProvider::Delegate); | 183 delegate_.reset(new GeolocationDelegate); |
| 183 | 184 |
| 184 return base::WrapUnique( | 185 return base::WrapUnique( |
| 185 new LocationArbitratorImpl(callback, delegate_.get())); | 186 new LocationArbitratorImpl(callback, delegate_.get())); |
| 186 } | 187 } |
| 187 | 188 |
| 188 } // namespace content | 189 } // namespace content |
| OLD | NEW |