Skip to content

Commit

Permalink
Migrate //chromeos/ash/components/network to namespace ash [9/N]
Browse files Browse the repository at this point in the history
This CL migrates remaining files to namespace ash from chromeos.

This CL is part of the Chrome OS source code directory migration:
https://docs.google.com/document/d/1g-98HpzA8XcoGBWUv1gQNr4rbnD5yfvbtYZyPDDbkaE.

Bug: 1164001
Change-Id: If75617355585da7891a52236dc8b472d561eb227
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3815105
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Commit-Queue: Yeunjoo Choi <ychoi@igalia.com>
Owners-Override: Hidehiko Abe <hidehiko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1032884}
  • Loading branch information
duswnchl authored and Chromium LUCI CQ committed Aug 9, 2022
1 parent f888fd2 commit 427ff7a
Show file tree
Hide file tree
Showing 105 changed files with 292 additions and 356 deletions.
2 changes: 1 addition & 1 deletion ash/components/arc/net/arc_net_host_impl.cc
Expand Up @@ -83,7 +83,7 @@ ash::NetworkProfileHandler* GetNetworkProfileHandler() {
return chromeos::NetworkHandler::Get()->network_profile_handler();
}

const chromeos::NetworkProfile* GetNetworkProfile() {
const ash::NetworkProfile* GetNetworkProfile() {
return GetNetworkProfileHandler()->GetProfileForUserhash(
chromeos::LoginState::Get()->primary_user_hash());
}
Expand Down
Expand Up @@ -11,8 +11,6 @@
// TODO(https://crbug.com/1164001): move to forward declaration
#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h"
// TODO(https://crbug.com/1164001): move to forward declaration
#include "chromeos/ash/components/network/network_connect.h"
// TODO(https://crbug.com/1164001): move to forward declaration
#include "chromeos/ash/components/network/network_state_handler.h"

class PrefService;
Expand All @@ -27,6 +25,7 @@ namespace device_sync {
class DeviceSyncClient;
}

class NetworkConnect;
class NetworkConnectionHandler;

namespace tether {
Expand Down
3 changes: 1 addition & 2 deletions ash/components/tether/tether_component_impl.h
Expand Up @@ -13,8 +13,6 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
// TODO(https://crbug.com/1164001): move to forward declaration
#include "chromeos/ash/components/network/network_connect.h"
// TODO(https://crbug.com/1164001): move to forward declaration
#include "chromeos/ash/components/network/network_state_handler.h"
#include "components/prefs/pref_registry_simple.h"
#include "device/bluetooth/bluetooth_adapter.h"
Expand All @@ -36,6 +34,7 @@ class DeviceSyncClient;
}

class ManagedNetworkConfigurationHandler;
class NetworkConnect;
class NetworkConnectionHandler;

namespace tether {
Expand Down
7 changes: 3 additions & 4 deletions ash/components/tether/wifi_hotspot_connector.h
Expand Up @@ -14,10 +14,6 @@
#include "base/timer/timer.h"
#include "base/values.h"
// TODO(https://crbug.com/1164001): move to forward declaration
#include "chromeos/ash/components/network/network_connect.h"
// TODO(https://crbug.com/1164001): move to forward declaration
#include "chromeos/ash/components/network/network_state.h"
// TODO(https://crbug.com/1164001): move to forward declaration
#include "chromeos/ash/components/network/network_state_handler.h"
#include "chromeos/ash/components/network/network_state_handler_observer.h"

Expand All @@ -27,6 +23,9 @@ class TaskRunner;

namespace ash {

class NetworkConnect;
class NetworkState;

namespace tether {

// Connects to a Wi-Fi hotspot, given an SSID and password.
Expand Down
11 changes: 7 additions & 4 deletions ash/services/cellular_setup/esim_profile.h
Expand Up @@ -9,16 +9,18 @@
#include "base/memory/weak_ptr.h"
#include "chromeos/ash/components/dbus/hermes/hermes_profile_client.h"
#include "chromeos/ash/components/dbus/hermes/hermes_response_status.h"
// TODO(https://crbug.com/1164001): move to forward declaration.
#include "chromeos/ash/components/network/cellular_esim_profile.h"
#include "chromeos/ash/components/network/cellular_inhibitor.h"
#include "mojo/public/cpp/bindings/receiver_set.h"

namespace dbus {
class ObjectPath;
}

namespace ash::cellular_setup {
namespace ash {

class CellularESimProfile;

namespace cellular_setup {

class Euicc;
class ESimManager;
Expand Down Expand Up @@ -117,6 +119,7 @@ class ESimProfile : public mojom::ESimProfile {
base::WeakPtrFactory<ESimProfile> weak_ptr_factory_{this};
};

} // namespace ash::cellular_setup
} // namespace cellular_setup
} // namespace ash

#endif // ASH_SERVICES_CELLULAR_SETUP_ESIM_PROFILE_H_
11 changes: 7 additions & 4 deletions ash/services/cellular_setup/euicc.h
Expand Up @@ -9,16 +9,18 @@
#include "base/gtest_prod_util.h"
#include "chromeos/ash/components/dbus/hermes/hermes_euicc_client.h"
#include "chromeos/ash/components/dbus/hermes/hermes_profile_client.h"
// TODO(https://crbug.com/1164001): move to forward declaration.
#include "chromeos/ash/components/network/cellular_esim_profile.h"
#include "chromeos/ash/components/network/cellular_inhibitor.h"
#include "mojo/public/cpp/bindings/receiver_set.h"

namespace dbus {
class ObjectPath;
}

namespace ash::cellular_setup {
namespace ash {

class CellularESimProfile;

namespace cellular_setup {

class ESimProfile;
class ESimManager;
Expand Down Expand Up @@ -114,6 +116,7 @@ class Euicc : public mojom::Euicc {
base::WeakPtrFactory<Euicc> weak_ptr_factory_{this};
};

} // namespace ash::cellular_setup
} // namespace cellular_setup
} // namespace ash

#endif // ASH_SERVICES_CELLULAR_SETUP_EUICC_H_
10 changes: 5 additions & 5 deletions ash/system/network/auto_connect_notifier_unittest.cc
Expand Up @@ -46,9 +46,9 @@ class AutoConnectNotifierTest : public AshTestBase {
~AutoConnectNotifierTest() override = default;

void SetUp() override {
chromeos::SystemTokenCertDbStorage::Initialize();
chromeos::NetworkCertLoader::Initialize();
chromeos::NetworkCertLoader::ForceAvailableForNetworkAuthForTesting();
SystemTokenCertDbStorage::Initialize();
NetworkCertLoader::Initialize();
NetworkCertLoader::ForceAvailableForNetworkAuthForTesting();
network_handler_test_helper_ = std::make_unique<NetworkHandlerTestHelper>();
CHECK(chromeos::NetworkHandler::Get()->auto_connect_handler());
network_config_helper_ = std::make_unique<
Expand All @@ -75,8 +75,8 @@ class AutoConnectNotifierTest : public AshTestBase {
AshTestBase::TearDown();
network_config_helper_.reset();
network_handler_test_helper_.reset();
chromeos::NetworkCertLoader::Shutdown();
chromeos::SystemTokenCertDbStorage::Shutdown();
NetworkCertLoader::Shutdown();
SystemTokenCertDbStorage::Shutdown();
}

void NotifyConnectToNetworkRequested() {
Expand Down
8 changes: 4 additions & 4 deletions ash/system/network/cellular_setup_notifier_unittest.cc
Expand Up @@ -43,8 +43,8 @@ class CellularSetupNotifierTest : public NoSessionAshTestBase {
~CellularSetupNotifierTest() override = default;

void SetUp() override {
chromeos::SystemTokenCertDbStorage::Initialize();
chromeos::NetworkCertLoader::Initialize();
SystemTokenCertDbStorage::Initialize();
NetworkCertLoader::Initialize();
chromeos::shill_clients::InitializeFakes();
hermes_clients::InitializeFakes();
chromeos::NetworkHandler::Initialize();
Expand All @@ -69,8 +69,8 @@ class CellularSetupNotifierTest : public NoSessionAshTestBase {
chromeos::NetworkHandler::Shutdown();
hermes_clients::Shutdown();
chromeos::shill_clients::Shutdown();
chromeos::NetworkCertLoader::Shutdown();
chromeos::SystemTokenCertDbStorage::Shutdown();
NetworkCertLoader::Shutdown();
SystemTokenCertDbStorage::Shutdown();
}

// Returns the cellular setup notification if it is shown, and null if it is
Expand Down
2 changes: 1 addition & 1 deletion ash/system/network/network_detailed_view_controller.cc
Expand Up @@ -181,7 +181,7 @@ void NetworkDetailedViewController::OnNetworkListItemSelected(
UserMetricsAction("StatusArea_Network_ConnectConfigured"));
LogUserNetworkEvent(*network.get());
RecordNetworkRowClickedAction(NetworkRowClickedAction::kConnectToNetwork);
chromeos::NetworkConnect::Get()->ConnectToNetworkId(network->guid);
NetworkConnect::Get()->ConnectToNetworkId(network->guid);
return;
}
}
Expand Down
Expand Up @@ -58,7 +58,7 @@ constexpr char kNetworkConnectionDetails[] =
const std::string kNetworkTechnologyWiFi = "WiFi";
const std::string kNetworkTechnologyMobile = "Mobile";

class NetworkConnectTestDelegate : public chromeos::NetworkConnect::Delegate {
class NetworkConnectTestDelegate : public NetworkConnect::Delegate {
public:
NetworkConnectTestDelegate() {}

Expand Down Expand Up @@ -96,7 +96,7 @@ class NetworkDetailedViewControllerTest : public AshTestBase {

// Creating a service here, since we would be testing that wifi,
// networks which can be connected to are actually connected to. This
// checks that chromeos::NetworkConnect eventually connects us to the
// checks that NetworkConnect eventually connects us to the
// network.
wifi_service_path_ =
network_state_helper()->ConfigureService(base::StringPrintf(
Expand All @@ -106,7 +106,7 @@ class NetworkDetailedViewControllerTest : public AshTestBase {
kWifi));

network_connect_delegate_ = std::make_unique<NetworkConnectTestDelegate>();
chromeos::NetworkConnect::Initialize(network_connect_delegate_.get());
NetworkConnect::Initialize(network_connect_delegate_.get());
AshTestBase::SetUp();

feature_list_.InitAndEnableFeature(features::kQuickSettingsNetworkRevamp);
Expand All @@ -119,7 +119,7 @@ class NetworkDetailedViewControllerTest : public AshTestBase {
void TearDown() override {
network_detailed_view_controller_.reset();
AshTestBase::TearDown();
chromeos::NetworkConnect::Shutdown();
NetworkConnect::Shutdown();
chromeos::NetworkHandler::Shutdown();
network_connect_delegate_.reset();
}
Expand Down
2 changes: 1 addition & 1 deletion ash/system/network/network_state_list_detailed_view.cc
Expand Up @@ -297,7 +297,7 @@ void NetworkStateListDetailedView::HandleViewClickedImpl(
RecordNetworkRowClickedAction(
NetworkRowClickedAction::kConnectToNetwork);
}
chromeos::NetworkConnect::Get()->ConnectToNetworkId(network->guid);
NetworkConnect::Get()->ConnectToNetworkId(network->guid);
return;
}
}
Expand Down
5 changes: 2 additions & 3 deletions ash/system/network/vpn_list_view.cc
Expand Up @@ -290,9 +290,8 @@ void VPNListNetworkEntry::UpdateFromNetworkState(
if (IsVpnConfigAllowed()) {
disconnect_button_ = TrayPopupUtils::CreateTrayPopupButton(
// TODO(stevenjb): Replace with mojo API. https://crbug.com/862420.
base::BindRepeating(
&chromeos::NetworkConnect::DisconnectFromNetworkId,
base::Unretained(chromeos::NetworkConnect::Get()), guid_),
base::BindRepeating(&NetworkConnect::DisconnectFromNetworkId,
base::Unretained(NetworkConnect::Get()), guid_),
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_VPN_DISCONNECT));
disconnect_button_->SetAccessibleName(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_DISCONNECT_BUTTON_A11Y_LABEL, label));
Expand Down
Expand Up @@ -546,7 +546,7 @@ void CertStoreServiceTest::CheckInstalledCerts(
std::string hex_encoded_id =
base::HexEncode(cert_id.data(), cert_id.size());
EXPECT_EQ(hex_encoded_id,
chromeos::NetworkCertLoader::GetPkcs11IdAndSlotForCert(
ash::NetworkCertLoader::GetPkcs11IdAndSlotForCert(
nss_cert.get(), &slot_id));
EXPECT_TRUE(PlaceholdersContainIdAndSlot(cert_id, cert.test_data.slot));
break;
Expand Down
Expand Up @@ -568,7 +568,7 @@ void ArcSettingsServiceImpl::SyncLocationServiceEnabled() const {
// multi-network support so we should sync per-network proxy configuration.
void ArcSettingsServiceImpl::SyncProxySettings() const {
std::unique_ptr<ProxyConfigDictionary> proxy_config_dict =
chromeos::ProxyConfigServiceImpl::GetActiveProxyConfigDictionary(
ash::ProxyConfigServiceImpl::GetActiveProxyConfigDictionary(
GetPrefs(), g_browser_process->local_state());

ProxyPrefs::ProxyMode mode;
Expand Down
Expand Up @@ -306,8 +306,7 @@ class ArcSettingsServiceTest : public InProcessBrowserTest {
->network_state_handler()
->GetNetworkState(service_path);
ASSERT_TRUE(network);
chromeos::proxy_config::SetProxyConfigForNetwork(proxy_config_dict,
*network);
ash::proxy_config::SetProxyConfigForNetwork(proxy_config_dict, *network);
}

std::unique_ptr<FakeIntentHelperInstance> fake_intent_helper_instance_;
Expand Down Expand Up @@ -608,7 +607,7 @@ IN_PROC_BROWSER_TEST_F(ArcSettingsServiceTest, TwoSourcesTest) {
->network_state_handler()
->DefaultNetwork();
ASSERT_TRUE(network);
chromeos::proxy_config::SetProxyConfigForNetwork(proxy_config_dict, *network);
ash::proxy_config::SetProxyConfigForNetwork(proxy_config_dict, *network);
RunUntilIdle();

base::Value expected_proxy_config(base::Value::Type::DICTIONARY);
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ash/crosapi/network_settings_service_ash.cc
Expand Up @@ -194,8 +194,8 @@ void NetworkSettingsServiceAsh::DetermineEffectiveProxy() {
if (!pref_service)
return;
crosapi::mojom::ProxyConfigPtr new_proxy_config = ProxyConfigToCrosapiProxy(
chromeos::ProxyConfigServiceImpl::GetActiveProxyConfigDictionary(
pref_service, local_state_)
ash::ProxyConfigServiceImpl::GetActiveProxyConfigDictionary(pref_service,
local_state_)
.get(),
cached_wpad_url_);

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ash/crosapi/vpn_service_ash.cc
Expand Up @@ -208,7 +208,7 @@ void VpnServiceForExtensionAsh::CreateConfiguration(

// Since the API is only designed to be used with the primary profile, it's
// safe to get the hash of the primary profile here.
const chromeos::NetworkProfile* profile =
const ash::NetworkProfile* profile =
chromeos::NetworkHandler::Get()
->network_profile_handler()
->GetProfileForUserhash(ash::ProfileHelper::GetUserIdHashFromProfile(
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/ash/login/saml/saml_lockscreen_browsertest.cc
Expand Up @@ -722,8 +722,7 @@ class ProxyAuthLockscreenWebUiTest : public LockscreenWebUiTest {
ASSERT_EQ(network->guid(),
FakeShillManagerClient::kFakeEthernetNetworkGuid);

chromeos::proxy_config::SetProxyConfigForNetwork(proxy_config_dict,
*network);
proxy_config::SetProxyConfigForNetwork(proxy_config_dict, *network);
base::RunLoop().RunUntilIdle();
}

Expand Down
2 changes: 0 additions & 2 deletions chrome/browser/ash/login/users/chrome_user_manager_impl.cc
Expand Up @@ -119,8 +119,6 @@
namespace ash {
namespace {

// TODO(https://crbug.com/1164001): remove after the class is migrated
using ::chromeos::ProxyConfigServiceImpl;
using ::content::BrowserThread;

// A string pref that gets set when a device local account is removed but a
Expand Down
Expand Up @@ -257,8 +257,8 @@ void BrowserPolicyConnectorAsh::Init(
ash::CrosSettings::Get(),
DeviceNetworkConfigurationUpdaterAsh::DeviceAssetIDFetcher());
// NetworkCertLoader may be not initialized in tests.
if (chromeos::NetworkCertLoader::IsInitialized()) {
chromeos::NetworkCertLoader::Get()->SetDevicePolicyCertificateProvider(
if (ash::NetworkCertLoader::IsInitialized()) {
ash::NetworkCertLoader::Get()->SetDevicePolicyCertificateProvider(
device_network_configuration_updater_.get());
}

Expand Down Expand Up @@ -345,9 +345,8 @@ void BrowserPolicyConnectorAsh::Shutdown() {
system_proxy_handler_.reset();

// NetworkCertLoader may be not initialized in tests.
if (chromeos::NetworkCertLoader::IsInitialized()) {
chromeos::NetworkCertLoader::Get()->SetDevicePolicyCertificateProvider(
nullptr);
if (ash::NetworkCertLoader::IsInitialized()) {
ash::NetworkCertLoader::Get()->SetDevicePolicyCertificateProvider(nullptr);
}
device_network_configuration_updater_.reset();

Expand Down
Expand Up @@ -2163,7 +2163,7 @@ IN_PROC_BROWSER_TEST_F(DeviceLocalAccountWarnings, NoLoginWarningShown) {

class ManagedSessionsTest : public DeviceLocalAccountTest {
protected:
class CertsObserver : public chromeos::PolicyCertificateProvider::Observer {
class CertsObserver : public ash::PolicyCertificateProvider::Observer {
public:
explicit CertsObserver(base::OnceClosure on_change)
: on_change_(std::move(on_change)) {}
Expand Down
Expand Up @@ -217,14 +217,14 @@ class ScopedNetworkPolicyApplicationObserver
};

class ScopedNetworkCertLoaderRefreshWaiter
: public chromeos::NetworkCertLoader::Observer {
: public ash::NetworkCertLoader::Observer {
public:
ScopedNetworkCertLoaderRefreshWaiter() {
chromeos::NetworkCertLoader::Get()->AddObserver(this);
ash::NetworkCertLoader::Get()->AddObserver(this);
}

~ScopedNetworkCertLoaderRefreshWaiter() override {
chromeos::NetworkCertLoader::Get()->RemoveObserver(this);
ash::NetworkCertLoader::Get()->RemoveObserver(this);
}

void OnCertificatesLoaded() override { run_loop_.Quit(); }
Expand Down Expand Up @@ -339,8 +339,7 @@ class NetworkPolicyApplicationTest : public ash::LoginManagerTest {
const std::string& key_filename) {
// Before importing, configure NetworkCertLoader to assume that all
// certificates can be used for network authentication.
chromeos::NetworkCertLoader::Get()
->ForceAvailableForNetworkAuthForTesting();
ash::NetworkCertLoader::Get()->ForceAvailableForNetworkAuthForTesting();

net::ScopedCERTCertificate cert;
// Import testing key pair and certificate.
Expand Down
Expand Up @@ -119,7 +119,7 @@ const char kSigninScreenExtension2UpdateManifestPath[] =
// Allows waiting until the list of policy-pushed web-trusted certificates
// changes.
class WebTrustedCertsChangedObserver
: public chromeos::PolicyCertificateProvider::Observer {
: public ash::PolicyCertificateProvider::Observer {
public:
WebTrustedCertsChangedObserver() = default;

Expand All @@ -128,7 +128,7 @@ class WebTrustedCertsChangedObserver
WebTrustedCertsChangedObserver& operator=(
const WebTrustedCertsChangedObserver&) = delete;

// chromeos::PolicyCertificateProvider::Observer
// ash::PolicyCertificateProvider::Observer
void OnPolicyProvidedCertsChanged() override { run_loop_.Quit(); }

void Wait() { run_loop_.Run(); }
Expand Down

0 comments on commit 427ff7a

Please sign in to comment.