Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/browser/geolocation/geolocation_service_context.h" | |
| 6 | |
| 7 namespace content { | |
| 8 | |
| 9 GeolocationServiceContext::GeolocationServiceContext() : paused_(false) { | |
| 10 } | |
| 11 | |
| 12 GeolocationServiceContext::~GeolocationServiceContext() { | |
| 13 } | |
| 14 | |
| 15 void GeolocationServiceContext::CreateService( | |
| 16 const base::Closure& update_callback, | |
| 17 mojo::InterfaceRequest<GeolocationService> request) { | |
| 18 GeolocationServiceImpl* service = | |
| 19 new GeolocationServiceImpl(this, update_callback); | |
|
Charlie Reis
2014/10/21 22:28:32
Just want to make sure I follow how things work in
blundell
2014/10/22 16:05:14
Yes.
Charlie Reis
2014/10/22 16:11:55
Yes, I think that would do. I imagine we'll want
| |
| 20 if (geoposition_override_) | |
| 21 service->SetOverride(*geoposition_override_.get()); | |
| 22 services_.push_back(service); | |
| 23 mojo::WeakBindToRequest(service, &request); | |
| 24 } | |
| 25 | |
| 26 void GeolocationServiceContext::ServiceHadConnectionError( | |
| 27 GeolocationServiceImpl* service) { | |
| 28 auto it = std::find(services_.begin(), services_.end(), service); | |
| 29 DCHECK(it != services_.end()); | |
| 30 services_.erase(it); | |
| 31 } | |
| 32 | |
| 33 void GeolocationServiceContext::PauseUpdates() { | |
| 34 paused_ = true; | |
| 35 for (auto* service : services_) { | |
|
Charlie Reis
2014/10/21 22:28:32
nit: No braces needed on one line body (here and b
blundell
2014/10/23 12:27:01
I'd prefer to leave the braces...loops without bra
| |
| 36 service->PauseUpdates(); | |
| 37 } | |
| 38 } | |
| 39 | |
| 40 void GeolocationServiceContext::ResumeUpdates() { | |
| 41 paused_ = false; | |
| 42 for (auto* service : services_) { | |
| 43 service->ResumeUpdates(); | |
| 44 } | |
| 45 } | |
| 46 | |
| 47 void GeolocationServiceContext::SetOverride( | |
| 48 scoped_ptr<Geoposition> geoposition) { | |
| 49 geoposition_override_.swap(geoposition); | |
| 50 for (auto* service : services_) { | |
| 51 service->SetOverride(*geoposition_override_.get()); | |
| 52 } | |
| 53 } | |
| 54 | |
| 55 void GeolocationServiceContext::ClearOverride() { | |
| 56 for (auto* service : services_) { | |
| 57 service->ClearOverride(); | |
| 58 } | |
| 59 } | |
| 60 | |
| 61 } // namespace content | |
| OLD | NEW |