Index: content/browser/geolocation/geolocation_service_impl_context.cc |
diff --git a/content/browser/geolocation/geolocation_service_impl_context.cc b/content/browser/geolocation/geolocation_service_impl_context.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5bb26ea2f03deb7ecf3178abaf75f9b6895e9735 |
--- /dev/null |
+++ b/content/browser/geolocation/geolocation_service_impl_context.cc |
@@ -0,0 +1,54 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/browser/geolocation/geolocation_service_impl_context.h" |
+ |
+#include "content/browser/geolocation/geolocation_service_impl.h" |
+ |
+namespace content { |
+ |
+GeolocationServiceImplContext::GeolocationServiceImplContext() |
+ : paused_(false) { |
+} |
+ |
+GeolocationServiceImplContext::~GeolocationServiceImplContext() { |
+ // The context can die before its attached services if the WebContents |
+ // shuts down while geolocation updates are active. |
+ for (auto* service : attached_services_) { |
+ service->ContextDestroyed(); |
+ } |
+ attached_services_.clear(); |
+} |
+ |
+void GeolocationServiceImplContext::AddService( |
+ GeolocationServiceImpl* service) { |
+ attached_services_.push_back(service); |
+} |
+ |
+void GeolocationServiceImplContext::RemoveService( |
+ GeolocationServiceImpl* service) { |
+ attached_services_.remove(service); |
+ /* |
Michael van Ouwerkerk
2014/10/08 14:13:08
?
blundell
2014/10/09 08:32:52
Done.
|
+ auto it = std::find(attached_services_.begin(), attached_services_.end(), |
+ service); |
+ DCHECK(it != attached_services_.end()); |
+ attached_services_.erase(it); |
+ */ |
+} |
+ |
+void GeolocationServiceImplContext::PauseUpdates() { |
+ paused_ = true; |
+ for (auto* service : attached_services_) { |
+ service->PauseUpdates(); |
+ } |
+} |
+ |
+void GeolocationServiceImplContext::ResumeUpdates() { |
+ paused_ = false; |
+ for (auto* service : attached_services_) { |
+ service->ResumeUpdates(); |
+ } |
+} |
+ |
+} // namespace content |