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_HOST_IMPL_H_ |
| 6 #define COMPONENTS_ARC_NET_ARC_NET_HOST_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 "base/threading/thread_checker.h" |
| 15 #include "components/arc/arc_bridge_service.h" |
| 16 #include "components/arc/common/net.mojom.h" |
| 17 #include "mojo/public/cpp/bindings/binding.h" |
| 18 |
| 19 namespace arc { |
| 20 |
| 21 class ArcBridgeService; |
| 22 |
| 23 // Private implementation of ArcNetHost |
| 24 class ArcNetHostImpl : public NetHost, 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 // Called when a GetNetworks call is sent from ARC. |
| 31 void GetNetworks(bool configured_only, |
| 32 bool visible_only, |
| 33 const GetNetworksCallback& callback); |
| 34 |
| 35 // Overridden from ArcBridgeService::Observer: |
| 36 void OnNetInstanceReady() override; |
| 37 |
| 38 private: |
| 39 // Owned by ArcServiceManager which makes sure ArcBridgeService is destroyed |
| 40 // after ArcNetHost. |
| 41 ArcBridgeService* arc_bridge_service_; |
| 42 |
| 43 base::ThreadChecker thread_checker_; |
| 44 mojo::Binding<arc::NetHost> binding_; |
| 45 |
| 46 // WeakPtrFactory to use for callbacks. |
| 47 base::WeakPtrFactory<ArcNetHostImpl> weak_factory_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(ArcNetHostImpl); |
| 50 }; |
| 51 |
| 52 } // namespace arc |
| 53 |
| 54 #endif // COMPONENTS_ARC_NET_ARC_NET_HOST_IMPL_H_ |
OLD | NEW |