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

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

Issue 2816513002: Revert of Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Created 3 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
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 <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 kGetNetworksListLimit); 367 kGetNetworksListLimit);
368 368
369 // Extract info for each network and add it to the list. 369 // Extract info for each network and add it to the list.
370 // Even if there's no WiFi, an empty (size=0) list must be returned and not a 370 // Even if there's no WiFi, an empty (size=0) list must be returned and not a
371 // null one. The explicitly sized New() constructor ensures the non-null 371 // null one. The explicitly sized New() constructor ensures the non-null
372 // property. 372 // property.
373 std::vector<mojom::WifiConfigurationPtr> networks; 373 std::vector<mojom::WifiConfigurationPtr> networks;
374 for (const auto& value : *network_properties_list) { 374 for (const auto& value : *network_properties_list) {
375 mojom::WifiConfigurationPtr wc = mojom::WifiConfiguration::New(); 375 mojom::WifiConfigurationPtr wc = mojom::WifiConfiguration::New();
376 376
377 const base::DictionaryValue* network_dict = nullptr; 377 base::DictionaryValue* network_dict = nullptr;
378 value.GetAsDictionary(&network_dict); 378 value->GetAsDictionary(&network_dict);
379 DCHECK(network_dict); 379 DCHECK(network_dict);
380 380
381 // kName is a post-processed version of kHexSSID. 381 // kName is a post-processed version of kHexSSID.
382 std::string tmp; 382 std::string tmp;
383 network_dict->GetString(onc::network_config::kName, &tmp); 383 network_dict->GetString(onc::network_config::kName, &tmp);
384 DCHECK(!tmp.empty()); 384 DCHECK(!tmp.empty());
385 wc->ssid = tmp; 385 wc->ssid = tmp;
386 386
387 tmp.clear(); 387 tmp.clear();
388 network_dict->GetString(onc::network_config::kGUID, &tmp); 388 network_dict->GetString(onc::network_config::kGUID, &tmp);
389 DCHECK(!tmp.empty()); 389 DCHECK(!tmp.empty());
390 wc->guid = tmp; 390 wc->guid = tmp;
391 391
392 const base::DictionaryValue* wifi_dict = nullptr; 392 base::DictionaryValue* wifi_dict = nullptr;
393 network_dict->GetDictionary(onc::network_config::kWiFi, &wifi_dict); 393 network_dict->GetDictionary(onc::network_config::kWiFi, &wifi_dict);
394 DCHECK(wifi_dict); 394 DCHECK(wifi_dict);
395 395
396 if (!wifi_dict->GetInteger(onc::wifi::kFrequency, &wc->frequency)) 396 if (!wifi_dict->GetInteger(onc::wifi::kFrequency, &wc->frequency))
397 wc->frequency = 0; 397 wc->frequency = 0;
398 if (!wifi_dict->GetInteger(onc::wifi::kSignalStrength, 398 if (!wifi_dict->GetInteger(onc::wifi::kSignalStrength,
399 &wc->signal_strength)) 399 &wc->signal_strength))
400 wc->signal_strength = 0; 400 wc->signal_strength = 0;
401 401
402 if (!wifi_dict->GetString(onc::wifi::kSecurity, &tmp)) 402 if (!wifi_dict->GetString(onc::wifi::kSecurity, &tmp))
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 net_instance->WifiEnabledStateChanged(is_enabled); 657 net_instance->WifiEnabledStateChanged(is_enabled);
658 } 658 }
659 659
660 void ArcNetHostImpl::OnShuttingDown() { 660 void ArcNetHostImpl::OnShuttingDown() {
661 DCHECK(observing_network_state_); 661 DCHECK(observing_network_state_);
662 GetStateHandler()->RemoveObserver(this, FROM_HERE); 662 GetStateHandler()->RemoveObserver(this, FROM_HERE);
663 observing_network_state_ = false; 663 observing_network_state_ = false;
664 } 664 }
665 665
666 } // namespace arc 666 } // namespace arc
OLDNEW
« no previous file with comments | « chromeos/system/statistics_provider.cc ('k') | components/autofill/content/browser/risk/fingerprint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698