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

Side by Side Diff: blimp/client/feature/geolocation_feature.h

Issue 2161223003: Adds GeolocationFeature for Blimp Geolocation project. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@engine_feature_prep
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BLIMP_CLIENT_FEATURE_GEOLOCATION_FEATURE_H_
6 #define BLIMP_CLIENT_FEATURE_GEOLOCATION_FEATURE_H_
7
8 #include <memory>
9
10 #include "blimp/common/proto/geolocation.pb.h"
11 #include "blimp/net/blimp_message_processor.h"
12 #include "content/public/common/geoposition.h"
13
14 namespace blimp {
15 namespace client {
16
17 // Handles all incoming and outgoing protobu messages of type
Kevin M 2016/07/20 17:30:15 typo This is a literal description of how the cla
CJ 2016/07/20 23:22:10 Done.
18 // Geolocation. A delegate can be added to be notified of incoming messages.
19 class GeolocationFeature : public BlimpMessageProcessor {
20 public:
21 // A delegate to be notified of specific geolocation events, such as
22 // change of interest in geolocation updates.
23 class GeolocationFeatureDelegate {
24 public:
25 virtual ~GeolocationFeatureDelegate() {}
Kevin M 2016/07/20 17:30:16 Don't need a virtual dtor if the delegate object i
CJ 2016/07/20 23:22:10 Done.
26 virtual void OnGeolocationInterestUpdate(
Kevin M 2016/07/20 17:30:16 Document each method and add newlines
CJ 2016/07/20 23:22:11 Done.
27 GeolocationSetInterestLevelMessage::Level level);
Kevin M 2016/07/20 17:30:15 Make these methods pure virtual.
CJ 2016/07/20 23:22:10 Done.
28 virtual void OnRequestRefresh();
29 };
30
31 GeolocationFeature();
32 ~GeolocationFeature() override;
33
34 // Sets the BlimpMessageProcessor that will be used to send
35 // BlimpMessage::GEOLOCATION messages to the engine.
36 void set_outgoing_message_processor(
37 std::unique_ptr<BlimpMessageProcessor> processor);
38
39 // Sets a GeolocationFeatureDelegate to be notified of all geolocation
Kevin M 2016/07/20 17:30:16 "messages" probably not so much... how about "even
CJ 2016/07/20 23:22:11 Done.
40 // messages from the engine.
41 void SetDelegate(GeolocationFeatureDelegate* delegate);
42
43 void OnLocationUpdate(const content::Geoposition& position);
Kevin M 2016/07/20 17:30:15 Add comment
CJ 2016/07/20 23:22:10 Done.
44
45 // BlimpMessageProcessor implementation.
46 void ProcessMessage(std::unique_ptr<BlimpMessage> message,
47 const net::CompletionCallback& callback) override;
48
49 private:
50 void SendGeolocationPositionMessage(const content::Geoposition& position);
Kevin M 2016/07/20 17:30:15 Add comment
CJ 2016/07/20 23:22:11 Done.
51 void SendGeolocationErrorMessage(const content::Geoposition& position);
Kevin M 2016/07/20 17:30:16 Add comment
CJ 2016/07/20 23:22:10 Done.
52
53 GeolocationFeatureDelegate* delegate_;
Kevin M 2016/07/20 17:30:16 = nullptr;
CJ 2016/07/20 23:22:11 Done.
54
55 // Used to send BlimpMessage::GEOLOCATION message to the engine.
56 std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_;
57
58 DISALLOW_COPY_AND_ASSIGN(GeolocationFeature);
59 };
60
61 } // namespace client
62 } // namespace blimp
63
64 #endif // BLIMP_CLIENT_FEATURE_GEOLOCATION_FEATURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698