| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "device/geolocation/geolocation_service_context.h" | 5 #include "device/geolocation/geolocation_service_context.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "device/geolocation/geolocation_service_impl.h" | 10 #include "device/geolocation/geolocation_service_impl.h" |
| 11 | 11 |
| 12 namespace device { | 12 namespace device { |
| 13 | 13 |
| 14 GeolocationServiceContext::GeolocationServiceContext() {} | 14 GeolocationServiceContext::GeolocationServiceContext() {} |
| 15 | 15 |
| 16 GeolocationServiceContext::~GeolocationServiceContext() {} | 16 GeolocationServiceContext::~GeolocationServiceContext() {} |
| 17 | 17 |
| 18 void GeolocationServiceContext::CreateService( | 18 void GeolocationServiceContext::CreateService( |
| 19 const base::Closure& update_callback, | |
| 20 mojo::InterfaceRequest<mojom::GeolocationService> request) { | 19 mojo::InterfaceRequest<mojom::GeolocationService> request) { |
| 21 GeolocationServiceImpl* service = | 20 GeolocationServiceImpl* service = |
| 22 new GeolocationServiceImpl(std::move(request), this, update_callback); | 21 new GeolocationServiceImpl(std::move(request), this); |
| 23 services_.push_back(base::WrapUnique<GeolocationServiceImpl>(service)); | 22 services_.push_back(base::WrapUnique<GeolocationServiceImpl>(service)); |
| 24 if (geoposition_override_) | 23 if (geoposition_override_) |
| 25 service->SetOverride(*geoposition_override_.get()); | 24 service->SetOverride(*geoposition_override_.get()); |
| 26 else | 25 else |
| 27 service->StartListeningForUpdates(); | 26 service->StartListeningForUpdates(); |
| 28 } | 27 } |
| 29 | 28 |
| 30 void GeolocationServiceContext::ServiceHadConnectionError( | 29 void GeolocationServiceContext::ServiceHadConnectionError( |
| 31 GeolocationServiceImpl* service) { | 30 GeolocationServiceImpl* service) { |
| 32 auto it = | 31 auto it = |
| (...skipping 13 matching lines...) Expand all Loading... |
| 46 } | 45 } |
| 47 } | 46 } |
| 48 | 47 |
| 49 void GeolocationServiceContext::ClearOverride() { | 48 void GeolocationServiceContext::ClearOverride() { |
| 50 for (auto& service : services_) { | 49 for (auto& service : services_) { |
| 51 service->ClearOverride(); | 50 service->ClearOverride(); |
| 52 } | 51 } |
| 53 } | 52 } |
| 54 | 53 |
| 55 } // namespace device | 54 } // namespace device |
| OLD | NEW |