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

Unified Diff: blimp/engine/feature/geolocation/engine_geolocation_feature.h

Issue 2091023006: Adds EngineGeolocationFeature for Blimp Geolocation project. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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: blimp/engine/feature/geolocation/engine_geolocation_feature.h
diff --git a/blimp/engine/feature/geolocation/engine_geolocation_feature.h b/blimp/engine/feature/geolocation/engine_geolocation_feature.h
new file mode 100644
index 0000000000000000000000000000000000000000..bd0ef390cfe5bee461c8ac5e0c3d2471f3f1ab26
--- /dev/null
+++ b/blimp/engine/feature/geolocation/engine_geolocation_feature.h
@@ -0,0 +1,62 @@
+// Copyright 2016 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 BLIMP_ENGINE_FEATURE_GEOLOCATION_ENGINE_GEOLOCATION_FEATURE_H_
+#define BLIMP_ENGINE_FEATURE_GEOLOCATION_ENGINE_GEOLOCATION_FEATURE_H_
+
+#include "blimp/net/blimp_message_processor.h"
+#include "content/public/common/geoposition.h"
+
+namespace blimp {
+namespace engine {
+
+// Handles all incoming and outgoing protobuf messages types tied to
+// geolocation. Delegates can be added to be notified of incoming
Kevin M 2016/06/27 16:57:41 Can you rephrase the last sentence to use the acti
CJ 2016/06/27 22:04:27 Done.
+// messages.
+class EngineGeolocationFeature : public BlimpMessageProcessor {
+ public:
+ // A delegate to be notified of geolocation related incoming events.
+ class GeolocationMessageDelegate {
Kevin M 2016/06/27 16:57:42 "Delegate" is fine here, since all references to t
CJ 2016/06/27 22:04:27 Done.
+ public:
+ // Called when the client is sending a Geolocation to the Engine.
+ // May also encapsulate an ErrorCode, to be passed through to the
+ // JavaScript.
+ virtual void OnLocationResponse(const content::Geoposition& position);
Kevin M 2016/06/27 16:57:41 Make this pure virtual?
CJ 2016/06/27 22:04:26 Done.
+ };
+
+ ~EngineGeolocationFeature() override;
+
+ void set_geolocation_message_sender(
Kevin M 2016/06/27 16:57:41 nit: I think we've been calling it "outgoing_messa
CJ 2016/06/27 22:04:27 I was following the pattern found here: https://cs
Kevin M 2016/06/28 01:14:38 Yeah, it needs fixin'. Use outgoing_message_proces
CJ 2016/06/29 00:12:12 Done.
+ std::unique_ptr<BlimpMessageProcessor> message_processor);
+
+ // Notifies the client that the is listening engine is listening for
+ // geoposition information with the given accuracy.
+ void SendUpdateListenStateMessage(bool enable_high_accuracy);
Kevin M 2016/06/27 16:57:42 Who's supposed to call these methods? Does it make
CJ 2016/06/27 22:04:27 BlimpLocationProvider would call this through it's
Kevin M 2016/06/28 01:14:38 I think that we should probably invert that relati
CJ 2016/06/29 00:12:12 Done.
+
+ // Notifies the client that the engine is no long listening for updates.
Kevin M 2016/06/27 16:57:41 typo: longer
CJ 2016/06/27 22:04:27 Done.
+ void SendStopListenStateMessage();
+
+ // Notifies the client that an update in geoposition is needed as soon
Kevin M 2016/06/27 16:57:41 suggestion: Requests an updated geoposition from t
CJ 2016/06/27 22:04:27 Done.
+ // as possible.
+ void SendRequestRefreshMessage();
+
+ void SetDelegate(GeolocationMessageDelegate* delegate);
+
+ // BlimpMessageProcessor implementation.
+ void ProcessMessage(std::unique_ptr<BlimpMessage> message,
+ const net::CompletionCallback& callback) override;
+
+ private:
+ GeolocationMessageDelegate* delegate_;
Kevin M 2016/06/27 16:57:41 = nullptr;
CJ 2016/06/27 22:04:27 Done.
+ std::unique_ptr<BlimpMessageProcessor> geolocation_message_sender_;
+
+ void UpdateGeolocation(content::Geoposition* geoposition);
+
+ DISALLOW_COPY_AND_ASSIGN(EngineGeolocationFeature);
+};
+
+} // namespace engine
+} // namespace blimp
+
+#endif // BLIMP_ENGINE_FEATURE_GEOLOCATION_ENGINE_GEOLOCATION_FEATURE_H_

Powered by Google App Engine
This is Rietveld 408576698