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

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

Issue 1885683005: Add module suffix in .mojom files for components/arc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase only Created 4 years, 8 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
« no previous file with comments | « components/arc/net/arc_net_host_impl.h ('k') | components/arc/power/arc_power_bridge.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 30 matching lines...) Expand all
41 DCHECK(thread_checker_.CalledOnValidThread()); 41 DCHECK(thread_checker_.CalledOnValidThread());
42 arc_bridge_service()->RemoveObserver(this); 42 arc_bridge_service()->RemoveObserver(this);
43 if (chromeos::NetworkHandler::IsInitialized()) { 43 if (chromeos::NetworkHandler::IsInitialized()) {
44 GetStateHandler()->RemoveObserver(this, FROM_HERE); 44 GetStateHandler()->RemoveObserver(this, FROM_HERE);
45 } 45 }
46 } 46 }
47 47
48 void ArcNetHostImpl::OnNetInstanceReady() { 48 void ArcNetHostImpl::OnNetInstanceReady() {
49 DCHECK(thread_checker_.CalledOnValidThread()); 49 DCHECK(thread_checker_.CalledOnValidThread());
50 50
51 NetHostPtr host; 51 mojom::NetHostPtr host;
52 binding_.Bind(GetProxy(&host)); 52 binding_.Bind(GetProxy(&host));
53 arc_bridge_service()->net_instance()->Init(std::move(host)); 53 arc_bridge_service()->net_instance()->Init(std::move(host));
54 } 54 }
55 55
56 void ArcNetHostImpl::GetNetworksDeprecated( 56 void ArcNetHostImpl::GetNetworksDeprecated(
57 bool configured_only, 57 bool configured_only,
58 bool visible_only, 58 bool visible_only,
59 const GetNetworksDeprecatedCallback& callback) { 59 const GetNetworksDeprecatedCallback& callback) {
60 DCHECK(thread_checker_.CalledOnValidThread()); 60 DCHECK(thread_checker_.CalledOnValidThread());
61 if (configured_only && visible_only) { 61 if (configured_only && visible_only) {
62 VLOG(1) << "Illegal arguments - both configured and visible networks " 62 VLOG(1) << "Illegal arguments - both configured and visible networks "
63 "requested."; 63 "requested.";
64 return; 64 return;
65 } 65 }
66 66
67 GetNetworksRequestType type = GetNetworksRequestType::CONFIGURED_ONLY; 67 mojom::GetNetworksRequestType type =
68 mojom::GetNetworksRequestType::CONFIGURED_ONLY;
68 if (visible_only) { 69 if (visible_only) {
69 type = GetNetworksRequestType::VISIBLE_ONLY; 70 type = mojom::GetNetworksRequestType::VISIBLE_ONLY;
70 } 71 }
71 72
72 GetNetworks(type, callback); 73 GetNetworks(type, callback);
73 } 74 }
74 75
75 void ArcNetHostImpl::GetNetworks(GetNetworksRequestType type, 76 void ArcNetHostImpl::GetNetworks(mojom::GetNetworksRequestType type,
76 const GetNetworksCallback& callback) { 77 const GetNetworksCallback& callback) {
77 DCHECK(thread_checker_.CalledOnValidThread()); 78 DCHECK(thread_checker_.CalledOnValidThread());
78 79
79 NetworkDataPtr data = NetworkData::New(); 80 mojom::NetworkDataPtr data = mojom::NetworkData::New();
80 bool configured_only = true; 81 bool configured_only = true;
81 bool visible_only = false; 82 bool visible_only = false;
82 if (type == GetNetworksRequestType::VISIBLE_ONLY) { 83 if (type == mojom::GetNetworksRequestType::VISIBLE_ONLY) {
83 configured_only = false; 84 configured_only = false;
84 visible_only = true; 85 visible_only = true;
85 } 86 }
86 87
87 // Retrieve list of nearby wifi networks 88 // Retrieve list of nearby wifi networks
88 chromeos::NetworkTypePattern network_pattern = 89 chromeos::NetworkTypePattern network_pattern =
89 chromeos::onc::NetworkTypePatternFromOncType(onc::network_type::kWiFi); 90 chromeos::onc::NetworkTypePatternFromOncType(onc::network_type::kWiFi);
90 scoped_ptr<base::ListValue> network_properties_list = 91 scoped_ptr<base::ListValue> network_properties_list =
91 chromeos::network_util::TranslateNetworkListToONC( 92 chromeos::network_util::TranslateNetworkListToONC(
92 network_pattern, configured_only, visible_only, 93 network_pattern, configured_only, visible_only,
93 kGetNetworksListLimit); 94 kGetNetworksListLimit);
94 95
95 // Extract info for each network and add it to the list. 96 // Extract info for each network and add it to the list.
96 // Even if there's no WiFi, an empty (size=0) list must be returned and not a 97 // Even if there's no WiFi, an empty (size=0) list must be returned and not a
97 // null one. The explicitly sized New() constructor ensures the non-null 98 // null one. The explicitly sized New() constructor ensures the non-null
98 // property. 99 // property.
99 mojo::Array<WifiConfigurationPtr> networks = 100 mojo::Array<mojom::WifiConfigurationPtr> networks =
100 mojo::Array<WifiConfigurationPtr>::New(0); 101 mojo::Array<mojom::WifiConfigurationPtr>::New(0);
101 for (base::Value* value : *network_properties_list) { 102 for (base::Value* value : *network_properties_list) {
102 WifiConfigurationPtr wc = WifiConfiguration::New(); 103 mojom::WifiConfigurationPtr wc = mojom::WifiConfiguration::New();
103 104
104 base::DictionaryValue* network_dict = nullptr; 105 base::DictionaryValue* network_dict = nullptr;
105 value->GetAsDictionary(&network_dict); 106 value->GetAsDictionary(&network_dict);
106 DCHECK(network_dict); 107 DCHECK(network_dict);
107 108
108 // kName is a post-processed version of kHexSSID. 109 // kName is a post-processed version of kHexSSID.
109 std::string tmp; 110 std::string tmp;
110 network_dict->GetString(onc::network_config::kName, &tmp); 111 network_dict->GetString(onc::network_config::kName, &tmp);
111 DCHECK(!tmp.empty()); 112 DCHECK(!tmp.empty());
112 wc->ssid = tmp; 113 wc->ssid = tmp;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 182 }
182 183
183 arc_bridge_service()->net_instance()->ScanCompleted(); 184 arc_bridge_service()->net_instance()->ScanCompleted();
184 } 185 }
185 186
186 void ArcNetHostImpl::OnShuttingDown() { 187 void ArcNetHostImpl::OnShuttingDown() {
187 GetStateHandler()->RemoveObserver(this, FROM_HERE); 188 GetStateHandler()->RemoveObserver(this, FROM_HERE);
188 } 189 }
189 190
190 } // namespace arc 191 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/net/arc_net_host_impl.h ('k') | components/arc/power/arc_power_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698