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

Unified Diff: content/browser/geofencing/geofencing_provider.h

Issue 586163003: Basic implementation of GeofencingManager class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@geofencing5
Patch Set: scope registrations by service worker Created 6 years, 2 months 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/geofencing/geofencing_provider.h
diff --git a/content/browser/geofencing/geofencing_provider.h b/content/browser/geofencing/geofencing_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..79d922173a659c15b8fe079d5b8b3fc150b928d7
--- /dev/null
+++ b/content/browser/geofencing/geofencing_provider.h
@@ -0,0 +1,45 @@
+// 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_GEOFENCING_GEOFENCING_PROVIDER_H_
+#define CONTENT_BROWSER_GEOFENCING_GEOFENCING_PROVIDER_H_
+
+#include "base/callback_forward.h"
+#include "content/common/geofencing_status.h"
+
+namespace blink {
+struct WebCircularGeofencingRegion;
+};
+
+namespace content {
+
+class GeofencingProvider {
+ public:
+ // Callback that gets called on completion of registering a new region. The
+ // status indicates success or failure, and in case of success, an id to use
+ // to later unregister the region is passed as |registration_id|. If
+ // registration failed, the value of |registration_id| is undefined.
Michael van Ouwerkerk 2014/10/06 16:43:42 I think it would be clearer to set registration_id
Marijn Kruisselbrink 2014/10/06 19:14:11 Changed the comment to document what value provide
+ typedef base::Callback<void(GeofencingStatus, int registration_id)>
+ RegisterCallback;
+
+ virtual ~GeofencingProvider() {}
+
+ // Called by |GeofencingManager| to register a new fence. GeofencingManager is
+ // responsible for handling things like duplicate regions, so platform
+ // specific implementations shouldn't have to worry about things like that.
+ // Also GeofencingManager should be making sure the total number of geofences
Michael van Ouwerkerk 2014/10/06 16:43:42 How would the caller know what the limit of the pl
Marijn Kruisselbrink 2014/10/06 19:14:11 Yes, that's something the provider API will have t
+ // that is registered with the platform specific provider does not exceed the
+ // number of regions supported by the platform, although that isn't
+ // implemented yet.
+ virtual void RegisterRegion(const blink::WebCircularGeofencingRegion& region,
+ const RegisterCallback& callback) = 0;
+
+ // Called by |GeofencingManager| to unregister an existing registration. Will
+ // only be called once for each registration.
+ virtual void UnregisterRegion(int registration_id) = 0;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_GEOFENCING_GEOFENCING_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698