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_impl_context.h" | |
| 6 | |
| 7 #include "content/browser/geolocation/geolocation_service_impl.h" | |
| 8 | |
| 9 namespace content { | |
| 10 | |
| 11 GeolocationServiceImplContext::GeolocationServiceImplContext() | |
| 12 : paused_(false) { | |
| 13 } | |
| 14 | |
| 15 GeolocationServiceImplContext::~GeolocationServiceImplContext() { | |
| 16 // The context can die before its attached services if the WebContents | |
| 17 // shuts down while geolocation updates are active. | |
| 18 for (auto* service : attached_services_) { | |
| 19 service->ContextDestroyed(); | |
| 20 } | |
| 21 attached_services_.clear(); | |
| 22 } | |
| 23 | |
| 24 void GeolocationServiceImplContext::AddService( | |
| 25 GeolocationServiceImpl* service) { | |
| 26 attached_services_.push_back(service); | |
| 27 } | |
| 28 | |
| 29 void GeolocationServiceImplContext::RemoveService( | |
| 30 GeolocationServiceImpl* service) { | |
| 31 attached_services_.remove(service); | |
| 32 /* | |
|
Michael van Ouwerkerk
2014/10/08 14:13:08
?
blundell
2014/10/09 08:32:52
Done.
| |
| 33 auto it = std::find(attached_services_.begin(), attached_services_.end(), | |
| 34 service); | |
| 35 DCHECK(it != attached_services_.end()); | |
| 36 attached_services_.erase(it); | |
| 37 */ | |
| 38 } | |
| 39 | |
| 40 void GeolocationServiceImplContext::PauseUpdates() { | |
| 41 paused_ = true; | |
| 42 for (auto* service : attached_services_) { | |
| 43 service->PauseUpdates(); | |
| 44 } | |
| 45 } | |
| 46 | |
| 47 void GeolocationServiceImplContext::ResumeUpdates() { | |
| 48 paused_ = false; | |
| 49 for (auto* service : attached_services_) { | |
| 50 service->ResumeUpdates(); | |
| 51 } | |
| 52 } | |
| 53 | |
| 54 } // namespace content | |
| OLD | NEW |