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

Side by Side Diff: components/arc/net/arc_net_host_impl.h

Issue 1572483002: Implement OnGetNetworks for net.mojom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 2015 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 COMPONENTS_ARC_NET_ARC_NET_BRIDGE_IMPL_H_
6 #define COMPONENTS_ARC_NET_ARC_NET_BRIDGE_IMPL_H_
7
8 #include <stdint.h>
9 #include <string>
10 #include <vector>
11
12 #include "base/files/scoped_file.h"
13 #include "base/macros.h"
14 #include "components/arc/arc_bridge_service.h"
15 #include "components/arc/common/net.mojom.h"
16 #include "mojo/public/cpp/bindings/binding.h"
17
18 namespace arc {
19
20 class ArcBridgeService;
21
22 // Private implementation of ArcNetHost
23 class ArcNetHostImpl : public NetHost,
24 public ArcBridgeService::Observer {
25 public:
26 // The constructor will register an Observer with ArcBridgeService.
27 explicit ArcNetHostImpl(ArcBridgeService* arc_bridge_service);
28 ~ArcNetHostImpl() override;
29
30 // Calls Chrome API to get network properties.
31 void GetNetworksFromChrome(bool configured_only,
32 bool visible_only,
33 std::vector<std::string> *networks);
34
35 // Called when a GetNetworks call is sent from ARC.
36 void OnGetNetworks(int request_id,
37 bool configured_only,
38 bool visible_only) override;
39
40 // Request to send networks in response to get networks call from ARC.
41 bool SendNetworks(int request_id,
42 NetworkDataPtr data);
43
44 // Overridden from ArcBridgeService::Observer:
45 void OnNetInstanceReady() override;
46
47 static scoped_ptr<arc::NetHost> CreateNetHost(
48 ArcBridgeService* arc_bridge_service);
49
50 private:
51 // Owned by ArcServiceManager which makes sure ArcBridgeService is destroyed
52 // after ArcNetHost.
53 ArcBridgeService* arc_bridge_service_;
54
55 scoped_refptr<base::SequencedTaskRunner> origin_task_runner_;
56 mojo::Binding<arc::NetHost> binding_;
57
58 // WeakPtrFactory to use for callbacks.
59 base::WeakPtrFactory<ArcNetHostImpl> weak_factory_;
60
61 DISALLOW_COPY_AND_ASSIGN(ArcNetHostImpl);
62 };
63
64 } // namespace arc
65
66 #endif // COMPONENTS_ARC_NET_ARC_NET_BRIDGE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698