Chromium Code Reviews| OLD | NEW |
|---|---|
| (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, | |
|
stevenjb
2016/01/12 22:14:04
Unused?
abhishekbh
2016/01/12 22:42:26
There is another Android API that will ask for con
stevenjb
2016/01/12 22:50:47
I mean the entire function does not exist in the C
Kevin Cernekee
2016/01/12 23:53:27
Yes, left over from a previous iteration. Fixed.
| |
| 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 private: | |
| 48 // Owned by ArcServiceManager which makes sure ArcBridgeService is destroyed | |
| 49 // after ArcNetHost. | |
| 50 ArcBridgeService* arc_bridge_service_; | |
| 51 | |
| 52 scoped_refptr<base::SequencedTaskRunner> origin_task_runner_; | |
| 53 mojo::Binding<arc::NetHost> binding_; | |
| 54 | |
| 55 // WeakPtrFactory to use for callbacks. | |
| 56 base::WeakPtrFactory<ArcNetHostImpl> weak_factory_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(ArcNetHostImpl); | |
| 59 }; | |
| 60 | |
| 61 } // namespace arc | |
| 62 | |
| 63 #endif // COMPONENTS_ARC_NET_ARC_NET_BRIDGE_IMPL_H_ | |
| OLD | NEW |