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

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

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes Created 4 years, 6 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 <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 chromeos::network_util::TranslateNetworkListToONC( 362 chromeos::network_util::TranslateNetworkListToONC(
363 network_pattern, configured_only, visible_only, 363 network_pattern, configured_only, visible_only,
364 kGetNetworksListLimit); 364 kGetNetworksListLimit);
365 365
366 // Extract info for each network and add it to the list. 366 // Extract info for each network and add it to the list.
367 // Even if there's no WiFi, an empty (size=0) list must be returned and not a 367 // Even if there's no WiFi, an empty (size=0) list must be returned and not a
368 // null one. The explicitly sized New() constructor ensures the non-null 368 // null one. The explicitly sized New() constructor ensures the non-null
369 // property. 369 // property.
370 mojo::Array<mojom::WifiConfigurationPtr> networks = 370 mojo::Array<mojom::WifiConfigurationPtr> networks =
371 mojo::Array<mojom::WifiConfigurationPtr>::New(0); 371 mojo::Array<mojom::WifiConfigurationPtr>::New(0);
372 for (base::Value* value : *network_properties_list) { 372 for (const auto& value : *network_properties_list) {
373 mojom::WifiConfigurationPtr wc = mojom::WifiConfiguration::New(); 373 mojom::WifiConfigurationPtr wc = mojom::WifiConfiguration::New();
374 374
375 base::DictionaryValue* network_dict = nullptr; 375 base::DictionaryValue* network_dict = nullptr;
376 value->GetAsDictionary(&network_dict); 376 value->GetAsDictionary(&network_dict);
377 DCHECK(network_dict); 377 DCHECK(network_dict);
378 378
379 // kName is a post-processed version of kHexSSID. 379 // kName is a post-processed version of kHexSSID.
380 std::string tmp; 380 std::string tmp;
381 network_dict->GetString(onc::network_config::kName, &tmp); 381 network_dict->GetString(onc::network_config::kName, &tmp);
382 DCHECK(!tmp.empty()); 382 DCHECK(!tmp.empty());
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 base::Bind(&arc::ArcNetHostImpl::DefaultNetworkSuccessCallback, 610 base::Bind(&arc::ArcNetHostImpl::DefaultNetworkSuccessCallback,
611 weak_factory_.GetWeakPtr()), 611 weak_factory_.GetWeakPtr()),
612 base::Bind(&DefaultNetworkFailureCallback)); 612 base::Bind(&DefaultNetworkFailureCallback));
613 } 613 }
614 614
615 void ArcNetHostImpl::OnShuttingDown() { 615 void ArcNetHostImpl::OnShuttingDown() {
616 GetStateHandler()->RemoveObserver(this, FROM_HERE); 616 GetStateHandler()->RemoveObserver(this, FROM_HERE);
617 } 617 }
618 618
619 } // namespace arc 619 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698