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

Side by Side Diff: blimp/client/core/geolocation/geolocation_feature.h

Issue 2624903006: Remove all blimp client code. (Closed)
Patch Set: Update buildbot configuration Created 3 years, 11 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_CORE_GEOLOCATION_GEOLOCATION_FEATURE_H_
6 #define BLIMP_CLIENT_CORE_GEOLOCATION_GEOLOCATION_FEATURE_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "blimp/common/proto/geolocation.pb.h"
12 #include "blimp/net/blimp_message_processor.h"
13 #include "device/geolocation/geoposition.h"
14 #include "device/geolocation/location_provider.h"
15
16 namespace blimp {
17 namespace client {
18
19 // Client-side feature handling geolocation messages.
20 class GeolocationFeature : public BlimpMessageProcessor {
21 public:
22 explicit GeolocationFeature(
23 std::unique_ptr<device::LocationProvider> location_provider);
24 ~GeolocationFeature() override;
25
26 // Sets the BlimpMessageProcessor that will be used to send
27 // BlimpMessage::GEOLOCATION messages to the engine.
28 void set_outgoing_message_processor(
29 std::unique_ptr<BlimpMessageProcessor> processor);
30
31 // BlimpMessageProcessor implementation.
32 void ProcessMessage(std::unique_ptr<BlimpMessage> message,
33 const net::CompletionCallback& callback) override;
34
35 private:
36 // Sends engine an update of the client's geoposition.
37 void OnLocationUpdate(const device::LocationProvider* location_provider,
38 const device::Geoposition& position);
39
40 // Handles a request from the Engine to change the accuracy level of the
41 // Geolocation information reported to it.
42 void SetInterestLevel(GeolocationSetInterestLevelMessage::Level level);
43
44 // Sends a GeolocationPositionMessage that reflects the given
45 // geoposition.
46 void SendGeolocationPositionMessage(const device::Geoposition& position);
47
48 // Sends a GeolocationErrorMessage.
49 void SendGeolocationErrorMessage(
50 GeolocationErrorMessage::ErrorCode error_code,
51 const std::string& error_message);
52
53 // Called when a message send completes.
54 void OnSendComplete(int result);
55
56 // Used to obtain the client's location.
57 std::unique_ptr<device::LocationProvider> location_provider_;
58
59 // Used to send BlimpMessage::GEOLOCATION message to the engine.
60 std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_;
61
62 // True if a message is in the process of being sent.
63 bool am_sending_message_ = false;
64
65 // True if location has been updated but a message cannot be sent at the
66 // moment.
67 bool need_to_send_message_ = false;
68
69 DISALLOW_COPY_AND_ASSIGN(GeolocationFeature);
70 };
71
72 } // namespace client
73 } // namespace blimp
74
75 #endif // BLIMP_CLIENT_CORE_GEOLOCATION_GEOLOCATION_FEATURE_H_
OLDNEW
« no previous file with comments | « blimp/client/core/geolocation/DEPS ('k') | blimp/client/core/geolocation/geolocation_feature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698