OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_ARC_NET_ARC_NET_HOST_IMPL_H_ | 5 #ifndef COMPONENTS_ARC_NET_ARC_NET_HOST_IMPL_H_ |
6 #define COMPONENTS_ARC_NET_ARC_NET_HOST_IMPL_H_ | 6 #define COMPONENTS_ARC_NET_ARC_NET_HOST_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/files/scoped_file.h" | 12 #include "base/files/scoped_file.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" |
14 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
15 #include "chromeos/network/network_state_handler_observer.h" | 16 #include "chromeos/network/network_state_handler_observer.h" |
16 #include "components/arc/arc_bridge_service.h" | 17 #include "components/arc/arc_bridge_service.h" |
17 #include "components/arc/arc_service.h" | 18 #include "components/arc/arc_service.h" |
18 #include "components/arc/common/net.mojom.h" | 19 #include "components/arc/common/net.mojom.h" |
19 #include "mojo/public/cpp/bindings/binding.h" | 20 #include "mojo/public/cpp/bindings/binding.h" |
20 | 21 |
| 22 namespace base { |
| 23 |
| 24 class DictionaryValue; |
| 25 |
| 26 } // namespace base |
| 27 |
21 namespace arc { | 28 namespace arc { |
22 | 29 |
23 class ArcBridgeService; | 30 class ArcBridgeService; |
24 | 31 |
25 // Private implementation of ArcNetHost. | 32 // Private implementation of ArcNetHost. |
26 class ArcNetHostImpl : public ArcService, | 33 class ArcNetHostImpl : public ArcService, |
27 public ArcBridgeService::Observer, | 34 public ArcBridgeService::Observer, |
28 public chromeos::NetworkStateHandlerObserver, | 35 public chromeos::NetworkStateHandlerObserver, |
29 public mojom::NetHost { | 36 public mojom::NetHost { |
30 public: | 37 public: |
(...skipping 28 matching lines...) Expand all Loading... |
59 | 66 |
60 void StartConnect(const mojo::String& guid, | 67 void StartConnect(const mojo::String& guid, |
61 const StartConnectCallback& callback) override; | 68 const StartConnectCallback& callback) override; |
62 | 69 |
63 void StartDisconnect(const mojo::String& guid, | 70 void StartDisconnect(const mojo::String& guid, |
64 const StartDisconnectCallback& callback) override; | 71 const StartDisconnectCallback& callback) override; |
65 | 72 |
66 // Overriden from chromeos::NetworkStateHandlerObserver. | 73 // Overriden from chromeos::NetworkStateHandlerObserver. |
67 void ScanCompleted(const chromeos::DeviceState* /*unused*/) override; | 74 void ScanCompleted(const chromeos::DeviceState* /*unused*/) override; |
68 void OnShuttingDown() override; | 75 void OnShuttingDown() override; |
| 76 void DefaultNetworkChanged(const chromeos::NetworkState* network) override; |
| 77 void GetDefaultNetwork(const GetDefaultNetworkCallback& callback) override; |
69 | 78 |
70 // Overridden from ArcBridgeService::Observer: | 79 // Overridden from ArcBridgeService::Observer: |
71 void OnNetInstanceReady() override; | 80 void OnNetInstanceReady() override; |
72 | 81 |
73 private: | 82 private: |
| 83 void DefaultNetworkSuccessCallback(const std::string& service_path, |
| 84 const base::DictionaryValue& dictionary); |
74 base::ThreadChecker thread_checker_; | 85 base::ThreadChecker thread_checker_; |
75 mojo::Binding<arc::mojom::NetHost> binding_; | 86 mojo::Binding<arc::mojom::NetHost> binding_; |
| 87 base::WeakPtrFactory<ArcNetHostImpl> weak_factory_; |
76 | 88 |
77 DISALLOW_COPY_AND_ASSIGN(ArcNetHostImpl); | 89 DISALLOW_COPY_AND_ASSIGN(ArcNetHostImpl); |
78 }; | 90 }; |
79 | 91 |
80 } // namespace arc | 92 } // namespace arc |
81 | 93 |
82 #endif // COMPONENTS_ARC_NET_ARC_NET_HOST_IMPL_H_ | 94 #endif // COMPONENTS_ARC_NET_ARC_NET_HOST_IMPL_H_ |
OLD | NEW |