| 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 "content/browser/geolocation/geolocation_service_impl.h" | 5 #include "content/browser/geolocation/geolocation_service_impl.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 9 #include "content/browser/geolocation/geolocation_service_context.h" | 11 #include "content/browser/geolocation/geolocation_service_context.h" |
| 10 #include "content/public/common/mojo_geoposition.mojom.h" | 12 #include "content/public/common/mojo_geoposition.mojom.h" |
| 11 | 13 |
| 12 namespace content { | 14 namespace content { |
| 13 | 15 |
| 14 namespace { | 16 namespace { |
| 15 | 17 |
| 16 // Geoposition error codes for reporting in UMA. | 18 // Geoposition error codes for reporting in UMA. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 code, | 57 code, |
| 56 GEOPOSITION_ERROR_CODE_COUNT); | 58 GEOPOSITION_ERROR_CODE_COUNT); |
| 57 } | 59 } |
| 58 | 60 |
| 59 } // namespace | 61 } // namespace |
| 60 | 62 |
| 61 GeolocationServiceImpl::GeolocationServiceImpl( | 63 GeolocationServiceImpl::GeolocationServiceImpl( |
| 62 mojo::InterfaceRequest<GeolocationService> request, | 64 mojo::InterfaceRequest<GeolocationService> request, |
| 63 GeolocationServiceContext* context, | 65 GeolocationServiceContext* context, |
| 64 const base::Closure& update_callback) | 66 const base::Closure& update_callback) |
| 65 : binding_(this, request.Pass()), | 67 : binding_(this, std::move(request)), |
| 66 context_(context), | 68 context_(context), |
| 67 update_callback_(update_callback), | 69 update_callback_(update_callback), |
| 68 high_accuracy_(false), | 70 high_accuracy_(false), |
| 69 has_position_to_report_(false) { | 71 has_position_to_report_(false) { |
| 70 DCHECK(context_); | 72 DCHECK(context_); |
| 71 binding_.set_connection_error_handler( | 73 binding_.set_connection_error_handler( |
| 72 base::Bind(&GeolocationServiceImpl::OnConnectionError, | 74 base::Bind(&GeolocationServiceImpl::OnConnectionError, |
| 73 base::Unretained(this))); | 75 base::Unretained(this))); |
| 74 } | 76 } |
| 75 | 77 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 ReportCurrentPosition(); | 187 ReportCurrentPosition(); |
| 186 } | 188 } |
| 187 | 189 |
| 188 void GeolocationServiceImpl::ReportCurrentPosition() { | 190 void GeolocationServiceImpl::ReportCurrentPosition() { |
| 189 position_callback_.Run(current_position_.Clone()); | 191 position_callback_.Run(current_position_.Clone()); |
| 190 position_callback_.reset(); | 192 position_callback_.reset(); |
| 191 has_position_to_report_ = false; | 193 has_position_to_report_ = false; |
| 192 } | 194 } |
| 193 | 195 |
| 194 } // namespace content | 196 } // namespace content |
| OLD | NEW |