Commit 4b40fb3b authored by gunsch's avatar gunsch Committed by Commit bot

Revert of [Chromecast] Ignore interfaces not used to connect to internet....

Revert of [Chromecast] Ignore interfaces not used to connect to internet. (patchset #1 id:1 of https://codereview.chromium.org/1137483004/)

Reason for revert:
broke the Android builds. Not sure how "cast_shell_android" passed, actually.

Original issue's description:
> [Chromecast] Ignore interfaces not used to connect to internet.
>
> Add NetworkChangeNotifierFactoryCast to create instance of
> NetworkChangeNotifierLinux that ignores interfaces that will not be
> used to connect to internet.
>
> BUG=469863
> R=gunsch@chromium.org,byungchul@chromium.org,wzhong@chromium.org
>
> Committed: https://crrev.com/561d7adb5ec842c5e56ece4524d0e486691ca614
> Cr-Commit-Position: refs/heads/master@{#329319}

TBR=byungchul@chromium.org,wzhong@chromium.org,derekjchow@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=469863

Review URL: https://codereview.chromium.org/1141503002

Cr-Commit-Position: refs/heads/master@{#329348}
parent f26ead7f
......@@ -50,7 +50,6 @@
#include "net/android/network_change_notifier_factory_android.h"
#else
#include "chromecast/browser/media/cast_browser_cdm_factory.h"
#include "chromecast/net/network_change_notifier_factory_cast.h"
#endif
#if defined(USE_AURA)
......@@ -228,9 +227,6 @@ void CastBrowserMainParts::PreMainMessageLoopStart() {
#if defined(OS_ANDROID)
net::NetworkChangeNotifier::SetFactory(
new net::NetworkChangeNotifierFactoryAndroid());
#else
net::NetworkChangeNotifier::SetFactory(
new NetworkChangeNotifierFactoryCast());
#endif // defined(OS_ANDROID)
}
......
......@@ -101,12 +101,8 @@
'sources': [
'net/connectivity_checker.cc',
'net/connectivity_checker.h',
'net/network_change_notifier_factory_cast.cc',
'net/network_change_notifier_factory_cast.h',
'net/net_switches.cc',
'net/net_switches.h',
'net/net_util_cast.cc',
'net/net_util_cast.h',
],
},
{
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromecast/net/net_util_cast.h"
#include "base/command_line.h"
#include "base/strings/string_split.h"
#include "chromecast/base/cast_sys_info_util.h"
#include "chromecast/net/net_switches.h"
#include "chromecast/public/cast_sys_info.h"
namespace chromecast {
base::hash_set<std::string> GetIgnoredInterfaces() {
base::hash_set<std::string> ignored_interfaces;
scoped_ptr<CastSysInfo> sys_info = CreateSysInfo();
if (!sys_info->GetApInterface().empty())
ignored_interfaces.insert(sys_info->GetApInterface());
// Add interfaces from "netif-to-ignore" switch.
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
base::CommandLine::StringType netifs_to_ignore_str =
command_line->GetSwitchValueNative(switches::kNetifsToIgnore);
base::CommandLine::StringVector netifs_to_ignore_vector;
base::SplitString(netifs_to_ignore_str, ',', &netifs_to_ignore_vector);
for (const auto& netif : netifs_to_ignore_vector)
ignored_interfaces.insert(netif);
return ignored_interfaces;
}
} // namespace chromecast
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_NET_NET_UTIL_H_
#define CHROMECAST_NET_NET_UTIL_H_
#include <string>
#include "base/containers/hash_tables.h"
namespace chromecast {
// Gets the list of interfaces that should be ignored. The interfaces returned
// by this function will not be used to connect to the internet.
base::hash_set<std::string> GetIgnoredInterfaces();
} // namespace chromecast
#endif // CHROMECAST_NET_NET_UTIL_CAST_H_
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromecast/net/network_change_notifier_factory_cast.h"
#include "chromecast/net/net_util_cast.h"
#include "net/base/network_change_notifier_linux.h"
namespace chromecast {
net::NetworkChangeNotifier* NetworkChangeNotifierFactoryCast::CreateInstance() {
// Caller assumes ownership.
return new net::NetworkChangeNotifierLinux(GetIgnoredInterfaces());
}
NetworkChangeNotifierFactoryCast::~NetworkChangeNotifierFactoryCast() {
}
} // namespace chromecast
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_NET_NETWORK_CHANGE_NOTIFIER_FACTORY_CAST_H_
#define CHROMECAST_NET_NETWORK_CHANGE_NOTIFIER_FACTORY_CAST_H_
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "net/base/network_change_notifier_factory.h"
namespace chromecast {
class NetworkChangeNotifierCast;
class NetworkChangeNotifierFactoryCast
: public net::NetworkChangeNotifierFactory {
public:
NetworkChangeNotifierFactoryCast() {}
~NetworkChangeNotifierFactoryCast() override;
// net::NetworkChangeNotifierFactory implementation:
net::NetworkChangeNotifier* CreateInstance() override;
private:
DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierFactoryCast);
};
} // namespace chromecast
#endif // CHROMECAST_NET_NETWORK_CHANGE_NOTIFIER_FACTORY_CAST_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment