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

Side by Side Diff: chromeos/network/network_state.cc

Issue 2871653002: Remove raw base::DictionaryValue::SetWithoutPathExpansion in //chromeos (Closed)
Patch Set: Minor Fix Created 3 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chromeos/network/network_state.h" 5 #include "chromeos/network/network_state.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility>
10 11
11 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/values.h"
13 #include "chromeos/network/network_profile_handler.h" 15 #include "chromeos/network/network_profile_handler.h"
14 #include "chromeos/network/network_type_pattern.h" 16 #include "chromeos/network/network_type_pattern.h"
15 #include "chromeos/network/network_util.h" 17 #include "chromeos/network/network_util.h"
16 #include "chromeos/network/onc/onc_utils.h" 18 #include "chromeos/network/onc/onc_utils.h"
17 #include "chromeos/network/shill_property_util.h" 19 #include "chromeos/network/shill_property_util.h"
18 #include "chromeos/network/tether_constants.h" 20 #include "chromeos/network/tether_constants.h"
19 #include "components/device_event_log/device_event_log.h" 21 #include "components/device_event_log/device_event_log.h"
20 #include "third_party/cros_system_api/dbus/service_constants.h" 22 #include "third_party/cros_system_api/dbus/service_constants.h"
21 23
22 namespace { 24 namespace {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 // must replicate that nested structure. 254 // must replicate that nested structure.
253 std::unique_ptr<base::DictionaryValue> provider_property( 255 std::unique_ptr<base::DictionaryValue> provider_property(
254 new base::DictionaryValue); 256 new base::DictionaryValue);
255 provider_property->SetStringWithoutPathExpansion(shill::kTypeProperty, 257 provider_property->SetStringWithoutPathExpansion(shill::kTypeProperty,
256 vpn_provider_type_); 258 vpn_provider_type_);
257 if (vpn_provider_type_ == shill::kProviderThirdPartyVpn) { 259 if (vpn_provider_type_ == shill::kProviderThirdPartyVpn) {
258 provider_property->SetStringWithoutPathExpansion( 260 provider_property->SetStringWithoutPathExpansion(
259 shill::kHostProperty, third_party_vpn_provider_extension_id_); 261 shill::kHostProperty, third_party_vpn_provider_extension_id_);
260 } 262 }
261 dictionary->SetWithoutPathExpansion(shill::kProviderProperty, 263 dictionary->SetWithoutPathExpansion(shill::kProviderProperty,
262 provider_property.release()); 264 std::move(provider_property));
263 } 265 }
264 266
265 // Tether properties 267 // Tether properties
266 if (NetworkTypePattern::Tether().MatchesType(type())) { 268 if (NetworkTypePattern::Tether().MatchesType(type())) {
267 dictionary->SetIntegerWithoutPathExpansion(kTetherBatteryPercentage, 269 dictionary->SetIntegerWithoutPathExpansion(kTetherBatteryPercentage,
268 battery_percentage()); 270 battery_percentage());
269 dictionary->SetStringWithoutPathExpansion(kTetherCarrier, carrier()); 271 dictionary->SetStringWithoutPathExpansion(kTetherCarrier, carrier());
270 dictionary->SetBooleanWithoutPathExpansion(kTetherHasConnectedToHost, 272 dictionary->SetBooleanWithoutPathExpansion(kTetherHasConnectedToHost,
271 tether_has_connected_to_host()); 273 tether_has_connected_to_host());
272 dictionary->SetIntegerWithoutPathExpansion(kTetherSignalStrength, 274 dictionary->SetIntegerWithoutPathExpansion(kTetherSignalStrength,
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 return IsCaptivePortalState(shill_properties, false /* log */); 464 return IsCaptivePortalState(shill_properties, false /* log */);
463 } 465 }
464 466
465 // static 467 // static
466 bool NetworkState::ErrorIsValid(const std::string& error) { 468 bool NetworkState::ErrorIsValid(const std::string& error) {
467 // Shill uses "Unknown" to indicate an unset or cleared error state. 469 // Shill uses "Unknown" to indicate an unset or cleared error state.
468 return !error.empty() && error != kErrorUnknown; 470 return !error.empty() && error != kErrorUnknown;
469 } 471 }
470 472
471 } // namespace chromeos 473 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_configuration_handler_unittest.cc ('k') | chromeos/network/network_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698