Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chromecast / net / net_util_cast.cc
blobf94fe64cb2bb8fb76e5d745e0f1e9c212304cc46
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
3 // found in the LICENSE file.
5 #include "chromecast/net/net_util_cast.h"
7 #include "base/command_line.h"
8 #include "base/strings/string_split.h"
9 #include "chromecast/base/cast_sys_info_util.h"
10 #include "chromecast/net/net_switches.h"
11 #include "chromecast/public/cast_sys_info.h"
13 namespace chromecast {
15 base::hash_set<std::string> GetIgnoredInterfaces() {
16 base::hash_set<std::string> ignored_interfaces;
17 scoped_ptr<CastSysInfo> sys_info = CreateSysInfo();
18 if (!sys_info->GetApInterface().empty())
19 ignored_interfaces.insert(sys_info->GetApInterface());
21 // Add interfaces from "netif-to-ignore" switch.
22 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
23 base::CommandLine::StringType netifs_to_ignore_str =
24 command_line->GetSwitchValueNative(switches::kNetifsToIgnore);
25 for (const std::string& netif : base::SplitString(
26 netifs_to_ignore_str, ",", base::TRIM_WHITESPACE,
27 base::SPLIT_WANT_ALL))
28 ignored_interfaces.insert(netif);
30 return ignored_interfaces;
33 } // namespace chromecast