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

Side by Side Diff: content/browser/geolocation/geolocation_service_impl.cc

Issue 1262613005: Remove interface_impl.h and error_handler.h usage from chromium (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 4 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 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "content/browser/geolocation/geolocation_service_context.h" 9 #include "content/browser/geolocation/geolocation_service_context.h"
10 #include "content/public/common/mojo_geoposition.mojom.h" 10 #include "content/public/common/mojo_geoposition.mojom.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 GeolocationServiceImpl::GeolocationServiceImpl( 61 GeolocationServiceImpl::GeolocationServiceImpl(
62 mojo::InterfaceRequest<GeolocationService> request, 62 mojo::InterfaceRequest<GeolocationService> request,
63 GeolocationServiceContext* context, 63 GeolocationServiceContext* context,
64 const base::Closure& update_callback) 64 const base::Closure& update_callback)
65 : binding_(this, request.Pass()), 65 : binding_(this, request.Pass()),
66 context_(context), 66 context_(context),
67 update_callback_(update_callback), 67 update_callback_(update_callback),
68 high_accuracy_(false), 68 high_accuracy_(false),
69 has_position_to_report_(false) { 69 has_position_to_report_(false) {
70 DCHECK(context_); 70 DCHECK(context_);
71 binding_.set_error_handler(this); 71 binding_.set_connection_error_handler(
72 base::Bind(&GeolocationServiceImpl::OnConnectionError,
73 base::Unretained(this)));
72 } 74 }
73 75
74 GeolocationServiceImpl::~GeolocationServiceImpl() { 76 GeolocationServiceImpl::~GeolocationServiceImpl() {
75 // Make sure to respond to any pending callback even without a valid position. 77 // Make sure to respond to any pending callback even without a valid position.
76 if (!position_callback_.is_null()) { 78 if (!position_callback_.is_null()) {
77 if (!current_position_.valid) { 79 if (!current_position_.valid) {
78 current_position_.error_code = MojoGeoposition::ErrorCode( 80 current_position_.error_code = MojoGeoposition::ErrorCode(
79 GEOPOSITION_ERROR_CODE_POSITION_UNAVAILABLE); 81 GEOPOSITION_ERROR_CODE_POSITION_UNAVAILABLE);
80 current_position_.error_message = mojo::String(""); 82 current_position_.error_message = mojo::String("");
81 } 83 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 ReportCurrentPosition(); 185 ReportCurrentPosition();
184 } 186 }
185 187
186 void GeolocationServiceImpl::ReportCurrentPosition() { 188 void GeolocationServiceImpl::ReportCurrentPosition() {
187 position_callback_.Run(current_position_.Clone()); 189 position_callback_.Run(current_position_.Clone());
188 position_callback_.reset(); 190 position_callback_.reset();
189 has_position_to_report_ = false; 191 has_position_to_report_ = false;
190 } 192 }
191 193
192 } // namespace content 194 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/geolocation/geolocation_service_impl.h ('k') | content/browser/permissions/permission_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698