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

Unified Diff: content/browser/geolocation/geolocation_service_context.h

Issue 1411063007: Add mojo::StrongBindingSet and use it in GeolocationServiceContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/geolocation/geolocation_service_context.h
diff --git a/content/browser/geolocation/geolocation_service_context.h b/content/browser/geolocation/geolocation_service_context.h
index 453c8b0dce2862ef600ea20b8ca4b1c3ecd0578c..68fc9c9427892604f364c536782186a47bcfdb64 100644
--- a/content/browser/geolocation/geolocation_service_context.h
+++ b/content/browser/geolocation/geolocation_service_context.h
@@ -5,28 +5,31 @@
#ifndef CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_SERVICE_CONTEXT_H_
#define CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_SERVICE_CONTEXT_H_
-#include "base/memory/scoped_vector.h"
#include "content/browser/geolocation/geolocation_service_impl.h"
+#include "content/common/geolocation_service.mojom.h"
+#include "content/public/browser/web_contents_user_data.h"
+#include "mojo/common/service_set.h"
namespace content {
+struct Geoposition;
// 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 GeolocationServiceContext {
+class GeolocationServiceContext
+ : public WebContentsUserData<GeolocationServiceContext> {
public:
- GeolocationServiceContext();
- virtual ~GeolocationServiceContext();
+ explicit GeolocationServiceContext(WebContents* web_contents);
+ ~GeolocationServiceContext() override;
+
+ static GeolocationServiceContext* GetOrCreateForWebContents(
+ WebContents* web_contents);
// Creates a GeolocationServiceImpl that is weakly bound to |request|.
// |update_callback| will be called when services send
Anand Mistry (off Chromium) 2015/11/10 04:53:39 update comment
Sam McNally 2015/11/11 07:04:02 Done.
// location updates to their clients.
- void CreateService(const base::Closure& update_callback,
- mojo::InterfaceRequest<GeolocationService> request);
-
- // Called when a service has a connection error. After this call, it is no
- // longer safe to access |service|.
- void ServiceHadConnectionError(GeolocationServiceImpl* service);
+ static void CreateService(RenderFrameHost* render_frame_host,
+ mojo::InterfaceRequest<GeolocationService> request);
// Pauses and resumes geolocation. Resuming when nothing is paused is a
// no-op. If a service is added while geolocation is paused, that service
@@ -45,7 +48,12 @@ class GeolocationServiceContext {
void ClearOverride();
private:
- ScopedVector<GeolocationServiceImpl> services_;
+ friend class GeolocationServiceImpl;
+
+ void CreateServiceImpl(RenderFrameHost* render_frame_host,
+ mojo::InterfaceRequest<GeolocationService> request);
+
+ mojo::ServiceSet<GeolocationService, GeolocationServiceImpl> services_;
bool paused_;
scoped_ptr<Geoposition> geoposition_override_;

Powered by Google App Engine
This is Rietveld 408576698