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 #include "components/arc/net/arc_net_host_impl.h" | 5 #include "components/arc/net/arc_net_host_impl.h" |
6 | 6 |
| 7 #include <memory> |
7 #include <string> | 8 #include <string> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/location.h" | 11 #include "base/location.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/posix/eintr_wrapper.h" | 13 #include "base/posix/eintr_wrapper.h" |
13 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
15 #include "chromeos/network/network_handler.h" | 16 #include "chromeos/network/network_handler.h" |
16 #include "chromeos/network/network_state_handler.h" | 17 #include "chromeos/network/network_state_handler.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 bool configured_only = true; | 82 bool configured_only = true; |
82 bool visible_only = false; | 83 bool visible_only = false; |
83 if (type == mojom::GetNetworksRequestType::VISIBLE_ONLY) { | 84 if (type == mojom::GetNetworksRequestType::VISIBLE_ONLY) { |
84 configured_only = false; | 85 configured_only = false; |
85 visible_only = true; | 86 visible_only = true; |
86 } | 87 } |
87 | 88 |
88 // Retrieve list of nearby wifi networks | 89 // Retrieve list of nearby wifi networks |
89 chromeos::NetworkTypePattern network_pattern = | 90 chromeos::NetworkTypePattern network_pattern = |
90 chromeos::onc::NetworkTypePatternFromOncType(onc::network_type::kWiFi); | 91 chromeos::onc::NetworkTypePatternFromOncType(onc::network_type::kWiFi); |
91 scoped_ptr<base::ListValue> network_properties_list = | 92 std::unique_ptr<base::ListValue> network_properties_list = |
92 chromeos::network_util::TranslateNetworkListToONC( | 93 chromeos::network_util::TranslateNetworkListToONC( |
93 network_pattern, configured_only, visible_only, | 94 network_pattern, configured_only, visible_only, |
94 kGetNetworksListLimit); | 95 kGetNetworksListLimit); |
95 | 96 |
96 // Extract info for each network and add it to the list. | 97 // Extract info for each network and add it to the list. |
97 // Even if there's no WiFi, an empty (size=0) list must be returned and not a | 98 // Even if there's no WiFi, an empty (size=0) list must be returned and not a |
98 // null one. The explicitly sized New() constructor ensures the non-null | 99 // null one. The explicitly sized New() constructor ensures the non-null |
99 // property. | 100 // property. |
100 mojo::Array<mojom::WifiConfigurationPtr> networks = | 101 mojo::Array<mojom::WifiConfigurationPtr> networks = |
101 mojo::Array<mojom::WifiConfigurationPtr>::New(0); | 102 mojo::Array<mojom::WifiConfigurationPtr>::New(0); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 183 } |
183 | 184 |
184 arc_bridge_service()->net_instance()->ScanCompleted(); | 185 arc_bridge_service()->net_instance()->ScanCompleted(); |
185 } | 186 } |
186 | 187 |
187 void ArcNetHostImpl::OnShuttingDown() { | 188 void ArcNetHostImpl::OnShuttingDown() { |
188 GetStateHandler()->RemoveObserver(this, FROM_HERE); | 189 GetStateHandler()->RemoveObserver(this, FROM_HERE); |
189 } | 190 } |
190 | 191 |
191 } // namespace arc | 192 } // namespace arc |
OLD | NEW |