Skip to content

Commit

Permalink
Change namespace chromeos => ash for //c/b/ash/settings
Browse files Browse the repository at this point in the history
Code in //chrome/browser/ash/settings is a part of the ash-chrome, so
namespace is changed to ash from chromeos.

To avoid churn during other namespace transitions in future, this CL has
temporary 'using' declarations.

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

Bug: 1164001
Change-Id: I6a1cf768b81534c61a223ad7b0e5c5854d867573
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2727220
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Owners-Override: Hidehiko Abe <hidehiko@chromium.org>
Commit-Queue: Yeunjoo Choi <ychoi@igalia.com>
Cr-Commit-Position: refs/heads/master@{#861876}
  • Loading branch information
duswnchl authored and Chromium LUCI CQ committed Mar 11, 2021
1 parent 5cceeb0 commit d461f87
Show file tree
Hide file tree
Showing 231 changed files with 740 additions and 540 deletions.
2 changes: 1 addition & 1 deletion chrome/browser/ash/crosapi/metrics_reporting_ash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DelegateImpl : public MetricsReportingAsh::Delegate {
// Use primary profile because Lacros does not support multi-signin.
Profile* profile = ProfileManager::GetPrimaryUserProfile();
// Chrome OS uses this wrapper around the underlying metrics pref.
chromeos::StatsReportingController::Get()->SetEnabled(profile, enabled);
ash::StatsReportingController::Get()->SetEnabled(profile, enabled);
}
};

Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ash/login/existing_user_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include "chrome/browser/ash/login/screens/encryption_migration_mode.h"
#include "chrome/browser/ash/login/session/user_session_manager.h"
#include "chrome/browser/ash/login/ui/login_display.h"
// TODO(https://crbug.com/1164001): move CrosSettings to forward declaration
// when moved to chrome/browser/ash/.
#include "chrome/browser/ash/settings/cros_settings.h"
#include "chrome/browser/ash/settings/device_settings_service.h"
#include "chromeos/login/auth/login_performer.h"
Expand All @@ -49,8 +51,6 @@ class ListValue;
}

namespace chromeos {

class CrosSettings;
class LoginDisplay;
class OAuth2TokenInitializer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "chrome/browser/ash/login/users/supervised_user_manager.h"
// TODO(https://crbug.com/1164001): forward declare CrosSettings when moved to
// ash.
#include "chrome/browser/ash/settings/cros_settings.h"

namespace chromeos {

class ChromeUserManagerImpl;
class CrosSettings;
class SupervisedUserTestBase;

// TODO(crbug.com/1155729): Check this entire class is not used anymore for
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ash/login/version_info_updater.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include "base/macros.h"
#include "base/memory/weak_ptr.h"
// TODO(https://crbug.com/1164001): move CrosSettings to forward declaration
// when moved to chrome/browser/ash/.
#include "chrome/browser/ash/settings/cros_settings.h"
#include "chromeos/dbus/session_manager/session_manager_client.h"
#include "components/policy/core/common/cloud/cloud_policy_store.h"
Expand All @@ -21,8 +23,6 @@ class BluetoothAdapter;

namespace chromeos {

class CrosSettings;

// Fetches all info we want to show on OOBE/Login screens about system
// version, boot times and cloud policy.
class VersionInfoUpdater : public policy::CloudPolicyStore::Observer {
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ash/settings/cros_settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "chromeos/settings/system_settings_provider.h"
#include "google_apis/gaia/gaia_auth_util.h"

namespace chromeos {
namespace ash {

static CrosSettings* g_cros_settings = nullptr;

Expand Down Expand Up @@ -342,4 +342,4 @@ ScopedTestCrosSettings::~ScopedTestCrosSettings() {
CrosSettings::Shutdown();
}

} // namespace chromeos
} // namespace ash
14 changes: 7 additions & 7 deletions chrome/browser/ash/settings/cros_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ListValue;
class Value;
} // namespace base

namespace chromeos {
namespace ash {

class DeviceSettingsService;
class SupervisedUserCrosSettingsProvider;
Expand Down Expand Up @@ -165,12 +165,12 @@ class ScopedTestCrosSettings {
DISALLOW_COPY_AND_ASSIGN(ScopedTestCrosSettings);
};

} // namespace chromeos
} // namespace ash

// TODO(https://crbug.com/1164001): remove after //chrome/browser/chromeos
// source migration is finished.
namespace ash {
using ::chromeos::CrosSettings;
}
// TODO(https://crbug.com/1164001): remove when Chrome OS code migration is
// done.
namespace chromeos {
using ::ash::CrosSettings;
} // namespace chromeos

#endif // CHROME_BROWSER_ASH_SETTINGS_CROS_SETTINGS_H_
14 changes: 6 additions & 8 deletions chrome/browser/ash/settings/cros_settings_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

namespace em = enterprise_management;

namespace chromeos {
namespace ash {

namespace {
constexpr char kOwner[] = "me@owner";
Expand Down Expand Up @@ -143,7 +143,7 @@ class CrosSettingsTest : public testing::Test {
content::BrowserTaskEnvironment::IO_MAINLOOP};

ScopedTestingLocalState local_state_;
ScopedStubInstallAttributes scoped_install_attributes_;
chromeos::ScopedStubInstallAttributes scoped_install_attributes_;
ScopedTestDeviceSettingsService scoped_test_device_settings_;
ScopedTestCrosSettings scoped_test_cros_settings_;

Expand Down Expand Up @@ -360,8 +360,7 @@ TEST_F(CrosSettingsTest, FindEmailInListWildcard) {
// not set.
TEST_F(CrosSettingsTest, AllowFamilyLinkAccountsWithEmptyAllowlist) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
chromeos::features::kFamilyLinkOnSchoolDevice);
scoped_feature_list.InitAndEnableFeature(features::kFamilyLinkOnSchoolDevice);

device_policy_.payload().mutable_allow_new_users()->set_allow_new_users(
false);
Expand All @@ -386,7 +385,7 @@ TEST_F(CrosSettingsTest, AllowFamilyLinkAccountsWithEmptyAllowlist) {
TEST_F(CrosSettingsTest, AllowFamilyLinkAccountsWithFeatureDisabled) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(
chromeos::features::kFamilyLinkOnSchoolDevice);
features::kFamilyLinkOnSchoolDevice);

device_policy_.payload().mutable_allow_new_users()->set_allow_new_users(
false);
Expand All @@ -411,8 +410,7 @@ TEST_F(CrosSettingsTest, AllowFamilyLinkAccountsWithFeatureDisabled) {

TEST_F(CrosSettingsTest, AllowFamilyLinkAccountsWithAllowlist) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
chromeos::features::kFamilyLinkOnSchoolDevice);
scoped_feature_list.InitAndEnableFeature(features::kFamilyLinkOnSchoolDevice);

device_policy_.payload().mutable_allow_new_users()->set_allow_new_users(
false);
Expand All @@ -435,4 +433,4 @@ TEST_F(CrosSettingsTest, AllowFamilyLinkAccountsWithAllowlist) {
EXPECT_FALSE(IsUserAllowed(kUser1, user_manager::USER_TYPE_REGULAR));
}

} // namespace chromeos
} // namespace ash
4 changes: 2 additions & 2 deletions chrome/browser/ash/settings/device_settings_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace em = enterprise_management;

namespace chromeos {
namespace ash {

namespace device_settings_cache {

Expand Down Expand Up @@ -57,4 +57,4 @@ std::string PolicyDataToString(const em::PolicyData& policy) {

} // namespace device_settings_cache

} // namespace chromeos
} // namespace ash
4 changes: 2 additions & 2 deletions chrome/browser/ash/settings/device_settings_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PolicyData;
class PrefService;
class PrefRegistrySimple;

namespace chromeos {
namespace ash {

// There is need (metrics at OOBE stage) to store settings (that normally would
// go into DeviceSettings storage) before owner has been assigned (hence no key
Expand All @@ -41,6 +41,6 @@ std::string PolicyDataToString(const enterprise_management::PolicyData& policy);

} // namespace device_settings_cache

} // namespace chromeos
} // namespace ash

#endif // CHROME_BROWSER_ASH_SETTINGS_DEVICE_SETTINGS_CACHE_H_
4 changes: 2 additions & 2 deletions chrome/browser/ash/settings/device_settings_cache_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace em = enterprise_management;

namespace chromeos {
namespace ash {

class DeviceSettingsCacheTest : public testing::Test {
protected:
Expand Down Expand Up @@ -54,4 +54,4 @@ TEST_F(DeviceSettingsCacheTest, CorruptData) {
EXPECT_FALSE(device_settings_cache::Retrieve(&policy_out, &local_state_));
}

} // namespace chromeos
} // namespace ash
16 changes: 9 additions & 7 deletions chrome/browser/ash/settings/device_settings_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ using google::protobuf::RepeatedPtrField;

namespace em = enterprise_management;

namespace chromeos {
namespace ash {

namespace {

Expand Down Expand Up @@ -228,7 +228,7 @@ void DecodeLoginPolicies(const em::ChromeDeviceSettingsProto& policy,
policy.user_allowlist().user_allowlist_size() > 0));
new_values_cache->SetBoolean(
kAccountsPrefFamilyLinkAccountsAllowed,
chromeos::features::IsFamilyLinkOnSchoolDeviceEnabled() &&
features::IsFamilyLinkOnSchoolDeviceEnabled() &&
user_allowlist_enforced &&
policy.has_family_link_accounts_allowed() &&
policy.family_link_accounts_allowed()
Expand All @@ -248,7 +248,7 @@ void DecodeLoginPolicies(const em::ChromeDeviceSettingsProto& policy,
policy.guest_mode_enabled().guest_mode_enabled());

bool supervised_users_enabled = false;
if (!InstallAttributes::Get()->IsEnterpriseManaged()) {
if (!chromeos::InstallAttributes::Get()->IsEnterpriseManaged()) {
supervised_users_enabled = true;
}
new_values_cache->SetBoolean(kAccountsPrefSupervisedUsersEnabled,
Expand Down Expand Up @@ -696,7 +696,8 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy,
// If the policy is missing, default to reporting enabled on enterprise-
// enrolled devices, c.f. crbug/456186.
new_values_cache->SetBoolean(
kStatsReportingPref, InstallAttributes::Get()->IsEnterpriseManaged());
kStatsReportingPref,
chromeos::InstallAttributes::Get()->IsEnterpriseManaged());
}

if (!policy.has_release_channel() ||
Expand Down Expand Up @@ -1025,7 +1026,7 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy,
// Default value of the policy in case it's missing.
bool show_low_disk_space_notification = true;
// Disable the notification by default for enrolled devices.
if (InstallAttributes::Get()->IsEnterpriseManaged())
if (chromeos::InstallAttributes::Get()->IsEnterpriseManaged())
show_low_disk_space_notification = false;
if (policy.has_device_show_low_disk_space_notification()) {
const em::DeviceShowLowDiskSpaceNotificationProto& container(
Expand Down Expand Up @@ -1330,7 +1331,8 @@ void DeviceSettingsProvider::UpdateValuesCache(
bool DeviceSettingsProvider::MitigateMissingPolicy() {
// First check if the device has been owned already and if not exit
// immediately.
if (InstallAttributes::Get()->GetMode() != policy::DEVICE_MODE_CONSUMER)
if (chromeos::InstallAttributes::Get()->GetMode() !=
policy::DEVICE_MODE_CONSUMER)
return false;

// If we are here the policy file were corrupted or missing. This can happen
Expand Down Expand Up @@ -1444,4 +1446,4 @@ bool DeviceSettingsProvider::UpdateFromService() {
return settings_loaded;
}

} // namespace chromeos
} // namespace ash
8 changes: 7 additions & 1 deletion chrome/browser/ash/settings/device_settings_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace enterprise_management {
class ChromeDeviceSettingsProto;
} // namespace enterprise_management

namespace chromeos {
namespace ash {

// CrosSettingsProvider implementation that works with device settings.
// Dependency: chromeos::InstallAttributes must be initialized while this class
Expand Down Expand Up @@ -152,6 +152,12 @@ class DeviceSettingsProvider
DISALLOW_COPY_AND_ASSIGN(DeviceSettingsProvider);
};

} // namespace ash

// TODO(https://crbug.com/1164001): remove when Chrome OS code migration is
// done.
namespace chromeos {
using ::ash::DeviceSettingsProvider;
} // namespace chromeos

#endif // CHROME_BROWSER_ASH_SETTINGS_DEVICE_SETTINGS_PROVIDER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

namespace em = enterprise_management;

namespace chromeos {
namespace ash {

using ::testing::_;
using ::testing::AnyNumber;
Expand Down Expand Up @@ -1193,7 +1193,7 @@ TEST_F(DeviceSettingsProviderTestEnterprise,
TEST_F(DeviceSettingsProviderTest, DeviceFamilyLinkAccountsAllowedDisabled) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(
chromeos::features::kFamilyLinkOnSchoolDevice);
features::kFamilyLinkOnSchoolDevice);

base::Value default_value(false);
VerifyPolicyValue(kAccountsPrefFamilyLinkAccountsAllowed, &default_value);
Expand All @@ -1208,8 +1208,7 @@ TEST_F(DeviceSettingsProviderTest, DeviceFamilyLinkAccountsAllowedDisabled) {
// Tests DeviceFamilyLinkAccountsAllowed policy with the feature enabled.
TEST_F(DeviceSettingsProviderTest, DeviceFamilyLinkAccountsAllowedEnabled) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
chromeos::features::kFamilyLinkOnSchoolDevice);
scoped_feature_list.InitAndEnableFeature(features::kFamilyLinkOnSchoolDevice);

base::Value default_value(false);
VerifyPolicyValue(kAccountsPrefFamilyLinkAccountsAllowed, &default_value);
Expand Down Expand Up @@ -1255,4 +1254,4 @@ TEST_F(DeviceSettingsProviderTest, DecodeBorealisDisallowed) {
EXPECT_EQ(base::Value(false), *provider_->Get(kBorealisAllowedForDevice));
}

} // namespace chromeos
} // namespace ash
6 changes: 3 additions & 3 deletions chrome/browser/ash/settings/device_settings_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace em = enterprise_management;
using ownership::OwnerKeyUtil;
using ownership::PublicKey;

namespace chromeos {
namespace ash {

DeviceSettingsService::Observer::~Observer() {}

Expand Down Expand Up @@ -97,7 +97,7 @@ DeviceSettingsService::~DeviceSettingsService() {
}

void DeviceSettingsService::SetSessionManager(
SessionManagerClient* session_manager_client,
chromeos::SessionManagerClient* session_manager_client,
scoped_refptr<OwnerKeyUtil> owner_key_util) {
DCHECK(session_manager_client);
DCHECK(owner_key_util.get());
Expand Down Expand Up @@ -380,4 +380,4 @@ ScopedTestDeviceSettingsService::~ScopedTestDeviceSettingsService() {
DeviceSettingsService::Shutdown();
}

} // namespace chromeos
} // namespace ash
Loading

0 comments on commit d461f87

Please sign in to comment.