Skip to content

Commit

Permalink
Migrate //chromeos/ash/components/system to namespace ash
Browse files Browse the repository at this point in the history
And this CL holds the namespace migration of devicemode.{cc|h} because
they can be moved to //ui/ozone.

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

Change-Id: I379627193217cb3acf6af9335d5fb2d7fbaaaa94
Bug: 1164001
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4110194
Commit-Queue: Yeunjoo Choi <ychoi@igalia.com>
Owners-Override: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1085230}
  • Loading branch information
duswnchl authored and Chromium LUCI CQ committed Dec 20, 2022
1 parent eb98cb5 commit 4628967
Show file tree
Hide file tree
Showing 157 changed files with 511 additions and 650 deletions.
3 changes: 1 addition & 2 deletions ash/components/arc/session/arc_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ void ArcSession::RemoveObserver(Observer* observer) {
std::unique_ptr<ArcSession> ArcSession::Create(
ArcBridgeService* arc_bridge_service,
version_info::Channel channel,
chromeos::SchedulerConfigurationManagerBase*
scheduler_configuration_manager,
ash::SchedulerConfigurationManagerBase* scheduler_configuration_manager,
AdbSideloadingAvailabilityDelegate* adb_sideloading_availability_delegate) {
return std::make_unique<ArcSessionImpl>(
ArcSessionImpl::CreateDelegate(arc_bridge_service, channel),
Expand Down
5 changes: 2 additions & 3 deletions ash/components/arc/session/arc_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "base/callback_forward.h"
#include "base/observer_list.h"

namespace chromeos {
namespace ash {
class SchedulerConfigurationManagerBase;
}

Expand Down Expand Up @@ -58,8 +58,7 @@ class ArcSession {
static std::unique_ptr<ArcSession> Create(
ArcBridgeService* arc_bridge_service,
version_info::Channel channel,
chromeos::SchedulerConfigurationManagerBase*
scheduler_configuration_manager,
ash::SchedulerConfigurationManagerBase* scheduler_configuration_manager,
AdbSideloadingAvailabilityDelegate*
adb_sideloading_availability_delegate);

Expand Down
3 changes: 1 addition & 2 deletions ash/components/arc/session/arc_session_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,7 @@ std::unique_ptr<ArcSessionImpl::Delegate> ArcSessionImpl::CreateDelegate(

ArcSessionImpl::ArcSessionImpl(
std::unique_ptr<Delegate> delegate,
chromeos::SchedulerConfigurationManagerBase*
scheduler_configuration_manager,
ash::SchedulerConfigurationManagerBase* scheduler_configuration_manager,
AdbSideloadingAvailabilityDelegate* adb_sideloading_availability_delegate)
: delegate_(std::move(delegate)),
client_(delegate_->CreateClient()),
Expand Down
21 changes: 10 additions & 11 deletions ash/components/arc/session/arc_session_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ class ArcBridgeHost;

constexpr int64_t kMinimumFreeDiskSpaceBytes = 64 << 20; // 64MB

class ArcSessionImpl
: public ArcSession,
public ArcClientAdapter::Observer,
public chromeos::SchedulerConfigurationManagerBase::Observer {
class ArcSessionImpl : public ArcSession,
public ArcClientAdapter::Observer,
public ash::SchedulerConfigurationManagerBase::Observer {
public:
// The possible states of the session. Expected state changes are as follows.
//
Expand Down Expand Up @@ -164,11 +163,11 @@ class ArcSessionImpl
using SystemMemoryInfoCallback =
base::RepeatingCallback<bool(base::SystemMemoryInfoKB*)>;

ArcSessionImpl(std::unique_ptr<Delegate> delegate,
chromeos::SchedulerConfigurationManagerBase*
scheduler_configuration_manager,
AdbSideloadingAvailabilityDelegate*
adb_sideloading_availability_delegate);
ArcSessionImpl(
std::unique_ptr<Delegate> delegate,
ash::SchedulerConfigurationManagerBase* scheduler_configuration_manager,
AdbSideloadingAvailabilityDelegate*
adb_sideloading_availability_delegate);

ArcSessionImpl(const ArcSessionImpl&) = delete;
ArcSessionImpl& operator=(const ArcSessionImpl&) = delete;
Expand Down Expand Up @@ -200,7 +199,7 @@ class ArcSessionImpl
void SetDefaultDeviceScaleFactor(float scale_factor) override;
void SetUseVirtioBlkData(bool use_virtio_blk_data) override;

// chromeos::SchedulerConfigurationManagerBase::Observer overrides:
// ash::SchedulerConfigurationManagerBase::Observer overrides:
void OnConfigurationSet(bool success, size_t num_cores_disabled) override;

private:
Expand Down Expand Up @@ -291,7 +290,7 @@ class ArcSessionImpl
std::unique_ptr<mojom::ArcBridgeHost> arc_bridge_host_;

int lcd_density_ = 0;
chromeos::SchedulerConfigurationManagerBase* const
ash::SchedulerConfigurationManagerBase* const
scheduler_configuration_manager_;

// Owned by ArcSessionManager.
Expand Down
2 changes: 1 addition & 1 deletion ash/components/arc/session/arc_session_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ struct ArcSessionDeleter {
};

class FakeSchedulerConfigurationManager
: public chromeos::SchedulerConfigurationManagerBase {
: public ash::SchedulerConfigurationManagerBase {
public:
FakeSchedulerConfigurationManager() = default;

Expand Down
4 changes: 2 additions & 2 deletions ash/components/arc/session/arc_vm_client_adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,8 @@ class ArcVmClientAdapter : public ArcClientAdapter,
// For testing purposes and the internal use (by the other ctor) only.
explicit ArcVmClientAdapter(const FileSystemStatusRewriter& rewriter)
: delegate_(std::make_unique<ArcVmClientAdapterDelegate>()),
is_host_on_vm_(chromeos::system::StatisticsProvider::GetInstance()
->IsRunningOnVm()),
is_host_on_vm_(
ash::system::StatisticsProvider::GetInstance()->IsRunningOnVm()),
file_system_status_rewriter_for_testing_(rewriter) {
auto* client = GetConciergeClient();
client->AddVmObserver(this);
Expand Down
5 changes: 2 additions & 3 deletions ash/test/ash_test_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,8 @@ class AshTestHelper : public aura::test::AuraTestHelper {

std::unique_ptr<base::test::ScopedCommandLine> command_line_ =
std::make_unique<base::test::ScopedCommandLine>();
std::unique_ptr<chromeos::system::ScopedFakeStatisticsProvider>
statistics_provider_ =
std::make_unique<chromeos::system::ScopedFakeStatisticsProvider>();
std::unique_ptr<system::ScopedFakeStatisticsProvider> statistics_provider_ =
std::make_unique<system::ScopedFakeStatisticsProvider>();
std::unique_ptr<TestPrefServiceProvider> prefs_provider_ =
std::make_unique<TestPrefServiceProvider>();
std::unique_ptr<TestNotifierSettingsController>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,10 @@ constexpr base::StringPiece kTurkeyRegionCode = "tr";
constexpr base::StringPiece kTurkeyFLayoutRegionCode = "tr.f";

mojom::MechanicalLayout GetSystemMechanicalLayout() {
chromeos::system::StatisticsProvider* stats_provider =
chromeos::system::StatisticsProvider::GetInstance();
system::StatisticsProvider* stats_provider =
system::StatisticsProvider::GetInstance();
const absl::optional<base::StringPiece> layout_string =
stats_provider->GetMachineStatistic(
chromeos::system::kKeyboardMechanicalLayoutKey);
stats_provider->GetMachineStatistic(system::kKeyboardMechanicalLayoutKey);
if (!layout_string) {
LOG(ERROR) << "Couldn't determine mechanical layout";
return mojom::MechanicalLayout::kUnknown;
Expand All @@ -241,10 +240,10 @@ mojom::MechanicalLayout GetSystemMechanicalLayout() {
}

absl::optional<std::string> GetRegionCode() {
chromeos::system::StatisticsProvider* stats_provider =
chromeos::system::StatisticsProvider::GetInstance();
system::StatisticsProvider* stats_provider =
system::StatisticsProvider::GetInstance();
const absl::optional<base::StringPiece> layout_string =
stats_provider->GetMachineStatistic(chromeos::system::kRegionKey);
stats_provider->GetMachineStatistic(system::kRegionKey);
if (!layout_string) {
LOG(ERROR) << "Couldn't determine region";
return absl::nullopt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,11 @@ class InputDataProviderKeyboardTest : public ash::AshTestBase {
AshTestSuite::LoadTestResources();
AshTestBase::SetUp();

chromeos::system::StatisticsProvider::SetTestProvider(
&statistics_provider_);
system::StatisticsProvider::SetTestProvider(&statistics_provider_);

statistics_provider_.SetMachineStatistic(
chromeos::system::kKeyboardMechanicalLayoutKey, "ANSI");
statistics_provider_.SetMachineStatistic(chromeos::system::kRegionKey,
"us");
system::kKeyboardMechanicalLayoutKey, "ANSI");
statistics_provider_.SetMachineStatistic(system::kRegionKey, "us");

keyboard_info_ = input_data_provider_keyboard_->ConstructKeyboard(
&device_information, &aux_data_);
Expand Down Expand Up @@ -166,7 +164,7 @@ class InputDataProviderKeyboardTest : public ash::AshTestBase {
protected:
InputDeviceInformation device_information;
std::unique_ptr<InputDataProviderKeyboard> input_data_provider_keyboard_;
chromeos::system::FakeStatisticsProvider statistics_provider_;
system::FakeStatisticsProvider statistics_provider_;
mojom::KeyboardInfoPtr keyboard_info_;
InputDataProviderKeyboard::AuxData aux_data_;
};
Expand Down Expand Up @@ -312,7 +310,7 @@ TEST_F(VivaldiKeyboardTestBase, ScanCodeIndexesWithZeroScanCodes) {

TEST_F(VivaldiKeyboardTestBase, TurkishNoFLayout) {
SetCurrentImeId(std::string(kTurkishKeyboardLayoutId));
statistics_provider_.SetMachineStatistic(chromeos::system::kRegionKey,
statistics_provider_.SetMachineStatistic(system::kRegionKey,
std::string(kTurkeyRegionCode));

keyboard_info_ = input_data_provider_keyboard_->ConstructKeyboard(
Expand All @@ -323,7 +321,7 @@ TEST_F(VivaldiKeyboardTestBase, TurkishNoFLayout) {

TEST_F(VivaldiKeyboardTestBase, TurkishFLayout) {
SetCurrentImeId(std::string(kTurkishKeyboardFLayoutId));
statistics_provider_.SetMachineStatistic(chromeos::system::kRegionKey,
statistics_provider_.SetMachineStatistic(system::kRegionKey,
std::string(kTurkeyRegionCode));

keyboard_info_ = input_data_provider_keyboard_->ConstructKeyboard(
Expand Down Expand Up @@ -361,8 +359,8 @@ INSTANTIATE_TEST_SUITE_P(
});

TEST_P(MechanicalLayoutTest, CheckLayout) {
statistics_provider_.SetMachineStatistic(
chromeos::system::kKeyboardMechanicalLayoutKey, layout_string_);
statistics_provider_.SetMachineStatistic(system::kKeyboardMechanicalLayoutKey,
layout_string_);

keyboard_info_ = input_data_provider_keyboard_->ConstructKeyboard(
&device_information, &aux_data_);
Expand Down Expand Up @@ -391,8 +389,7 @@ INSTANTIATE_TEST_SUITE_P(
});

TEST_P(RegionCodeTest, CheckRegionCode) {
statistics_provider_.SetMachineStatistic(chromeos::system::kRegionKey,
region_code_);
statistics_provider_.SetMachineStatistic(system::kRegionKey, region_code_);

keyboard_info_ = input_data_provider_keyboard_->ConstructKeyboard(
&device_information, &aux_data_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,8 @@ class InputDataProviderTest : public AshTestBase {
// SetUp, so we can safely invoke CreateTestWidget().

statistics_provider_.SetMachineStatistic(
chromeos::system::kKeyboardMechanicalLayoutKey, "ANSI");
chromeos::system::StatisticsProvider::SetTestProvider(
&statistics_provider_);
system::kKeyboardMechanicalLayoutKey, "ANSI");
system::StatisticsProvider::SetTestProvider(&statistics_provider_);

fake_udev_ = std::make_unique<testing::FakeUdevLoader>();
widget_ = CreateTestWidget();
Expand Down Expand Up @@ -773,7 +772,7 @@ class InputDataProviderTest : public AshTestBase {
}

std::unique_ptr<testing::FakeUdevLoader> fake_udev_;
chromeos::system::FakeStatisticsProvider statistics_provider_;
system::FakeStatisticsProvider statistics_provider_;
std::unique_ptr<views::Widget> widget_;
// All evdev watchers in use by provider_.
watchers_t watchers_;
Expand Down Expand Up @@ -987,8 +986,8 @@ TEST_F(InputDataProviderTest, GetConnectedDevices_NoExternalKeyboards) {
}

TEST_F(InputDataProviderTest, KeyboardPhysicalLayoutDetection) {
statistics_provider_.SetMachineStatistic(
chromeos::system::kKeyboardMechanicalLayoutKey, "ISO");
statistics_provider_.SetMachineStatistic(system::kKeyboardMechanicalLayoutKey,
"ISO");

ui::DeviceEvent event0(ui::DeviceEvent::DeviceType::INPUT,
ui::DeviceEvent::ActionType::ADD,
Expand Down Expand Up @@ -1070,7 +1069,7 @@ TEST_F(InputDataProviderTest, KeyboardPhysicalLayoutDetection) {
}

TEST_F(InputDataProviderTest, KeyboardRegionDetection) {
statistics_provider_.SetMachineStatistic(chromeos::system::kRegionKey, "jp");
statistics_provider_.SetMachineStatistic(system::kRegionKey, "jp");

ui::DeviceEvent event_internal(ui::DeviceEvent::DeviceType::INPUT,
ui::DeviceEvent::ActionType::ADD,
Expand Down Expand Up @@ -1099,7 +1098,7 @@ TEST_F(InputDataProviderTest, KeyboardRegionDetection) {
}

TEST_F(InputDataProviderTest, KeyboardRegionDetection_Failure) {
statistics_provider_.ClearMachineStatistic(chromeos::system::kRegionKey);
statistics_provider_.ClearMachineStatistic(system::kRegionKey);

ui::DeviceEvent event_internal(ui::DeviceEvent::DeviceType::INPUT,
ui::DeviceEvent::ActionType::ADD,
Expand Down Expand Up @@ -1371,7 +1370,7 @@ TEST_F(InputDataProviderTest, SillyDeviceDoesNotCrash) {

TEST_F(InputDataProviderTest, GetKeyboardMechanicalLayout_Unknown1) {
statistics_provider_.ClearMachineStatistic(
chromeos::system::kKeyboardMechanicalLayoutKey);
system::kKeyboardMechanicalLayoutKey);

ui::DeviceEvent add_keyboard_event(ui::DeviceEvent::DeviceType::INPUT,
ui::DeviceEvent::ActionType::ADD,
Expand Down Expand Up @@ -1401,8 +1400,8 @@ TEST_F(InputDataProviderTest, GetKeyboardMechanicalLayout_Unknown1) {
}

TEST_F(InputDataProviderTest, GetKeyboardMechanicalLayout_Unknown2) {
statistics_provider_.SetMachineStatistic(
chromeos::system::kKeyboardMechanicalLayoutKey, kInvalidMechnicalLayout);
statistics_provider_.SetMachineStatistic(system::kKeyboardMechanicalLayoutKey,
kInvalidMechnicalLayout);
ui::DeviceEvent add_keyboard_event(ui::DeviceEvent::DeviceType::INPUT,
ui::DeviceEvent::ActionType::ADD,
base::FilePath("/dev/input/event6"));
Expand Down
6 changes: 4 additions & 2 deletions base/threading/thread_restrictions.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ class LoginEventRecorder;
class StartupCustomizationDocument;
class StartupUtils;
bool CameraAppUIShouldEnableLocalOverride(const std::string&);
namespace system {
class StatisticsProviderImpl;
} // namespace system
} // namespace ash
namespace audio {
class OutputDevice;
Expand Down Expand Up @@ -196,7 +199,6 @@ class CrashUtil;
namespace chromeos {
class BlockingMethodCaller;
namespace system {
class StatisticsProviderImpl;
bool IsCoreSchedulingAvailable();
int NumberOfPhysicalCores();
} // namespace system
Expand Down Expand Up @@ -749,7 +751,7 @@ class BASE_EXPORT ScopedAllowBaseSyncPrimitives {

// Usage that should be fixed:
friend class ::NativeBackendKWallet; // http://crbug.com/125331
friend class ::chromeos::system::
friend class ::ash::system::
StatisticsProviderImpl; // http://crbug.com/125385
friend class blink::VideoFrameResourceProvider; // http://crbug.com/878070
friend class value_store::LeveldbValueStore; // http://crbug.com/1330845
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class ArcAppQueueRestoreHandler
public wm::ActivationChangeObserver,
public aura::EnvObserver,
public aura::WindowObserver,
public chromeos::SchedulerConfigurationManagerBase::Observer {
public SchedulerConfigurationManagerBase::Observer {
public:
struct WindowInfo {
std::string app_id;
Expand Down Expand Up @@ -155,7 +155,7 @@ class ArcAppQueueRestoreHandler
// aura::WindowObserver:
void OnWindowDestroying(aura::Window* window) override;

// chromeos::SchedulerConfigurationManagerBase::Observer:
// SchedulerConfigurationManagerBase::Observer:
void OnConfigurationSet(bool success, size_t num_cores_disabled) override;

void set_desk_template_launch_id(int32_t desk_template_launch_id) {
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ash/arc/adbd/arc_adbd_monitor_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ bool IsAdbOverUsbEnabled() {
bool has_adbd_json = base::PathExists(base::FilePath(kAdbdJson));
// True when the *host* is running on a VM.
bool is_host_on_vm =
chromeos::system::StatisticsProvider::GetInstance()->IsRunningOnVm();
ash::system::StatisticsProvider::GetInstance()->IsRunningOnVm();
bool is_adb_over_usb_enabled =
ShouldStartAdbd(is_dev_mode, is_host_on_vm, has_adbd_json, udc_disabled);
return g_enable_adb_over_usb_for_testing || is_adb_over_usb_enabled;
Expand Down
5 changes: 2 additions & 3 deletions chrome/browser/ash/arc/policy/arc_policy_bridge_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ class ArcPolicyBridgeTestBase {

void DoSetUp(bool is_affiliated) {
// Set up fake StatisticsProvider.
chromeos::system::StatisticsProvider::SetTestProvider(
&statistics_provider_);
ash::system::StatisticsProvider::SetTestProvider(&statistics_provider_);

// Set up ArcBridgeService.
bridge_service_ = std::make_unique<ArcBridgeService>();
Expand Down Expand Up @@ -325,7 +324,7 @@ class ArcPolicyBridgeTestBase {
TestingProfile* profile() { return profile_; }
ArcBridgeService* bridge_service() { return bridge_service_.get(); }
CertStoreService* cert_store_service() { return cert_store_service_; }
chromeos::system::FakeStatisticsProvider statistics_provider_;
ash::system::FakeStatisticsProvider statistics_provider_;

private:
content::BrowserTaskEnvironment task_environment_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ std::string DeviceAnnotatedLocation(
}

std::string DeviceSerialNumber() {
return std::string(chromeos::system::StatisticsProvider::GetInstance()
->GetMachineID()
.value_or(""));
return std::string(
ash::system::StatisticsProvider::GetInstance()->GetMachineID().value_or(
""));
}

// Map associating known variables to functions that return the corresponding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,8 @@ class ManagedConfigurationVariablesBase {
void DoSetUp(bool is_affiliated) {
// Set up fake StatisticsProvider.
statistics_provider_.SetMachineStatistic(
chromeos::system::kSerialNumberKeyForTest, kTestDeviceSerialNumber);
chromeos::system::StatisticsProvider::SetTestProvider(
&statistics_provider_);
ash::system::kSerialNumberKeyForTest, kTestDeviceSerialNumber);
ash::system::StatisticsProvider::SetTestProvider(&statistics_provider_);

// Set up a fake user and capture its profile.
auto* const user_manager = new ash::FakeChromeUserManager();
Expand Down Expand Up @@ -251,7 +250,7 @@ class ManagedConfigurationVariablesBase {

TestingProfile* profile_;

chromeos::system::FakeStatisticsProvider statistics_provider_;
ash::system::FakeStatisticsProvider statistics_provider_;

std::unique_ptr<policy::FakeDeviceAttributes> fake_device_attributes_;
};
Expand Down

0 comments on commit 4628967

Please sign in to comment.