OLD | NEW |
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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/stl_util.h" | |
9 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
11 #include "chromeos/network/network_profile_handler.h" | 10 #include "chromeos/network/network_profile_handler.h" |
12 #include "chromeos/network/network_type_pattern.h" | 11 #include "chromeos/network/network_type_pattern.h" |
13 #include "chromeos/network/network_util.h" | 12 #include "chromeos/network/network_util.h" |
14 #include "chromeos/network/onc/onc_utils.h" | 13 #include "chromeos/network/onc/onc_utils.h" |
15 #include "chromeos/network/shill_property_util.h" | 14 #include "chromeos/network/shill_property_util.h" |
16 #include "components/device_event_log/device_event_log.h" | 15 #include "components/device_event_log/device_event_log.h" |
17 #include "third_party/cros_system_api/dbus/service_constants.h" | 16 #include "third_party/cros_system_api/dbus/service_constants.h" |
18 | 17 |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 // when it first shows up in ServiceCompleteList. See crbug.com/355117. | 356 // when it first shows up in ServiceCompleteList. See crbug.com/355117. |
358 return !profile_path_.empty() || type() == shill::kTypeEthernetEap; | 357 return !profile_path_.empty() || type() == shill::kTypeEthernetEap; |
359 } | 358 } |
360 | 359 |
361 bool NetworkState::IsPrivate() const { | 360 bool NetworkState::IsPrivate() const { |
362 return !profile_path_.empty() && | 361 return !profile_path_.empty() && |
363 profile_path_ != NetworkProfileHandler::GetSharedProfilePath(); | 362 profile_path_ != NetworkProfileHandler::GetSharedProfilePath(); |
364 } | 363 } |
365 | 364 |
366 std::string NetworkState::GetHexSsid() const { | 365 std::string NetworkState::GetHexSsid() const { |
367 return base::HexEncode(vector_as_array(&raw_ssid()), raw_ssid().size()); | 366 return base::HexEncode(raw_ssid().data(), raw_ssid().size()); |
368 } | 367 } |
369 | 368 |
370 std::string NetworkState::GetDnsServersAsString() const { | 369 std::string NetworkState::GetDnsServersAsString() const { |
371 std::string result; | 370 std::string result; |
372 for (size_t i = 0; i < dns_servers_.size(); ++i) { | 371 for (size_t i = 0; i < dns_servers_.size(); ++i) { |
373 if (i != 0) | 372 if (i != 0) |
374 result += ","; | 373 result += ","; |
375 result += dns_servers_[i]; | 374 result += dns_servers_[i]; |
376 } | 375 } |
377 return result; | 376 return result; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 return IsCaptivePortalState(shill_properties, false /* log */); | 432 return IsCaptivePortalState(shill_properties, false /* log */); |
434 } | 433 } |
435 | 434 |
436 // static | 435 // static |
437 bool NetworkState::ErrorIsValid(const std::string& error) { | 436 bool NetworkState::ErrorIsValid(const std::string& error) { |
438 // Shill uses "Unknown" to indicate an unset or cleared error state. | 437 // Shill uses "Unknown" to indicate an unset or cleared error state. |
439 return !error.empty() && error != kErrorUnknown; | 438 return !error.empty() && error != kErrorUnknown; |
440 } | 439 } |
441 | 440 |
442 } // namespace chromeos | 441 } // namespace chromeos |
OLD | NEW |