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

Side by Side 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: Merge with head 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_ENGINE_FEATURE_GEOLOCATION_ENGINE_GEOLOCATION_FEATURE_H_
6 #define BLIMP_ENGINE_FEATURE_GEOLOCATION_ENGINE_GEOLOCATION_FEATURE_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "blimp/engine/feature/geolocation/blimp_location_provider.h"
10 #include "blimp/net/blimp_message_processor.h"
11 #include "content/public/browser/geolocation_delegate.h"
12 #include "content/public/browser/location_provider.h"
13 #include "content/public/common/geoposition.h"
14
15 namespace blimp {
16 namespace engine {
17
18 // Handles all incoming and outgoing protobuf messages types tied to
19 // geolocation.
20 class EngineGeolocationFeature : public BlimpMessageProcessor,
21 public BlimpLocationProvider::Delegate {
22 public:
23 EngineGeolocationFeature();
24 ~EngineGeolocationFeature() override;
25
26 void set_outgoing_message_processor(
27 std::unique_ptr<BlimpMessageProcessor> message_processor);
28
29 std::unique_ptr<content::GeolocationDelegate> CreateGeolocationDelegate();
30
31 // BlimpMessageProcessor implementation.
32 void ProcessMessage(std::unique_ptr<BlimpMessage> message,
33 const net::CompletionCallback& callback) override;
34
35 private:
36 void NotifyCallback(const content::Geoposition& position);
37
38 // BlimpLocationProvider::Delegate implementation.
39 void RequestAccuracy(
40 GeolocationSetInterestLevelMessage::Level level) override;
41 void RequestRefresh() override;
42 void SetUpdateCallback(
43 const base::Callback<void(const content::Geoposition&)>& callback)
44 override;
45
46 std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_;
47 base::Callback<void(const content::Geoposition&)>
48 geoposition_received_callback_;
49 base::WeakPtrFactory<EngineGeolocationFeature> weak_factory_;
50
51 DISALLOW_COPY_AND_ASSIGN(EngineGeolocationFeature);
52 };
53
54 } // namespace engine
55 } // namespace blimp
56
57 #endif // BLIMP_ENGINE_FEATURE_GEOLOCATION_ENGINE_GEOLOCATION_FEATURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698