Index: content/browser/geolocation/geolocation_service_impl_context.h |
diff --git a/content/browser/geolocation/geolocation_service_impl_context.h b/content/browser/geolocation/geolocation_service_impl_context.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9b0c855ef66cade8c28ae470b80d3208a6e46d3d |
--- /dev/null |
+++ b/content/browser/geolocation/geolocation_service_impl_context.h |
@@ -0,0 +1,41 @@ |
+// 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. |
+ |
+#ifndef CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_SERVICE_IMPL_CONTEXT_H_ |
+#define CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_SERVICE_IMPL_CONTEXT_H_ |
+ |
+#include <list> |
+ |
+namespace content { |
+class GeolocationServiceImpl; |
+ |
+// Provides information to a set of GeolocationServiceImpl instances that are |
+// associated with a given context. Notably, allows pausing and resuming |
+// geolocation on these instances. |
+class GeolocationServiceImplContext { |
+ public: |
+ GeolocationServiceImplContext(); |
+ virtual ~GeolocationServiceImplContext(); |
+ |
+ // Adds and removes a service to this context. |
+ void AddService(GeolocationServiceImpl* service); |
+ void RemoveService(GeolocationServiceImpl* service); |
+ |
+ // Pauses and resumes geolocation. Resuming when nothing is paused is a |
+ // no-op. If a service is added while geolocation is paused, that service |
+ // will not get geolocation updates until geolocation is resumed. |
+ void PauseUpdates(); |
+ void ResumeUpdates(); |
+ |
+ // Returns whether geolocation updates are currently paused. |
+ bool paused() { return paused_; } |
+ |
+ private: |
+ std::list<GeolocationServiceImpl*> attached_services_; |
+ bool paused_; |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_SERVICE_IMPL_CONTEXT_H_ |