diff --git a/chrome/browser/ash/cert_provisioning/cert_provisioning_scheduler.cc b/chrome/browser/ash/cert_provisioning/cert_provisioning_scheduler.cc index 1a2d17f37c4c8..3f68aca4889c2 100644 --- a/chrome/browser/ash/cert_provisioning/cert_provisioning_scheduler.cc +++ b/chrome/browser/ash/cert_provisioning/cert_provisioning_scheduler.cc @@ -21,7 +21,7 @@ #include "chrome/browser/ash/cert_provisioning/cert_provisioning_common.h" #include "chrome/browser/ash/cert_provisioning/cert_provisioning_metrics.h" #include "chrome/browser/ash/cert_provisioning/cert_provisioning_worker.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" @@ -53,8 +53,8 @@ const base::TimeDelta kInconsistentDataErrorRetryDelay = base::TimeDelta::FromSeconds(30); policy::CloudPolicyClient* GetCloudPolicyClientForUser(Profile* profile) { - policy::UserCloudPolicyManagerChromeOS* user_cloud_policy_manager = - profile->GetUserCloudPolicyManagerChromeOS(); + policy::UserCloudPolicyManagerAsh* user_cloud_policy_manager = + profile->GetUserCloudPolicyManagerAsh(); if (!user_cloud_policy_manager) { return nullptr; } diff --git a/chrome/browser/ash/child_accounts/child_policy_observer.cc b/chrome/browser/ash/child_accounts/child_policy_observer.cc index 7f9431085b081..69acb2836243d 100644 --- a/chrome/browser/ash/child_accounts/child_policy_observer.cc +++ b/chrome/browser/ash/child_accounts/child_policy_observer.cc @@ -5,7 +5,7 @@ #include "chrome/browser/ash/child_accounts/child_policy_observer.h" #include "base/timer/timer.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/profiles/profile.h" #include "components/policy/core/common/cloud/cloud_policy_core.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -72,10 +72,10 @@ void ChildPolicyObserver::OnPolicyReady( std::move(on_policy_ready_).Run(profile_, refresh_result_); } -policy::UserCloudPolicyManagerChromeOS* +policy::UserCloudPolicyManagerAsh* ChildPolicyObserver::GetUserCloudPolicyManager() { - policy::UserCloudPolicyManagerChromeOS* user_cloud_policy_manager = - profile_->GetUserCloudPolicyManagerChromeOS(); + policy::UserCloudPolicyManagerAsh* user_cloud_policy_manager = + profile_->GetUserCloudPolicyManagerAsh(); DCHECK(user_cloud_policy_manager); return user_cloud_policy_manager; } diff --git a/chrome/browser/ash/child_accounts/child_policy_observer.h b/chrome/browser/ash/child_accounts/child_policy_observer.h index 010fc9830b40d..0117b265229da 100644 --- a/chrome/browser/ash/child_accounts/child_policy_observer.h +++ b/chrome/browser/ash/child_accounts/child_policy_observer.h @@ -20,7 +20,7 @@ class OneShotTimer; } // namespace base namespace policy { -class UserCloudPolicyManagerChromeOS; +class UserCloudPolicyManagerAsh; } // namespace policy namespace ash { @@ -72,7 +72,7 @@ class ChildPolicyObserver : public policy::CloudPolicyService::Observer { void OnPolicyReady(InitialPolicyRefreshResult refresh_result); // Returns user cloud policy manager for |profile_|. - policy::UserCloudPolicyManagerChromeOS* GetUserCloudPolicyManager(); + policy::UserCloudPolicyManagerAsh* GetUserCloudPolicyManager(); // The result of initial policy refresh for child user. InitialPolicyRefreshResult refresh_result_ = diff --git a/chrome/browser/ash/child_accounts/child_status_reporting_service.cc b/chrome/browser/ash/child_accounts/child_status_reporting_service.cc index c130fb02fbf35..a93c2e5bb3bb8 100644 --- a/chrome/browser/ash/child_accounts/child_status_reporting_service.cc +++ b/chrome/browser/ash/child_accounts/child_status_reporting_service.cc @@ -9,7 +9,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "chrome/browser/ash/child_accounts/event_based_status_reporting_service_factory.h" #include "chrome/browser/ash/child_accounts/usage_time_limit_processor.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/policy/status_collector/child_status_collector.h" #include "chrome/browser/ash/policy/uploading/status_uploader.h" #include "chrome/browser/profiles/profile.h" @@ -37,7 +37,7 @@ ChildStatusReportingService::ChildStatusReportingService( Profile* profile = Profile::FromBrowserContext(context_); // If child user is registered with DMServer and has User Policy applied, it // should upload device status to the server. - user_cloud_policy_manager_ = profile->GetUserCloudPolicyManagerChromeOS(); + user_cloud_policy_manager_ = profile->GetUserCloudPolicyManagerAsh(); if (!user_cloud_policy_manager_) { LOG(WARNING) << "Child user is not managed by User Policy - status reports " "cannot be uploaded to the server. "; diff --git a/chrome/browser/ash/child_accounts/child_status_reporting_service.h b/chrome/browser/ash/child_accounts/child_status_reporting_service.h index b946bb1ea8f52..69350ec88eff6 100644 --- a/chrome/browser/ash/child_accounts/child_status_reporting_service.h +++ b/chrome/browser/ash/child_accounts/child_status_reporting_service.h @@ -19,7 +19,7 @@ class BrowserContext; namespace policy { class CloudPolicyClient; class StatusUploader; -class UserCloudPolicyManagerChromeOS; +class UserCloudPolicyManagerAsh; } // namespace policy namespace ash { @@ -64,7 +64,7 @@ class ChildStatusReportingService : public KeyedService { content::BrowserContext* const context_; - policy::UserCloudPolicyManagerChromeOS* user_cloud_policy_manager_; + policy::UserCloudPolicyManagerAsh* user_cloud_policy_manager_; }; } // namespace ash diff --git a/chrome/browser/ash/crosapi/browser_manager.cc b/chrome/browser/ash/crosapi/browser_manager.cc index d9de1fde668aa..401f298d5d9bf 100644 --- a/chrome/browser/ash/crosapi/browser_manager.cc +++ b/chrome/browser/ash/crosapi/browser_manager.cc @@ -48,7 +48,7 @@ #include "chrome/browser/ash/crosapi/test_mojo_connection_manager.h" #include "chrome/browser/ash/policy/core/browser_policy_connector_chromeos.h" #include "chrome/browser/ash/policy/core/device_local_account_policy_service.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part_chromeos.h" @@ -813,7 +813,7 @@ policy::CloudPolicyStore* BrowserManager::GetDeviceAccountPolicyStore() { Profile* profile = chromeos::ProfileHelper::Get()->GetProfileByUser(user); DCHECK(profile); policy::CloudPolicyManager* user_cloud_policy_manager = - profile->GetUserCloudPolicyManagerChromeOS(); + profile->GetUserCloudPolicyManagerAsh(); if (!user_cloud_policy_manager) return nullptr; return user_cloud_policy_manager->core()->store(); diff --git a/chrome/browser/ash/login/users/avatar/user_image_manager_browsertest.cc b/chrome/browser/ash/login/users/avatar/user_image_manager_browsertest.cc index 736c98b487700..f373f8ca0d822 100644 --- a/chrome/browser/ash/login/users/avatar/user_image_manager_browsertest.cc +++ b/chrome/browser/ash/login/users/avatar/user_image_manager_browsertest.cc @@ -37,7 +37,7 @@ #include "chrome/browser/ash/login/users/mock_user_manager.h" #include "chrome/browser/ash/ownership/owner_settings_service_ash_factory.h" #include "chrome/browser/ash/policy/core/device_policy_builder.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/policy/external_data/cloud_external_data_manager_base_test_util.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/browser_process.h" @@ -92,8 +92,8 @@ policy::CloudPolicyStore* GetStoreForUser(const user_manager::User* user) { ADD_FAILURE(); return NULL; } - policy::UserCloudPolicyManagerChromeOS* policy_manager = - profile->GetUserCloudPolicyManagerChromeOS(); + policy::UserCloudPolicyManagerAsh* policy_manager = + profile->GetUserCloudPolicyManagerAsh(); if (!policy_manager) { ADD_FAILURE(); return NULL; diff --git a/chrome/browser/ash/login/users/wallpaper_policy_browsertest.cc b/chrome/browser/ash/login/users/wallpaper_policy_browsertest.cc index 1d10c1a8602d1..4c1b560d5aac3 100644 --- a/chrome/browser/ash/login/users/wallpaper_policy_browsertest.cc +++ b/chrome/browser/ash/login/users/wallpaper_policy_browsertest.cc @@ -31,7 +31,7 @@ #include "chrome/browser/ash/login/ui/login_display_host.h" #include "chrome/browser/ash/ownership/owner_settings_service_ash_factory.h" #include "chrome/browser/ash/policy/core/device_policy_builder.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/policy/external_data/cloud_external_data_manager_base_test_util.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/profiles/profile.h" @@ -80,8 +80,8 @@ policy::CloudPolicyStore* GetStoreForUser(const user_manager::User* user) { ADD_FAILURE(); return NULL; } - policy::UserCloudPolicyManagerChromeOS* policy_manager = - profile->GetUserCloudPolicyManagerChromeOS(); + policy::UserCloudPolicyManagerAsh* policy_manager = + profile->GetUserCloudPolicyManagerAsh(); if (!policy_manager) { ADD_FAILURE(); return NULL; diff --git a/chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.cc b/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.cc similarity index 89% rename from chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.cc rename to chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.cc index 013744cf6bcf3..15fc6e3ddc3c5 100644 --- a/chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.cc +++ b/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include #include @@ -88,7 +88,7 @@ const char kUMAReregistrationResult[] = "Enterprise.UserPolicyChromeOS.ReregistrationResult"; // The oauth token consumer name. -const char kOAuthConsumerName[] = "user_cloud_policy_manager_chromeos"; +const char kOAuthConsumerName[] = "user_cloud_policy_manager_ash"; // This enum is used in UMA, items should not be reordered/deleted. New values // should also be added to enums.xml. @@ -113,32 +113,31 @@ bool IsChildUser(const AccountId& account_id) { // This class is used to subscribe for notifications that the current profile is // being shut down. -class UserCloudPolicyManagerChromeOSNotifierFactory +class UserCloudPolicyManagerAshNotifierFactory : public BrowserContextKeyedServiceShutdownNotifierFactory { public: - static UserCloudPolicyManagerChromeOSNotifierFactory* GetInstance() { - return base::Singleton< - UserCloudPolicyManagerChromeOSNotifierFactory>::get(); + static UserCloudPolicyManagerAshNotifierFactory* GetInstance() { + return base::Singleton::get(); } private: friend struct base::DefaultSingletonTraits< - UserCloudPolicyManagerChromeOSNotifierFactory>; + UserCloudPolicyManagerAshNotifierFactory>; - UserCloudPolicyManagerChromeOSNotifierFactory() + UserCloudPolicyManagerAshNotifierFactory() : BrowserContextKeyedServiceShutdownNotifierFactory( "UserRemoteCommandsInvalidator") { DependsOn(invalidation::ProfileInvalidationProviderFactory::GetInstance()); } - ~UserCloudPolicyManagerChromeOSNotifierFactory() override = default; + ~UserCloudPolicyManagerAshNotifierFactory() override = default; - DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOSNotifierFactory); + DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerAshNotifierFactory); }; } // namespace -UserCloudPolicyManagerChromeOS::UserCloudPolicyManagerChromeOS( +UserCloudPolicyManagerAsh::UserCloudPolicyManagerAsh( Profile* profile, std::unique_ptr store, std::unique_ptr external_data_manager, @@ -181,7 +180,7 @@ UserCloudPolicyManagerChromeOS::UserCloudPolicyManagerChromeOS( DCHECK_EQ(enforcement_type_, PolicyEnforcement::kPolicyRequired); policy_refresh_timeout_.Start( FROM_HERE, policy_refresh_timeout, - base::BindOnce(&UserCloudPolicyManagerChromeOS::OnPolicyRefreshTimeout, + base::BindOnce(&UserCloudPolicyManagerAsh::OnPolicyRefreshTimeout, base::Unretained(this))); } @@ -193,7 +192,7 @@ UserCloudPolicyManagerChromeOS::UserCloudPolicyManagerChromeOS( observed_profile_manager_.Observe(g_browser_process->profile_manager()); } -void UserCloudPolicyManagerChromeOS::ForceTimeoutForTest() { +void UserCloudPolicyManagerAsh::ForceTimeoutForTest() { DCHECK(policy_refresh_timeout_.IsRunning()); // Stop the timer to mimic what happens when a real timer fires, then invoke // the timer callback directly. @@ -201,19 +200,19 @@ void UserCloudPolicyManagerChromeOS::ForceTimeoutForTest() { OnPolicyRefreshTimeout(); } -void UserCloudPolicyManagerChromeOS::SetSignInURLLoaderFactoryForTests( +void UserCloudPolicyManagerAsh::SetSignInURLLoaderFactoryForTests( scoped_refptr signin_url_loader_factory) { signin_url_loader_factory_for_tests_ = signin_url_loader_factory; } -void UserCloudPolicyManagerChromeOS::SetSystemURLLoaderFactoryForTests( +void UserCloudPolicyManagerAsh::SetSystemURLLoaderFactoryForTests( scoped_refptr system_url_loader_factory) { system_url_loader_factory_for_tests_ = system_url_loader_factory; } -UserCloudPolicyManagerChromeOS::~UserCloudPolicyManagerChromeOS() = default; +UserCloudPolicyManagerAsh::~UserCloudPolicyManagerAsh() = default; -void UserCloudPolicyManagerChromeOS::Connect( +void UserCloudPolicyManagerAsh::Connect( PrefService* local_state, DeviceManagementService* device_management_service, scoped_refptr system_url_loader_factory) { @@ -277,7 +276,7 @@ void UserCloudPolicyManagerChromeOS::Connect( std::make_unique(profile_); } -void UserCloudPolicyManagerChromeOS::OnAccessTokenAvailable( +void UserCloudPolicyManagerAsh::OnAccessTokenAvailable( const std::string& access_token) { // This method should be called only once (at the beginning of the session) // for regular user. @@ -292,9 +291,8 @@ void UserCloudPolicyManagerChromeOS::OnAccessTokenAvailable( // callback after we destroy it. wildcard_login_checker_->StartWithAccessToken( access_token, - base::BindOnce( - &UserCloudPolicyManagerChromeOS::OnWildcardCheckCompleted, - base::Unretained(this), wildcard_username_)); + base::BindOnce(&UserCloudPolicyManagerAsh::OnWildcardCheckCompleted, + base::Unretained(this), wildcard_username_)); } if (service() && service()->IsInitializationComplete() && client()) { @@ -308,12 +306,12 @@ void UserCloudPolicyManagerChromeOS::OnAccessTokenAvailable( } } -bool UserCloudPolicyManagerChromeOS::RequiresOAuthTokenForChildUser() const { +bool UserCloudPolicyManagerAsh::RequiresOAuthTokenForChildUser() const { return IsChildUser(account_id_) && base::FeatureList::IsEnabled(features::kDMServerOAuthForChildUser); } -void UserCloudPolicyManagerChromeOS::OnWildcardCheckCompleted( +void UserCloudPolicyManagerAsh::OnWildcardCheckCompleted( const std::string& username, WildcardLoginChecker::Result result) { if (result == WildcardLoginChecker::RESULT_BLOCKED) { @@ -331,23 +329,23 @@ void UserCloudPolicyManagerChromeOS::OnWildcardCheckCompleted( } } -void UserCloudPolicyManagerChromeOS::EnableWildcardLoginCheck( +void UserCloudPolicyManagerAsh::EnableWildcardLoginCheck( const std::string& username) { DCHECK(access_token_.empty()); wildcard_username_ = username; } ArcAppInstallEventLogUploader* -UserCloudPolicyManagerChromeOS::GetAppInstallEventLogUploader() { +UserCloudPolicyManagerAsh::GetAppInstallEventLogUploader() { return app_install_event_log_uploader_.get(); } ExtensionInstallEventLogUploader* -UserCloudPolicyManagerChromeOS::GetExtensionInstallEventLogUploader() { +UserCloudPolicyManagerAsh::GetExtensionInstallEventLogUploader() { return extension_install_event_log_uploader_.get(); } -void UserCloudPolicyManagerChromeOS::Shutdown() { +void UserCloudPolicyManagerAsh::Shutdown() { observed_profile_manager_.Reset(); app_install_event_log_uploader_.reset(); extension_install_event_log_uploader_.reset(); @@ -361,7 +359,7 @@ void UserCloudPolicyManagerChromeOS::Shutdown() { CloudPolicyManager::Shutdown(); } -bool UserCloudPolicyManagerChromeOS::IsInitializationComplete( +bool UserCloudPolicyManagerAsh::IsInitializationComplete( PolicyDomain domain) const { if (!CloudPolicyManager::IsInitializationComplete(domain)) return false; @@ -370,8 +368,7 @@ bool UserCloudPolicyManagerChromeOS::IsInitializationComplete( return true; } -void UserCloudPolicyManagerChromeOS:: - OnCloudPolicyServiceInitializationCompleted() { +void UserCloudPolicyManagerAsh::OnCloudPolicyServiceInitializationCompleted() { service()->RemoveObserver(this); time_init_completed_ = base::Time::Now(); @@ -415,13 +412,12 @@ void UserCloudPolicyManagerChromeOS:: StartReportSchedulerIfReady(true /* enable_delayed_creation */); } -void UserCloudPolicyManagerChromeOS::OnPolicyFetched( - CloudPolicyClient* client) { +void UserCloudPolicyManagerAsh::OnPolicyFetched(CloudPolicyClient* client) { // No action required. If we're blocked on a policy fetch, we'll learn about // completion of it through OnInitialPolicyFetchComplete(). } -void UserCloudPolicyManagerChromeOS::OnRegistrationStateChanged( +void UserCloudPolicyManagerAsh::OnRegistrationStateChanged( CloudPolicyClient* cloud_policy_client) { DCHECK_EQ(client(), cloud_policy_client); @@ -455,7 +451,7 @@ void UserCloudPolicyManagerChromeOS::OnRegistrationStateChanged( // If we're blocked on the policy fetch, now is a good time to issue it. if (client()->is_registered()) { service()->RefreshPolicy(base::BindOnce( - &UserCloudPolicyManagerChromeOS::OnInitialPolicyFetchComplete, + &UserCloudPolicyManagerAsh::OnInitialPolicyFetchComplete, base::Unretained(this))); } else { // If the client has switched to not registered, we bail out as this @@ -465,7 +461,7 @@ void UserCloudPolicyManagerChromeOS::OnRegistrationStateChanged( } } -void UserCloudPolicyManagerChromeOS::OnClientError( +void UserCloudPolicyManagerAsh::OnClientError( CloudPolicyClient* cloud_policy_client) { DCHECK_EQ(client(), cloud_policy_client); if (waiting_for_policy_fetch_) { @@ -500,12 +496,12 @@ void UserCloudPolicyManagerChromeOS::OnClientError( } } -void UserCloudPolicyManagerChromeOS::OnComponentCloudPolicyUpdated() { +void UserCloudPolicyManagerAsh::OnComponentCloudPolicyUpdated() { CloudPolicyManager::OnComponentCloudPolicyUpdated(); StartRefreshSchedulerIfReady(); } -void UserCloudPolicyManagerChromeOS::OnUserProfileLoaded( +void UserCloudPolicyManagerAsh::OnUserProfileLoaded( const AccountId& account_id) { if (!user_manager::UserManager::Get()) return; @@ -521,7 +517,7 @@ void UserCloudPolicyManagerChromeOS::OnUserProfileLoaded( StartReportSchedulerIfReady(false /* enable_delayed_creation */); } -void UserCloudPolicyManagerChromeOS::OnStoreLoaded( +void UserCloudPolicyManagerAsh::OnStoreLoaded( CloudPolicyStore* cloud_policy_store) { CloudPolicyManager::OnStoreLoaded(cloud_policy_store); @@ -546,7 +542,7 @@ void UserCloudPolicyManagerChromeOS::OnStoreLoaded( } } -void UserCloudPolicyManagerChromeOS::SetPolicyRequired(bool policy_required) { +void UserCloudPolicyManagerAsh::SetPolicyRequired(bool policy_required) { auto* user_manager = ash::ChromeUserManager::Get(); user_manager::known_user::SetProfileRequiresPolicy( account_id_, @@ -572,7 +568,7 @@ void UserCloudPolicyManagerChromeOS::SetPolicyRequired(bool policy_required) { } } -void UserCloudPolicyManagerChromeOS::GetChromePolicy(PolicyMap* policy_map) { +void UserCloudPolicyManagerAsh::GetChromePolicy(PolicyMap* policy_map) { CloudPolicyManager::GetChromePolicy(policy_map); // If the store has a verified policy blob received from the server then apply @@ -588,7 +584,7 @@ void UserCloudPolicyManagerChromeOS::GetChromePolicy(PolicyMap* policy_map) { SetEnterpriseUsersDefaults(policy_map); } -void UserCloudPolicyManagerChromeOS::FetchPolicyOAuthToken() { +void UserCloudPolicyManagerAsh::FetchPolicyOAuthToken() { // By-pass token fetching for test. if (base::CommandLine::ForCurrentProcess()->HasSwitch( chromeos::switches::kDisableGaiaServices)) { @@ -618,9 +614,8 @@ void UserCloudPolicyManagerChromeOS::FetchPolicyOAuthToken() { PolicyOAuth2TokenFetcher::CreateInstance(kOAuthConsumerName); token_fetcher_->StartWithRefreshToken( refresh_token, system_url_loader_factory, - base::BindOnce( - &UserCloudPolicyManagerChromeOS::OnOAuth2PolicyTokenFetched, - base::Unretained(this))); + base::BindOnce(&UserCloudPolicyManagerAsh::OnOAuth2PolicyTokenFetched, + base::Unretained(this))); return; } @@ -637,7 +632,7 @@ void UserCloudPolicyManagerChromeOS::FetchPolicyOAuthToken() { GoogleServiceAuthError(GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); } -void UserCloudPolicyManagerChromeOS::OnOAuth2PolicyTokenFetched( +void UserCloudPolicyManagerAsh::OnOAuth2PolicyTokenFetched( const std::string& policy_token, const GoogleServiceAuthError& error) { DCHECK(!client()->is_registered()); @@ -681,8 +676,7 @@ void UserCloudPolicyManagerChromeOS::OnOAuth2PolicyTokenFetched( token_fetcher_.reset(); } -void UserCloudPolicyManagerChromeOS::OnInitialPolicyFetchComplete( - bool success) { +void UserCloudPolicyManagerAsh::OnInitialPolicyFetchComplete(bool success) { const base::Time now = base::Time::Now(); UMA_HISTOGRAM_MEDIUM_TIMES(kUMAInitialFetchDelayPolicyFetch, now - time_client_registered_); @@ -696,14 +690,14 @@ void UserCloudPolicyManagerChromeOS::OnInitialPolicyFetchComplete( ", store status: " + base::NumberToString(store()->status())); } -void UserCloudPolicyManagerChromeOS::OnPolicyRefreshTimeout() { +void UserCloudPolicyManagerAsh::OnPolicyRefreshTimeout() { DCHECK(waiting_for_policy_fetch_); LOG(WARNING) << "Timed out while waiting for the policy refresh. " << "The session will start with the cached policy."; CancelWaitForPolicyFetch(false, "policy refresh timeout"); } -void UserCloudPolicyManagerChromeOS::CancelWaitForPolicyFetch( +void UserCloudPolicyManagerAsh::CancelWaitForPolicyFetch( bool success, const std::string& failure_reason) { if (!waiting_for_policy_fetch_) @@ -735,7 +729,7 @@ void UserCloudPolicyManagerChromeOS::CancelWaitForPolicyFetch( StartRefreshSchedulerIfReady(); } -void UserCloudPolicyManagerChromeOS::StartRefreshSchedulerIfReady() { +void UserCloudPolicyManagerAsh::StartRefreshSchedulerIfReady() { if (core()->refresh_scheduler()) return; // Already started. @@ -763,7 +757,7 @@ void UserCloudPolicyManagerChromeOS::StartRefreshSchedulerIfReady() { policy_prefs::kUserPolicyRefreshRate); } -void UserCloudPolicyManagerChromeOS::StartReportSchedulerIfReady( +void UserCloudPolicyManagerAsh::StartReportSchedulerIfReady( bool enable_delayed_creation) { if (!client() || !client()->is_registered()) return; @@ -801,7 +795,7 @@ void UserCloudPolicyManagerChromeOS::StartReportSchedulerIfReady( report_scheduler_->OnDMTokenUpdated(); } -void UserCloudPolicyManagerChromeOS::OnProfileAdded(Profile* profile) { +void UserCloudPolicyManagerAsh::OnProfileAdded(Profile* profile) { if (profile != profile_) return; @@ -825,21 +819,21 @@ void UserCloudPolicyManagerChromeOS::OnProfileAdded(Profile* profile) { policy::kPolicyFCMInvalidationSenderID)); shutdown_subscription_ = - UserCloudPolicyManagerChromeOSNotifierFactory::GetInstance() + UserCloudPolicyManagerAshNotifierFactory::GetInstance() ->Get(profile_) - ->Subscribe(base::BindRepeating( - &UserCloudPolicyManagerChromeOS::ProfileShutdown, - base::Unretained(this))); + ->Subscribe( + base::BindRepeating(&UserCloudPolicyManagerAsh::ProfileShutdown, + base::Unretained(this))); } -void UserCloudPolicyManagerChromeOS::ProfileShutdown() { +void UserCloudPolicyManagerAsh::ProfileShutdown() { // Unregister the RemoteCommandsInvalidatorImpl from the InvalidatorRegistrar. invalidator_->Shutdown(); invalidator_.reset(); shutdown_subscription_ = {}; } -void UserCloudPolicyManagerChromeOS::SetUserContextRefreshTokenForTests( +void UserCloudPolicyManagerAsh::SetUserContextRefreshTokenForTests( const std::string& refresh_token) { DCHECK(!refresh_token.empty()); DCHECK(!user_context_refresh_token_for_tests_); @@ -847,7 +841,7 @@ void UserCloudPolicyManagerChromeOS::SetUserContextRefreshTokenForTests( } enterprise_reporting::ReportScheduler* -UserCloudPolicyManagerChromeOS::GetReportSchedulerForTesting() { +UserCloudPolicyManagerAsh::GetReportSchedulerForTesting() { return report_scheduler_.get(); } diff --git a/chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h b/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h similarity index 98% rename from chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h rename to chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h index fa3f8859aa4a9..a6b11d682b25b 100644 --- a/chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h +++ b/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_ASH_POLICY_CORE_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ -#define CHROME_BROWSER_ASH_POLICY_CORE_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ +#ifndef CHROME_BROWSER_ASH_POLICY_CORE_USER_CLOUD_POLICY_MANAGER_ASH_H_ +#define CHROME_BROWSER_ASH_POLICY_CORE_USER_CLOUD_POLICY_MANAGER_ASH_H_ #include #include @@ -54,8 +54,8 @@ class ExtensionInstallEventLogUploader; class PolicyOAuth2TokenFetcher; class RemoteCommandsInvalidator; -// Implements logic for initializing user policy on Chrome OS. -class UserCloudPolicyManagerChromeOS +// Implements logic for initializing user policy on Ash. +class UserCloudPolicyManagerAsh : public CloudPolicyManager, public CloudPolicyClient::Observer, public CloudPolicyService::Observer, @@ -101,7 +101,7 @@ class UserCloudPolicyManagerChromeOS // // |account_id| is the AccountId associated with the user's session. // |task_runner| is the runner for policy refresh tasks. - UserCloudPolicyManagerChromeOS( + UserCloudPolicyManagerAsh( Profile* profile, std::unique_ptr store, std::unique_ptr external_data_manager, @@ -111,7 +111,7 @@ class UserCloudPolicyManagerChromeOS base::OnceClosure fatal_error_callback, const AccountId& account_id, const scoped_refptr& task_runner); - ~UserCloudPolicyManagerChromeOS() override; + ~UserCloudPolicyManagerAsh() override; // Initializes the cloud connection. |local_state| and // |device_management_service| must stay valid until this object is deleted. @@ -343,9 +343,9 @@ class UserCloudPolicyManagerChromeOS // to load policy with error |DM_STATUS_SERVICE_DEVICE_NOT_FOUND|. bool is_in_reregistration_state_ = false; - DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOS); + DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerAsh); }; } // namespace policy -#endif // CHROME_BROWSER_ASH_POLICY_CORE_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ +#endif // CHROME_BROWSER_ASH_POLICY_CORE_USER_CLOUD_POLICY_MANAGER_ASH_H_ diff --git a/chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos_browsertest.cc b/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash_browsertest.cc similarity index 100% rename from chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos_browsertest.cc rename to chrome/browser/ash/policy/core/user_cloud_policy_manager_ash_browsertest.cc diff --git a/chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos_unittest.cc b/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash_unittest.cc similarity index 94% rename from chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos_unittest.cc rename to chrome/browser/ash/policy/core/user_cloud_policy_manager_ash_unittest.cc index 945bfb54010bd..4a32cbfe3a68f 100644 --- a/chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos_unittest.cc +++ b/chrome/browser/ash/policy/core/user_cloud_policy_manager_ash_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include #include @@ -102,7 +102,7 @@ void SendJobOKNowForBinding( namespace policy { -using PolicyEnforcement = UserCloudPolicyManagerChromeOS::PolicyEnforcement; +using PolicyEnforcement = UserCloudPolicyManagerAsh::PolicyEnforcement; constexpr char kEmail[] = "user@example.com"; constexpr char kTestGaiaId[] = "12345"; @@ -119,9 +119,9 @@ constexpr char kOAuthToken[] = "5678"; constexpr char kDMToken[] = "dmtoken123"; constexpr char kDeviceId[] = "id987"; -// UserCloudPolicyManagerChromeOS test class that can be used with different +// UserCloudPolicyManagerAsh test class that can be used with different // feature flags. -class UserCloudPolicyManagerChromeOSTest +class UserCloudPolicyManagerAshTest : public testing::TestWithParam> { public: // Note: This method has to be public, so that a pointer to it may be obtained @@ -139,7 +139,7 @@ class UserCloudPolicyManagerChromeOSTest } protected: - UserCloudPolicyManagerChromeOSTest() + UserCloudPolicyManagerAshTest() : store_(nullptr), external_data_manager_(nullptr), task_runner_(base::MakeRefCounted()), @@ -379,7 +379,7 @@ class UserCloudPolicyManagerChromeOSTest MockCloudExternalDataManager* external_data_manager_; // Not owned. scoped_refptr task_runner_; SchemaRegistry schema_registry_; - std::unique_ptr manager_; + std::unique_ptr manager_; std::unique_ptr token_forwarder_; // Required by ProfileHelper to get the signin Profile context. @@ -403,14 +403,13 @@ class UserCloudPolicyManagerChromeOSTest external_data_manager_ = new MockCloudExternalDataManager; external_data_manager_->SetPolicyStore(store_); const user_manager::User* active_user = user_manager_->GetActiveUser(); - manager_ = std::make_unique( + manager_ = std::make_unique( chromeos::ProfileHelper::Get()->GetProfileByUser(active_user), std::move(store), base::WrapUnique(external_data_manager_), base::FilePath(), enforcement_type, fetch_timeout, - base::BindOnce( - &UserCloudPolicyManagerChromeOSTest::OnFatalErrorEncountered, - base::Unretained(this)), + base::BindOnce(&UserCloudPolicyManagerAshTest::OnFatalErrorEncountered, + base::Unretained(this)), active_user->GetAccountId(), task_runner_); manager_->AddObserver(&observer_); manager_->SetSignInURLLoaderFactoryForTests( @@ -426,7 +425,7 @@ class UserCloudPolicyManagerChromeOSTest /*system_url_loader_factory=*/nullptr); // Create the UserCloudPolicyTokenForwarder, which fetches the access // token using the IdentityManager and forwards it to the - // UserCloudPolicyManagerChromeOS. This service is automatically created + // UserCloudPolicyManagerAsh. This service is automatically created // for regular Profiles but not for testing Profiles. signin::IdentityManager* identity_manager = IdentityManagerFactory::GetForProfile(profile_); @@ -470,19 +469,19 @@ class UserCloudPolicyManagerChromeOSTest base::test::ScopedFeatureList scoped_feature_list_; - DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOSTest); + DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerAshTest); }; // TODO(agawronska): Remove test instantiation with kDMServerOAuthForChildUser // once it is enabled by default. INSTANTIATE_TEST_SUITE_P( /* no prefix */, - UserCloudPolicyManagerChromeOSTest, + UserCloudPolicyManagerAshTest, testing::Values(std::vector(), std::vector{ features::kDMServerOAuthForChildUser})); -TEST_P(UserCloudPolicyManagerChromeOSTest, BlockingFirstFetch) { +TEST_P(UserCloudPolicyManagerAshTest, BlockingFirstFetch) { // Tests the initialization of a manager whose Profile is waiting for the // initial fetch, when the policy cache is empty. ASSERT_NO_FATAL_FAILURE(MakeManagerWithEmptyStore( @@ -507,7 +506,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, BlockingFirstFetch) { false); } -TEST_P(UserCloudPolicyManagerChromeOSTest, BlockingRefreshFetch) { +TEST_P(UserCloudPolicyManagerAshTest, BlockingRefreshFetch) { // Tests the initialization of a manager whose Profile is waiting for the // refresh fetch, when a previously cached policy and DMToken already exist. ASSERT_NO_FATAL_FAILURE(MakeManagerWithEmptyStore( @@ -521,7 +520,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, BlockingRefreshFetch) { false); } -TEST_P(UserCloudPolicyManagerChromeOSTest, SynchronousLoadWithEmptyStore) { +TEST_P(UserCloudPolicyManagerAshTest, SynchronousLoadWithEmptyStore) { // Tests the initialization of a manager who requires policy, but who // has no policy stored on disk. The manager should abort and exit the // session. @@ -536,7 +535,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, SynchronousLoadWithEmptyStore) { EXPECT_TRUE(manager_->core()->service()->IsInitializationComplete()); } -TEST_P(UserCloudPolicyManagerChromeOSTest, BlockingFetchStoreError) { +TEST_P(UserCloudPolicyManagerAshTest, BlockingFetchStoreError) { // Tests the initialization of a manager whose Profile is waiting for the // initial fetch, when the initial store load fails. ASSERT_NO_FATAL_FAILURE(MakeManagerWithEmptyStore( @@ -561,7 +560,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, BlockingFetchStoreError) { false); } -TEST_P(UserCloudPolicyManagerChromeOSTest, BlockingFetchOAuthError) { +TEST_P(UserCloudPolicyManagerAshTest, BlockingFetchOAuthError) { // Tests the initialization of a manager whose Profile is waiting for the // initial fetch, when the OAuth2 token fetch fails. This should result in a // fatal error. @@ -592,7 +591,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, BlockingFetchOAuthError) { Mock::VerifyAndClearExpectations(&observer_); } -TEST_P(UserCloudPolicyManagerChromeOSTest, BlockingFetchRegisterError) { +TEST_P(UserCloudPolicyManagerAshTest, BlockingFetchRegisterError) { // Tests the initialization of a manager whose Profile is waiting for the // initial fetch, when the device management registration fails. fatal_error_expected_ = true; @@ -622,7 +621,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, BlockingFetchRegisterError) { Mock::VerifyAndClearExpectations(&observer_); } -TEST_P(UserCloudPolicyManagerChromeOSTest, BlockingFetchPolicyFetchError) { +TEST_P(UserCloudPolicyManagerAshTest, BlockingFetchPolicyFetchError) { // Tests the initialization of a manager whose Profile is waiting for the // initial fetch, when the policy fetch request fails. fatal_error_expected_ = true; @@ -672,7 +671,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, BlockingFetchPolicyFetchError) { EXPECT_TRUE(PolicyBundle().Equals(manager_->policies())); } -TEST_P(UserCloudPolicyManagerChromeOSTest, +TEST_P(UserCloudPolicyManagerAshTest, NoCacheButPolicyExpectedRegistrationError) { // Tests the case where we have no local policy and the policy fetch // request fails, but we think we should have policy - this covers the @@ -703,7 +702,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, EXPECT_FALSE(manager_->core()->client()->is_registered()); } -TEST_P(UserCloudPolicyManagerChromeOSTest, NoCacheButPolicyExpectedFetchError) { +TEST_P(UserCloudPolicyManagerAshTest, NoCacheButPolicyExpectedFetchError) { // Tests the case where we have no local policy and the policy fetch // request fails, but we think we should have policy - this covers the // situation where local policy cache is lost due to disk corruption and @@ -754,7 +753,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, NoCacheButPolicyExpectedFetchError) { EXPECT_TRUE(PolicyBundle().Equals(manager_->policies())); } -TEST_P(UserCloudPolicyManagerChromeOSTest, NonBlockingFirstFetch) { +TEST_P(UserCloudPolicyManagerAshTest, NonBlockingFirstFetch) { // Tests the first policy fetch request by a Profile that isn't managed. ASSERT_NO_FATAL_FAILURE(MakeManagerWithEmptyStore( base::TimeDelta(), PolicyEnforcement::kPolicyOptional)); @@ -792,7 +791,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, NonBlockingFirstFetch) { false); } -TEST_P(UserCloudPolicyManagerChromeOSTest, BlockingRefreshFetchWithTimeout) { +TEST_P(UserCloudPolicyManagerAshTest, BlockingRefreshFetchWithTimeout) { // Tests the case where a profile has policy, but the refresh policy fetch // fails (times out) - ensures that we don't mark the profile as initialized // until after the timeout. @@ -814,7 +813,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, BlockingRefreshFetchWithTimeout) { Mock::VerifyAndClearExpectations(&observer_); } -TEST_P(UserCloudPolicyManagerChromeOSTest, SynchronousLoadWithPreloadedStore) { +TEST_P(UserCloudPolicyManagerAshTest, SynchronousLoadWithPreloadedStore) { // Tests the initialization of a manager with non-blocking initial policy // fetch, when a previously cached policy and DMToken are already loaded // before the manager is constructed (this simulates synchronously @@ -826,7 +825,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, SynchronousLoadWithPreloadedStore) { EXPECT_TRUE(manager_->policies().Equals(expected_bundle_)); } -TEST_P(UserCloudPolicyManagerChromeOSTest, TestLifetimeReportingRegular) { +TEST_P(UserCloudPolicyManagerAshTest, TestLifetimeReportingRegular) { ASSERT_NO_FATAL_FAILURE(MakeManagerWithEmptyStore( base::TimeDelta::FromSeconds(1000), PolicyEnforcement::kPolicyRequired)); @@ -843,7 +842,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, TestLifetimeReportingRegular) { register_request.register_request().lifetime()); } -TEST_P(UserCloudPolicyManagerChromeOSTest, TestLifetimeReportingEphemeralUser) { +TEST_P(UserCloudPolicyManagerAshTest, TestLifetimeReportingEphemeralUser) { user_manager_->set_current_user_ephemeral(true); ASSERT_NO_FATAL_FAILURE(MakeManagerWithEmptyStore( @@ -863,13 +862,13 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, TestLifetimeReportingEphemeralUser) { register_request.register_request().lifetime()); } -TEST_P(UserCloudPolicyManagerChromeOSTest, TestHasAppInstallEventLogUploader) { +TEST_P(UserCloudPolicyManagerAshTest, TestHasAppInstallEventLogUploader) { ASSERT_NO_FATAL_FAILURE(MakeManagerWithEmptyStore( base::TimeDelta(), PolicyEnforcement::kPolicyRequired)); EXPECT_TRUE(manager_->GetAppInstallEventLogUploader()); } -TEST_P(UserCloudPolicyManagerChromeOSTest, TestReportSchedulerCreation) { +TEST_P(UserCloudPolicyManagerAshTest, TestReportSchedulerCreation) { // Open policy and feature flag to enable report scheduler. g_browser_process->local_state()->SetBoolean( enterprise_reporting::kCloudReportingEnabled, true); @@ -879,14 +878,14 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, TestReportSchedulerCreation) { user_manager_->LoginUser(account_id); ASSERT_TRUE(user_manager_->GetPrimaryUser()); - // Before UserCloudPolicyManagerChromeOS is initialized, report scheduler is + // Before UserCloudPolicyManagerAsh is initialized, report scheduler is // not existing. MakeManagerWithPreloadedStore(base::TimeDelta()); EXPECT_FALSE(manager_->core()->service()); EXPECT_FALSE(manager_->core()->client()); EXPECT_FALSE(manager_->GetReportSchedulerForTesting()); - // After UserCloudPolicyManagerChromeOS is initialized, report scheduler is + // After UserCloudPolicyManagerAsh is initialized, report scheduler is // created with valid |client_id| and |dm token|. InitAndConnectManager(); EXPECT_TRUE(manager_->core()->service()->IsInitializationComplete()); @@ -900,7 +899,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, TestReportSchedulerCreation) { ->IsNextReportScheduledForTesting()); } -TEST_P(UserCloudPolicyManagerChromeOSTest, TestReportSchedulerDelayedCreation) { +TEST_P(UserCloudPolicyManagerAshTest, TestReportSchedulerDelayedCreation) { // Open policy and feature flag to enable report scheduler. g_browser_process->local_state()->SetBoolean( enterprise_reporting::kCloudReportingEnabled, true); @@ -912,12 +911,12 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, TestReportSchedulerDelayedCreation) { ASSERT_TRUE(user_manager_->GetPrimaryUser()); ASSERT_FALSE(user_manager_->GetPrimaryUser()->is_profile_created()); - // Before UserCloudPolicyManagerChromeOS is initialized, report scheduler is + // Before UserCloudPolicyManagerAsh is initialized, report scheduler is // not existing. MakeManagerWithPreloadedStore(base::TimeDelta()); EXPECT_FALSE(manager_->GetReportSchedulerForTesting()); - // After UserCloudPolicyManagerChromeOS is initialized, report scheduler is + // After UserCloudPolicyManagerAsh is initialized, report scheduler is // still not created because the profile of primary user hasn't been created. session_manager::SessionManager session_manager; InitAndConnectManager(); @@ -943,7 +942,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, TestReportSchedulerDelayedCreation) { ->IsNextReportScheduledForTesting()); } -TEST_P(UserCloudPolicyManagerChromeOSTest, TestSkipReportSchedulerCreation) { +TEST_P(UserCloudPolicyManagerAshTest, TestSkipReportSchedulerCreation) { // Open policy and feature flag to enable report scheduler. g_browser_process->local_state()->SetBoolean( enterprise_reporting::kCloudReportingEnabled, true); @@ -951,19 +950,18 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, TestSkipReportSchedulerCreation) { // No primary user is specified. ASSERT_FALSE(user_manager_->GetPrimaryUser()); - // Before UserCloudPolicyManagerChromeOS is initialized, report scheduler is + // Before UserCloudPolicyManagerAsh is initialized, report scheduler is // not existing. MakeManagerWithPreloadedStore(base::TimeDelta()); EXPECT_FALSE(manager_->GetReportSchedulerForTesting()); - // After UserCloudPolicyManagerChromeOS is initialized, report scheduler is + // After UserCloudPolicyManagerAsh is initialized, report scheduler is // still not existing because there is no valid primary user. InitAndConnectManager(); EXPECT_FALSE(manager_->GetReportSchedulerForTesting()); } -TEST_P(UserCloudPolicyManagerChromeOSTest, - EnterpriseReportingInChromeOSDisabled) { +TEST_P(UserCloudPolicyManagerAshTest, EnterpriseReportingInChromeOSDisabled) { // Open policy but close the feature flag for Chrome OS to disable report // scheduler. g_browser_process->local_state()->SetBoolean( @@ -975,7 +973,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, EXPECT_FALSE(manager_->GetReportSchedulerForTesting()); } -TEST_P(UserCloudPolicyManagerChromeOSTest, Reregistration) { +TEST_P(UserCloudPolicyManagerAshTest, Reregistration) { // Tests the initialization of a manager whose Profile is waiting for the // initial fetch, when the policy cache is empty. fatal_error_expected_ = true; @@ -1067,7 +1065,7 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, Reregistration) { histogram_tester.ExpectTotalCount(kUMAReregistrationResult, 2); } -TEST_P(UserCloudPolicyManagerChromeOSTest, ReregistrationFails) { +TEST_P(UserCloudPolicyManagerAshTest, ReregistrationFails) { // Tests the initialization of a manager whose Profile is waiting for the // initial fetch, when the policy cache is empty. fatal_error_expected_ = true; @@ -1146,9 +1144,9 @@ TEST_P(UserCloudPolicyManagerChromeOSTest, ReregistrationFails) { histogram_tester.ExpectTotalCount(kUMAReregistrationResult, 2); } -// Tests UserCloudPolicyManagerChromeOS for child user. -class UserCloudPolicyManagerChromeOSChildTest - : public UserCloudPolicyManagerChromeOSTest { +// Tests UserCloudPolicyManagerAsh for child user. +class UserCloudPolicyManagerAshChildTest + : public UserCloudPolicyManagerAshTest { public: // Issues OAuthToken for device management scopes. void IssueOAuth2AccessToken(base::TimeDelta token_lifetime) { @@ -1162,14 +1160,14 @@ class UserCloudPolicyManagerChromeOSChildTest } protected: - UserCloudPolicyManagerChromeOSChildTest() { + UserCloudPolicyManagerAshChildTest() { user_type_ = user_manager::UserType::USER_TYPE_CHILD; } - ~UserCloudPolicyManagerChromeOSChildTest() override = default; + ~UserCloudPolicyManagerAshChildTest() override = default; - // UserCloudPolicyManagerChromeOSTest: + // UserCloudPolicyManagerAshTest: void SetUp() override { - UserCloudPolicyManagerChromeOSTest::SetUp(); + UserCloudPolicyManagerAshTest::SetUp(); identity_test_env()->MakePrimaryAccountAvailable( kEmail, signin::ConsentLevel::kSignin); } @@ -1183,18 +1181,18 @@ class UserCloudPolicyManagerChromeOSChildTest } private: - DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOSChildTest); + DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerAshChildTest); }; // TODO(agawronska): Remove test instantiation with kDMServerOAuthForChildUser // once it is enabled by default. INSTANTIATE_TEST_SUITE_P( /* no prefix */, - UserCloudPolicyManagerChromeOSChildTest, + UserCloudPolicyManagerAshChildTest, testing::Values(std::vector{ features::kDMServerOAuthForChildUser})); -TEST_P(UserCloudPolicyManagerChromeOSChildTest, RefreshFetchDoesNotBlock) { +TEST_P(UserCloudPolicyManagerAshChildTest, RefreshFetchDoesNotBlock) { // Tests the profile initialization is not blocked on policy refresh. ASSERT_NO_FATAL_FAILURE(MakeManagerWithEmptyStore( base::TimeDelta::FromSeconds(0), PolicyEnforcement::kPolicyRequired)); @@ -1204,7 +1202,7 @@ TEST_P(UserCloudPolicyManagerChromeOSChildTest, RefreshFetchDoesNotBlock) { EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); } -TEST_P(UserCloudPolicyManagerChromeOSChildTest, RefreshSchedulerStart) { +TEST_P(UserCloudPolicyManagerAshChildTest, RefreshSchedulerStart) { // Tests that refresh scheduler is started after OAuth token is available. ASSERT_NO_FATAL_FAILURE(MakeManagerWithEmptyStore( base::TimeDelta::FromSeconds(0), PolicyEnforcement::kPolicyRequired)); @@ -1216,7 +1214,7 @@ TEST_P(UserCloudPolicyManagerChromeOSChildTest, RefreshSchedulerStart) { EXPECT_TRUE(manager_->core()->refresh_scheduler()); } -TEST_P(UserCloudPolicyManagerChromeOSChildTest, RefreshScheduler) { +TEST_P(UserCloudPolicyManagerAshChildTest, RefreshScheduler) { // Tests that refresh schedule isn't affected by periodic OAuth token updates. ASSERT_NO_FATAL_FAILURE(MakeManagerWithEmptyStore( base::TimeDelta::FromSeconds(0), PolicyEnforcement::kPolicyRequired)); diff --git a/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder.cc b/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder.cc index 9b0f0362e4420..16101d8da0d98 100644 --- a/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder.cc +++ b/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder.cc @@ -12,7 +12,7 @@ #include "base/time/default_clock.h" #include "base/time/time.h" #include "base/timer/timer.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/chrome_notification_types.h" #include "components/policy/core/common/cloud/cloud_policy_core.h" #include "components/signin/public/identity_manager/consent_level.h" @@ -39,7 +39,7 @@ const net::BackoffEntry::Policy constexpr char UserCloudPolicyTokenForwarder::kUMAChildUserOAuthTokenError[]; UserCloudPolicyTokenForwarder::UserCloudPolicyTokenForwarder( - UserCloudPolicyManagerChromeOS* manager, + UserCloudPolicyManagerAsh* manager, signin::IdentityManager* identity_manager) : manager_(manager), identity_manager_(identity_manager), @@ -150,7 +150,7 @@ void UserCloudPolicyTokenForwarder::OnAccessTokenFetchCompleted( GoogleServiceAuthError::NUM_STATES); // Schedule fetching fresh OAuth token after current token expiration, if - // UserCloudPolicyManagerChromeOS needs valid OAuth token all the time. + // UserCloudPolicyManagerAsh needs valid OAuth token all the time. access_token_fetcher_.reset(); // Retry after delay, if token request fails or the new token is expired. const base::Time now = clock_->Now(); diff --git a/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder.h b/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder.h index c4a64042ecaff..15a67b8ef15c8 100644 --- a/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder.h +++ b/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder.h @@ -31,13 +31,13 @@ class PrimaryAccountAccessTokenFetcher; namespace policy { -class UserCloudPolicyManagerChromeOS; +class UserCloudPolicyManagerAsh; // A PKS that observes an IdentityManager and mints the policy access -// token for the UserCloudPolicyManagerChromeOS. First token is fetched when the +// token for the UserCloudPolicyManagerAsh. First token is fetched when the // token service becomes ready. After that if needed a new token is fetched when // the previous one is expected to expire. This service decouples the -// UserCloudPolicyManagerChromeOS from depending directly on the +// UserCloudPolicyManagerAsh from depending directly on the // IdentityManager, since it is initialized much earlier. class UserCloudPolicyTokenForwarder : public KeyedService, public CloudPolicyService::Observer { @@ -53,7 +53,7 @@ class UserCloudPolicyTokenForwarder : public KeyedService, // The factory of this PKS depends on the factories of these two arguments, // so this object will be Shutdown() first and these pointers can be used // until that point. - UserCloudPolicyTokenForwarder(UserCloudPolicyManagerChromeOS* manager, + UserCloudPolicyTokenForwarder(UserCloudPolicyManagerAsh* manager, signin::IdentityManager* identity_manager); ~UserCloudPolicyTokenForwarder() override; @@ -84,7 +84,7 @@ class UserCloudPolicyTokenForwarder : public KeyedService, void OnAccessTokenFetchCompleted(GoogleServiceAuthError error, signin::AccessTokenInfo token_info); - UserCloudPolicyManagerChromeOS* manager_; + UserCloudPolicyManagerAsh* manager_; signin::IdentityManager* identity_manager_; std::unique_ptr access_token_fetcher_; diff --git a/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_factory.cc b/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_factory.cc index 988ec32891978..fa148cc43d1a5 100644 --- a/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_factory.cc +++ b/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_factory.cc @@ -4,7 +4,7 @@ #include "chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_factory.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/identity_manager_factory.h" @@ -31,8 +31,7 @@ UserCloudPolicyTokenForwarderFactory::~UserCloudPolicyTokenForwarderFactory() {} KeyedService* UserCloudPolicyTokenForwarderFactory::BuildServiceInstanceFor( content::BrowserContext* context) const { Profile* profile = static_cast(context); - UserCloudPolicyManagerChromeOS* manager = - profile->GetUserCloudPolicyManagerChromeOS(); + UserCloudPolicyManagerAsh* manager = profile->GetUserCloudPolicyManagerAsh(); signin::IdentityManager* identity_manager = IdentityManagerFactory::GetForProfile(profile); if (!manager || !identity_manager) diff --git a/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_unittest.cc b/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_unittest.cc index 95eb71dd2ce20..74bdd3e23f2ef 100644 --- a/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_unittest.cc +++ b/chrome/browser/ash/policy/core/user_cloud_policy_token_forwarder_unittest.cc @@ -19,7 +19,7 @@ #include "base/test/test_simple_task_runner.h" #include "base/time/time.h" #include "chrome/browser/ash/login/users/fake_chrome_user_manager.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/signin/identity_test_environment_profile_adaptor.h" #include "chrome/common/chrome_features.h" #include "chrome/test/base/testing_browser_process.h" @@ -59,35 +59,34 @@ constexpr base::TimeDelta kTokenLifetime = base::TimeDelta::FromMinutes(30); } // namespace -// Mock of UserCloudPolicyManagerChromeOS used to verify calls from +// Mock of UserCloudPolicyManagerAsh used to verify calls from // UserCloudPolicyTokenForwarder. -class MockUserCloudPolicyManagerChromeOS - : public UserCloudPolicyManagerChromeOS { +class MockUserCloudPolicyManagerAsh : public UserCloudPolicyManagerAsh { public: - MockUserCloudPolicyManagerChromeOS( + MockUserCloudPolicyManagerAsh( Profile* profile, const AccountId& account_id, const scoped_refptr& task_runner) - : UserCloudPolicyManagerChromeOS( + : UserCloudPolicyManagerAsh( profile, std::make_unique(), std::make_unique(), base::FilePath() /* component_policy_cache_path */, - UserCloudPolicyManagerChromeOS::PolicyEnforcement::kPolicyRequired, + UserCloudPolicyManagerAsh::PolicyEnforcement::kPolicyRequired, base::TimeDelta::FromMinutes(1) /* policy_refresh_timeout */, - base::BindOnce(&MockUserCloudPolicyManagerChromeOS::OnFatalError, + base::BindOnce(&MockUserCloudPolicyManagerAsh::OnFatalError, base::Unretained(this)), account_id, task_runner) {} - ~MockUserCloudPolicyManagerChromeOS() override = default; + ~MockUserCloudPolicyManagerAsh() override = default; MOCK_METHOD1(OnAccessTokenAvailable, void(const std::string&)); private: void OnFatalError() {} - DISALLOW_COPY_AND_ASSIGN(MockUserCloudPolicyManagerChromeOS); + DISALLOW_COPY_AND_ASSIGN(MockUserCloudPolicyManagerAsh); }; class UserCloudPolicyTokenForwarderTest : public testing::Test { @@ -149,7 +148,7 @@ class UserCloudPolicyTokenForwarderTest : public testing::Test { user_manager->SwitchActiveUser(account_id); ASSERT_TRUE(user_manager->GetActiveUser()); - user_policy_manager_ = std::make_unique( + user_policy_manager_ = std::make_unique( profile, account_id, mock_time_task_runner_); std::unique_ptr client = std::make_unique(); @@ -203,7 +202,7 @@ class UserCloudPolicyTokenForwarderTest : public testing::Test { base::HistogramTester histogram_tester_; - std::unique_ptr user_policy_manager_; + std::unique_ptr user_policy_manager_; scoped_refptr mock_time_task_runner_; private: diff --git a/chrome/browser/ash/policy/core/user_policy_manager_builder_chromeos.cc b/chrome/browser/ash/policy/core/user_policy_manager_builder_chromeos.cc index bcfd42abbddfc..49e3467fd8764 100644 --- a/chrome/browser/ash/policy/core/user_policy_manager_builder_chromeos.cc +++ b/chrome/browser/ash/policy/core/user_policy_manager_builder_chromeos.cc @@ -21,7 +21,7 @@ #include "base/time/time.h" #include "chrome/browser/ash/policy/active_directory/active_directory_policy_manager.h" #include "chrome/browser/ash/policy/core/browser_policy_connector_chromeos.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/policy/core/user_cloud_policy_store_ash.h" #include "chrome/browser/ash/policy/external_data/user_cloud_external_data_manager.h" #include "chrome/browser/ash/profiles/profile_helper.h" @@ -49,7 +49,7 @@ using user_manager::ProfileRequiresPolicy; namespace policy { -using PolicyEnforcement = UserCloudPolicyManagerChromeOS::PolicyEnforcement; +using PolicyEnforcement = UserCloudPolicyManagerAsh::PolicyEnforcement; namespace { // Directory under the profile directory where policy-related resources are @@ -84,12 +84,12 @@ void CreateConfigurationPolicyProvider( Profile* profile, bool force_immediate_load, scoped_refptr background_task_runner, - std::unique_ptr* - user_cloud_policy_manager_chromeos_out, + std::unique_ptr* + user_cloud_policy_manager_ash_out, std::unique_ptr* active_directory_policy_manager_out) { // Clear the two out parameters. Default return will be nullptr for both. - *user_cloud_policy_manager_chromeos_out = nullptr; + *user_cloud_policy_manager_ash_out = nullptr; *active_directory_policy_manager_out = nullptr; // Don't initialize cloud policy for the signin and the lock screen profile. @@ -107,13 +107,13 @@ void CreateConfigurationPolicyProvider( // User policy exists for enterprise accounts: // - For regular cloud-managed users (those who have a GAIA account), a - // |UserCloudPolicyManagerChromeOS| is created here. + // |UserCloudPolicyManagerAsh| is created here. // - For Active Directory managed users, an |ActiveDirectoryPolicyManager| // is created. // - For device-local accounts, policy is provided by // |DeviceLocalAccountPolicyService|. // For non-enterprise accounts only for users with type USER_TYPE_CHILD - // |UserCloudPolicyManagerChromeOS| is created here. + // |UserCloudPolicyManagerAsh| is created here. // All other user types do not have user policy. const AccountId& account_id = user->GetAccountId(); if (user->GetType() != user_manager::USER_TYPE_CHILD && @@ -211,7 +211,7 @@ void CreateConfigurationPolicyProvider( // // The only exception is if |force_immediate_load| is true, then we can't // block at all (loading from network is not allowed - only from cache). In - // this case, logic in UserCloudPolicyManagerChromeOS will exit the session + // this case, logic in UserCloudPolicyManagerAsh will exit the session // if we fail to load policy from our cache. const bool block_profile_init_on_policy_refresh = (enforcement_type != PolicyEnforcement::kPolicyOptional) && @@ -274,8 +274,8 @@ void CreateConfigurationPolicyProvider( manager->Init(profile->GetPolicySchemaRegistryService()->registry()); *active_directory_policy_manager_out = std::move(manager); } else { - std::unique_ptr manager = - std::make_unique( + std::unique_ptr manager = + std::make_unique( profile, std::move(store), std::move(external_data_manager), component_policy_cache_dir, enforcement_type, policy_refresh_timeout, @@ -295,7 +295,7 @@ void CreateConfigurationPolicyProvider( manager->Connect(g_browser_process->local_state(), device_management_service, g_browser_process->shared_url_loader_factory()); - *user_cloud_policy_manager_chromeos_out = std::move(manager); + *user_cloud_policy_manager_ash_out = std::move(manager); } } diff --git a/chrome/browser/ash/policy/core/user_policy_manager_builder_chromeos.h b/chrome/browser/ash/policy/core/user_policy_manager_builder_chromeos.h index 73375ad0d48d3..fa0948b12606d 100644 --- a/chrome/browser/ash/policy/core/user_policy_manager_builder_chromeos.h +++ b/chrome/browser/ash/policy/core/user_policy_manager_builder_chromeos.h @@ -18,17 +18,17 @@ class SequencedTaskRunner; namespace policy { class ActiveDirectoryPolicyManager; -class UserCloudPolicyManagerChromeOS; +class UserCloudPolicyManagerAsh; // Create a ConfigurationPolicyProvider for the given Profile. -// Either a UserCloudPolicyManagerChromeOS, an ActiveDirectoryPolicyManager, +// Either a UserCloudPolicyManagerAsh, an ActiveDirectoryPolicyManager, // or neither will be returned through the out parameters. void CreateConfigurationPolicyProvider( Profile* profile, bool force_immediate_load, scoped_refptr background_task_runner, - std::unique_ptr* - user_cloud_policy_manager_chromeos_out, + std::unique_ptr* + user_cloud_policy_manager_ash_out, std::unique_ptr* active_directory_policy_manager_out); diff --git a/chrome/browser/ash/policy/core/user_policy_test_helper.cc b/chrome/browser/ash/policy/core/user_policy_test_helper.cc index f1f1a70a351ef..180793d3d16ea 100644 --- a/chrome/browser/ash/policy/core/user_policy_test_helper.cc +++ b/chrome/browser/ash/policy/core/user_policy_test_helper.cc @@ -10,7 +10,7 @@ #include "base/run_loop.h" #include "base/values.h" #include "chrome/browser/ash/login/test/local_policy_test_server_mixin.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/policy/chrome_browser_policy_connector.h" #include "chrome/browser/policy/profile_policy_connector.h" @@ -45,8 +45,8 @@ void UserPolicyTestHelper::WaitForInitialPolicy(Profile* profile) { g_browser_process->browser_policy_connector(); connector->ScheduleServiceInitialization(0); - UserCloudPolicyManagerChromeOS* const policy_manager = - profile->GetUserCloudPolicyManagerChromeOS(); + UserCloudPolicyManagerAsh* const policy_manager = + profile->GetUserCloudPolicyManagerAsh(); DCHECK(!policy_manager->IsInitializationComplete(POLICY_DOMAIN_CHROME)); // Give a bogus OAuth token to the |policy_manager|. This should make its diff --git a/chrome/browser/ash/policy/external_data/user_cloud_external_data_manager_browsertest.cc b/chrome/browser/ash/policy/external_data/user_cloud_external_data_manager_browsertest.cc index 09810998e38b3..86157fe7a810d 100644 --- a/chrome/browser/ash/policy/external_data/user_cloud_external_data_manager_browsertest.cc +++ b/chrome/browser/ash/policy/external_data/user_cloud_external_data_manager_browsertest.cc @@ -14,7 +14,7 @@ #include "base/run_loop.h" #include "base/values.h" #include "build/build_config.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/policy/core/user_policy_test_helper.h" #include "chrome/browser/ash/policy/external_data/cloud_external_data_manager_base.h" #include "chrome/browser/ash/policy/external_data/cloud_external_data_manager_base_test_util.h" @@ -88,8 +88,8 @@ IN_PROC_BROWSER_TEST_F(UserCloudExternalDataManagerTest, FetchExternalData) { user_policy_helper()->SetPolicyAndWait(*policy, base::DictionaryValue(), profile); - UserCloudPolicyManagerChromeOS* policy_manager = - profile->GetUserCloudPolicyManagerChromeOS(); + UserCloudPolicyManagerAsh* policy_manager = + profile->GetUserCloudPolicyManagerAsh(); ASSERT_TRUE(policy_manager); ProfilePolicyConnector* policy_connector = profile->GetProfilePolicyConnector(); diff --git a/chrome/browser/ash/policy/handlers/power_policy_browsertest.cc b/chrome/browser/ash/policy/handlers/power_policy_browsertest.cc index 356a7a7ad9969..931746b27d795 100644 --- a/chrome/browser/ash/policy/handlers/power_policy_browsertest.cc +++ b/chrome/browser/ash/policy/handlers/power_policy_browsertest.cc @@ -22,7 +22,7 @@ #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "chrome/browser/ash/policy/core/device_policy_cros_browser_test.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/lifetime/application_lifetime.h" @@ -261,8 +261,8 @@ void PowerPolicyBrowserTestBase::RunClosureAndWaitForUserPolicyUpdate( } void PowerPolicyBrowserTestBase::ReloadUserPolicy(Profile* profile) { - UserCloudPolicyManagerChromeOS* policy_manager = - profile->GetUserCloudPolicyManagerChromeOS(); + UserCloudPolicyManagerAsh* policy_manager = + profile->GetUserCloudPolicyManagerAsh(); ASSERT_TRUE(policy_manager); policy_manager->core()->store()->Load(); } diff --git a/chrome/browser/ash/policy/reporting/app_install_event_log_manager_wrapper.cc b/chrome/browser/ash/policy/reporting/app_install_event_log_manager_wrapper.cc index a654442646d6c..c06a2e3c038b6 100644 --- a/chrome/browser/ash/policy/reporting/app_install_event_log_manager_wrapper.cc +++ b/chrome/browser/ash/policy/reporting/app_install_event_log_manager_wrapper.cc @@ -8,7 +8,7 @@ #include "base/callback_helpers.h" #include "base/location.h" #include "base/threading/thread_task_runner_handle.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" @@ -65,8 +65,7 @@ void AppInstallEventLogManagerWrapper::Init() { void AppInstallEventLogManagerWrapper::CreateManager() { log_manager_ = std::make_unique( log_task_runner_.get(), - profile_->GetUserCloudPolicyManagerChromeOS() - ->GetAppInstallEventLogUploader(), + profile_->GetUserCloudPolicyManagerAsh()->GetAppInstallEventLogUploader(), profile_); } diff --git a/chrome/browser/ash/policy/reporting/extension_install_event_log_manager_wrapper.cc b/chrome/browser/ash/policy/reporting/extension_install_event_log_manager_wrapper.cc index c1ae3c54d0daf..461ef06764a35 100644 --- a/chrome/browser/ash/policy/reporting/extension_install_event_log_manager_wrapper.cc +++ b/chrome/browser/ash/policy/reporting/extension_install_event_log_manager_wrapper.cc @@ -8,7 +8,7 @@ #include "base/callback_helpers.h" #include "base/location.h" #include "base/threading/thread_task_runner_handle.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" @@ -24,7 +24,7 @@ ExtensionInstallEventLogManagerWrapper:: // static ExtensionInstallEventLogManagerWrapper* ExtensionInstallEventLogManagerWrapper::CreateForProfile(Profile* profile) { - if (!profile->GetUserCloudPolicyManagerChromeOS()) + if (!profile->GetUserCloudPolicyManagerAsh()) return nullptr; ExtensionInstallEventLogManagerWrapper* wrapper = new ExtensionInstallEventLogManagerWrapper(profile); @@ -68,7 +68,7 @@ void ExtensionInstallEventLogManagerWrapper::Init() { void ExtensionInstallEventLogManagerWrapper::CreateManager() { log_manager_ = std::make_unique( log_task_runner_.get(), - profile_->GetUserCloudPolicyManagerChromeOS() + profile_->GetUserCloudPolicyManagerAsh() ->GetExtensionInstallEventLogUploader(), profile_); } diff --git a/chrome/browser/ash/policy/status_collector/status_collector.cc b/chrome/browser/ash/policy/status_collector/status_collector.cc index a84ec0ec455b4..a1fb608d16455 100644 --- a/chrome/browser/ash/policy/status_collector/status_collector.cc +++ b/chrome/browser/ash/policy/status_collector/status_collector.cc @@ -9,7 +9,7 @@ #include "chrome/browser/ash/app_mode/kiosk_app_manager.h" #include "chrome/browser/ash/app_mode/web_app/web_kiosk_app_manager.h" #include "chrome/browser/ash/policy/core/device_local_account.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/policy/status_collector/activity_storage.h" #include "chrome/browser/ash/policy/status_collector/app_info_generator.h" #include "chrome/browser/profiles/profile.h" @@ -141,7 +141,7 @@ StatusCollector::GetAutoLaunchedKioskSessionInfo() { std::string StatusCollector::GetDMTokenForProfile(Profile* profile) const { CloudPolicyManager* user_cloud_policy_manager = - profile->GetUserCloudPolicyManagerChromeOS(); + profile->GetUserCloudPolicyManagerAsh(); DCHECK(user_cloud_policy_manager != nullptr); return user_cloud_policy_manager->core()->client()->dm_token(); } diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index fdd854dfa9b0e..6deef91fd466f 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn @@ -2083,8 +2083,8 @@ source_set("chromeos") { "../ash/policy/core/policy_oauth2_token_fetcher.h", "../ash/policy/core/policy_pref_names.cc", "../ash/policy/core/policy_pref_names.h", - "../ash/policy/core/user_cloud_policy_manager_chromeos.cc", - "../ash/policy/core/user_cloud_policy_manager_chromeos.h", + "../ash/policy/core/user_cloud_policy_manager_ash.cc", + "../ash/policy/core/user_cloud_policy_manager_ash.h", "../ash/policy/core/user_cloud_policy_store_ash.cc", "../ash/policy/core/user_cloud_policy_store_ash.h", "../ash/policy/core/user_cloud_policy_token_forwarder.cc", @@ -3992,7 +3992,7 @@ source_set("unit_tests") { "../ash/policy/core/device_local_account_policy_service_unittest.cc", "../ash/policy/core/device_policy_decoder_unittest.cc", "../ash/policy/core/dm_token_storage_unittest.cc", - "../ash/policy/core/user_cloud_policy_manager_chromeos_unittest.cc", + "../ash/policy/core/user_cloud_policy_manager_ash_unittest.cc", "../ash/policy/core/user_cloud_policy_store_ash_unittest.cc", "../ash/policy/core/user_cloud_policy_token_forwarder_unittest.cc", "../ash/policy/dlp/data_transfer_dlp_controller_unittest.cc", diff --git a/chrome/browser/enterprise/connectors/connectors_service.cc b/chrome/browser/enterprise/connectors/connectors_service.cc index 482e06949a97f..30c4ef287f51f 100644 --- a/chrome/browser/enterprise/connectors/connectors_service.cc +++ b/chrome/browser/enterprise/connectors/connectors_service.cc @@ -45,7 +45,7 @@ #include "google_apis/gaia/gaia_auth_util.h" #if BUILDFLAG(IS_CHROMEOS_ASH) -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #endif namespace enterprise_connectors { @@ -57,7 +57,7 @@ const enterprise_management::PolicyData* GetProfilePolicyData( DCHECK(profile); auto* manager = #if BUILDFLAG(IS_CHROMEOS_ASH) - profile->GetUserCloudPolicyManagerChromeOS(); + profile->GetUserCloudPolicyManagerAsh(); #else profile->GetUserCloudPolicyManager(); #endif @@ -86,7 +86,7 @@ void PopulateDeviceMetadata(const ReportingSettings& reporting_settings, device_proto->set_dm_token(reporting_settings.dm_token); #if BUILDFLAG(IS_CHROMEOS_ASH) std::string client_id; - auto* manager = profile->GetUserCloudPolicyManagerChromeOS(); + auto* manager = profile->GetUserCloudPolicyManagerAsh(); if (manager && manager->core() && manager->core()->client()) client_id = manager->core()->client()->client_id(); #else diff --git a/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_browsertest.cc b/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_browsertest.cc index 8a0ccbcac68c3..cd2a1fdaf8aae 100644 --- a/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_browsertest.cc +++ b/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_browsertest.cc @@ -38,7 +38,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/ash/policy/core/browser_policy_connector_chromeos.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/policy/dm_token_utils.h" #endif @@ -177,7 +177,7 @@ class EnterpriseReportingPrivateGetContextInfoBrowserTest if (profile_managed()) { #if BUILDFLAG(IS_CHROMEOS_ASH) auto* profile_policy_manager = - browser()->profile()->GetUserCloudPolicyManagerChromeOS(); + browser()->profile()->GetUserCloudPolicyManagerAsh(); profile_policy_manager->core()->client()->SetupRegistration( "dm_token", "client_id", {}); #else diff --git a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc index 2b0b0a0373164..98957daf10254 100644 --- a/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc +++ b/chrome/browser/extensions/api/safe_browsing_private/safe_browsing_private_event_router.cc @@ -46,7 +46,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/ash/policy/core/browser_policy_connector_chromeos.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/browser_process_platform_part_chromeos.h" #include "components/user_manager/user.h" @@ -853,7 +853,7 @@ SafeBrowsingPrivateEventRouter::InitBrowserReportingClient( policy_client_desc = kActiveDirectoryPolicyClientDescription; } else { policy_client_desc = kUserPolicyClientDescription; - auto* policy_manager = profile->GetUserCloudPolicyManagerChromeOS(); + auto* policy_manager = profile->GetUserCloudPolicyManagerAsh(); if (policy_manager) client = policy_manager->core()->client(); } diff --git a/chrome/browser/metrics/family_user_metrics_provider.cc b/chrome/browser/metrics/family_user_metrics_provider.cc index 3a8aaca5d2122..6a7d266154751 100644 --- a/chrome/browser/metrics/family_user_metrics_provider.cc +++ b/chrome/browser/metrics/family_user_metrics_provider.cc @@ -7,7 +7,7 @@ #include "base/check.h" #include "base/metrics/histogram_functions.h" #include "chrome/browser/ash/policy/core/browser_policy_connector_chromeos.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" @@ -29,8 +29,8 @@ constexpr char kNumSecondaryAccountsHistogramName[] = // Returns managed user log segment for metrics logging. enterprise_management::PolicyData::MetricsLogSegment GetManagedUserLogSegment( Profile* profile) { - const policy::UserCloudPolicyManagerChromeOS* user_cloud_policy_manager = - profile->GetUserCloudPolicyManagerChromeOS(); + const policy::UserCloudPolicyManagerAsh* user_cloud_policy_manager = + profile->GetUserCloudPolicyManagerAsh(); if (!user_cloud_policy_manager) return enterprise_management::PolicyData::UNSPECIFIED; const enterprise_management::PolicyData* policy = diff --git a/chrome/browser/metrics/usertype_by_devicetype_metrics_provider.cc b/chrome/browser/metrics/usertype_by_devicetype_metrics_provider.cc index d2f4dc662e396..ee09c5523c1c4 100644 --- a/chrome/browser/metrics/usertype_by_devicetype_metrics_provider.cc +++ b/chrome/browser/metrics/usertype_by_devicetype_metrics_provider.cc @@ -7,7 +7,7 @@ #include "base/logging.h" #include "base/metrics/histogram_functions.h" #include "chrome/browser/ash/policy/core/browser_policy_connector_chromeos.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" @@ -99,8 +99,8 @@ UserTypeByDeviceTypeMetricsProvider::GetUserSegment(Profile* profile) { return UserSegment::kUnmanaged; } - const policy::UserCloudPolicyManagerChromeOS* user_cloud_policy_manager = - profile->GetUserCloudPolicyManagerChromeOS(); + const policy::UserCloudPolicyManagerAsh* user_cloud_policy_manager = + profile->GetUserCloudPolicyManagerAsh(); if (!user_cloud_policy_manager) return UserSegment::kUnmanaged; const em::PolicyData* policy = diff --git a/chrome/browser/policy/cloud/cloud_policy_browsertest.cc b/chrome/browser/policy/cloud/cloud_policy_browsertest.cc index 7b7be47cf80c7..218e83e2a9557 100644 --- a/chrome/browser/policy/cloud/cloud_policy_browsertest.cc +++ b/chrome/browser/policy/cloud/cloud_policy_browsertest.cc @@ -60,7 +60,7 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/path_service.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chromeos/cryptohome/cryptohome_parameters.h" #include "chromeos/dbus/constants/dbus_paths.h" // nogncheck #include "chromeos/dbus/userdataauth/userdataauth_client.h" @@ -218,9 +218,8 @@ class CloudPolicyTest : public PlatformBrowserTest, connector->ScheduleServiceInitialization(0); #if BUILDFLAG(IS_CHROMEOS_ASH) - UserCloudPolicyManagerChromeOS* policy_manager = - chrome_test_utils::GetProfile(this) - ->GetUserCloudPolicyManagerChromeOS(); + UserCloudPolicyManagerAsh* policy_manager = + chrome_test_utils::GetProfile(this)->GetUserCloudPolicyManagerAsh(); ASSERT_TRUE(policy_manager); #else #if BUILDFLAG(IS_CHROMEOS_LACROS) diff --git a/chrome/browser/policy/cloud/cloud_policy_manager_browsertest.cc b/chrome/browser/policy/cloud/cloud_policy_manager_browsertest.cc index 2881c261debe4..e3fada484ec26 100644 --- a/chrome/browser/policy/cloud/cloud_policy_manager_browsertest.cc +++ b/chrome/browser/policy/cloud/cloud_policy_manager_browsertest.cc @@ -34,7 +34,7 @@ #include "testing/gtest/include/gtest/gtest.h" #if BUILDFLAG(IS_CHROMEOS_ASH) -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #else #include "chrome/browser/net/system_network_context_manager.h" #include "chrome/browser/signin/identity_manager_factory.h" @@ -210,9 +210,8 @@ class CloudPolicyManagerTest : public PlatformBrowserTest { } #if BUILDFLAG(IS_CHROMEOS_ASH) - UserCloudPolicyManagerChromeOS* policy_manager() { - return chrome_test_utils::GetProfile(this) - ->GetUserCloudPolicyManagerChromeOS(); + UserCloudPolicyManagerAsh* policy_manager() { + return chrome_test_utils::GetProfile(this)->GetUserCloudPolicyManagerAsh(); } #elif BUILDFLAG(IS_CHROMEOS_LACROS) UserCloudPolicyManager* policy_manager() { diff --git a/chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc b/chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc index b6232636d9525..8142a13333366 100644 --- a/chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc +++ b/chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc @@ -42,7 +42,7 @@ #include "testing/gtest/include/gtest/gtest.h" #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/constants/ash_switches.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #else #include "chrome/browser/net/system_network_context_manager.h" #include "chrome/browser/signin/identity_manager_factory.h" @@ -178,8 +178,8 @@ class ComponentCloudPolicyTest : public extensions::ExtensionBrowserTest { connector->ScheduleServiceInitialization(0); #if BUILDFLAG(IS_CHROMEOS_ASH) - UserCloudPolicyManagerChromeOS* policy_manager = - browser()->profile()->GetUserCloudPolicyManagerChromeOS(); + UserCloudPolicyManagerAsh* policy_manager = + browser()->profile()->GetUserCloudPolicyManagerAsh(); ASSERT_TRUE(policy_manager); #else // Mock a signed-in user. This is used by the UserCloudPolicyStore to pass diff --git a/chrome/browser/policy/cloud/user_cloud_policy_invalidator_factory.cc b/chrome/browser/policy/cloud/user_cloud_policy_invalidator_factory.cc index fd291f880dbaa..30658226ddf14 100644 --- a/chrome/browser/policy/cloud/user_cloud_policy_invalidator_factory.cc +++ b/chrome/browser/policy/cloud/user_cloud_policy_invalidator_factory.cc @@ -11,7 +11,7 @@ #include "chrome/browser/profiles/profile.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #if BUILDFLAG(IS_CHROMEOS_ASH) -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #else #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" #endif @@ -37,8 +37,7 @@ KeyedService* UserCloudPolicyInvalidatorFactory::BuildServiceInstanceFor( content::BrowserContext* context) const { Profile* profile = static_cast(context); #if BUILDFLAG(IS_CHROMEOS_ASH) - CloudPolicyManager* policy_manager = - profile->GetUserCloudPolicyManagerChromeOS(); + CloudPolicyManager* policy_manager = profile->GetUserCloudPolicyManagerAsh(); #else CloudPolicyManager* policy_manager = profile->GetUserCloudPolicyManager(); #endif diff --git a/chrome/browser/policy/dm_token_utils.cc b/chrome/browser/policy/dm_token_utils.cc index 1976e49667653..29e51a752aaac 100644 --- a/chrome/browser/policy/dm_token_utils.cc +++ b/chrome/browser/policy/dm_token_utils.cc @@ -12,7 +12,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/ash/policy/core/browser_policy_connector_chromeos.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/browser_process_platform_part.h" #include "components/user_manager/user.h" @@ -56,7 +56,7 @@ DMToken GetDMToken(Profile* const profile, bool only_affiliated) { policy_manager = connector->GetDeviceCloudPolicyManager(); } else { // Policy Manager for User DM Token. - policy_manager = profile->GetUserCloudPolicyManagerChromeOS(); + policy_manager = profile->GetUserCloudPolicyManagerAsh(); } if (dm_token.is_empty() && (user->IsAffiliated() || !only_affiliated) && diff --git a/chrome/browser/policy/messaging_layer/util/heartbeat_event_factory.cc b/chrome/browser/policy/messaging_layer/util/heartbeat_event_factory.cc index b9283d20acdd0..4aab15858c2ce 100644 --- a/chrome/browser/policy/messaging_layer/util/heartbeat_event_factory.cc +++ b/chrome/browser/policy/messaging_layer/util/heartbeat_event_factory.cc @@ -9,7 +9,7 @@ #include "components/keyed_service/content/browser_context_dependency_manager.h" #if BUILDFLAG(IS_CHROMEOS_ASH) -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #else #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" #endif @@ -32,8 +32,8 @@ KeyedService* HeartbeatEventFactory::BuildServiceInstanceFor( Profile* profile = static_cast(context); #if BUILDFLAG(IS_CHROMEOS_ASH) - policy::UserCloudPolicyManagerChromeOS* manager = - profile->GetUserCloudPolicyManagerChromeOS(); + policy::UserCloudPolicyManagerAsh* manager = + profile->GetUserCloudPolicyManagerAsh(); #else policy::UserCloudPolicyManager* manager = profile->GetUserCloudPolicyManager(); diff --git a/chrome/browser/policy/profile_policy_connector_builder.cc b/chrome/browser/policy/profile_policy_connector_builder.cc index b79695317d934..19ad3932e9ee9 100644 --- a/chrome/browser/policy/profile_policy_connector_builder.cc +++ b/chrome/browser/policy/profile_policy_connector_builder.cc @@ -18,7 +18,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/ash/policy/active_directory/active_directory_policy_manager.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/profiles/profile_helper.h" #else // Non-ChromeOS. #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" @@ -55,10 +55,10 @@ CreateProfilePolicyConnectorForBrowserContext( // On ChromeOS, we always pass nullptr for the |user_cloud_policy_manager|. // This is because the |policy_provider| could be either a - // UserCloudPolicyManagerChromeOS or a ActiveDirectoryPolicyManager, both of + // UserCloudPolicyManagerAsh or a ActiveDirectoryPolicyManager, both of // which should be obtained via UserPolicyManagerFactoryChromeOS APIs. CloudPolicyManager* cloud_policy_manager = - profile->GetUserCloudPolicyManagerChromeOS(); + profile->GetUserCloudPolicyManagerAsh(); ActiveDirectoryPolicyManager* active_directory_manager = profile->GetActiveDirectoryPolicyManager(); if (cloud_policy_manager) { diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc index 820e2a017bb1b..c1eabb87ee69c 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.cc +++ b/chrome/browser/profiles/off_the_record_profile_impl.cc @@ -379,9 +379,9 @@ OffTheRecordProfileImpl::GetPolicySchemaRegistryService() { } #if BUILDFLAG(IS_CHROMEOS_ASH) -policy::UserCloudPolicyManagerChromeOS* -OffTheRecordProfileImpl::GetUserCloudPolicyManagerChromeOS() { - return GetOriginalProfile()->GetUserCloudPolicyManagerChromeOS(); +policy::UserCloudPolicyManagerAsh* +OffTheRecordProfileImpl::GetUserCloudPolicyManagerAsh() { + return GetOriginalProfile()->GetUserCloudPolicyManagerAsh(); } policy::ActiveDirectoryPolicyManager* diff --git a/chrome/browser/profiles/off_the_record_profile_impl.h b/chrome/browser/profiles/off_the_record_profile_impl.h index 0bd93cc4dda47..c0b0b4169b322 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.h +++ b/chrome/browser/profiles/off_the_record_profile_impl.h @@ -57,8 +57,7 @@ class OffTheRecordProfileImpl : public Profile { const PrefService* GetPrefs() const override; policy::SchemaRegistryService* GetPolicySchemaRegistryService() override; #if BUILDFLAG(IS_CHROMEOS_ASH) - policy::UserCloudPolicyManagerChromeOS* GetUserCloudPolicyManagerChromeOS() - override; + policy::UserCloudPolicyManagerAsh* GetUserCloudPolicyManagerAsh() override; policy::ActiveDirectoryPolicyManager* GetActiveDirectoryPolicyManager() override; #else diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h index 399aff5f85b77..4d0cc18bd6a85 100644 --- a/chrome/browser/profiles/profile.h +++ b/chrome/browser/profiles/profile.h @@ -51,7 +51,7 @@ class UserCloudPolicyManager; #if BUILDFLAG(IS_CHROMEOS_ASH) class ActiveDirectoryPolicyManager; -class UserCloudPolicyManagerChromeOS; +class UserCloudPolicyManagerAsh; #endif } // namespace policy @@ -353,9 +353,8 @@ class Profile : public content::BrowserContext { virtual policy::SchemaRegistryService* GetPolicySchemaRegistryService() = 0; #if BUILDFLAG(IS_CHROMEOS_ASH) - // Returns the UserCloudPolicyManagerChromeOS. - virtual policy::UserCloudPolicyManagerChromeOS* - GetUserCloudPolicyManagerChromeOS() = 0; + // Returns the UserCloudPolicyManagerAsh. + virtual policy::UserCloudPolicyManagerAsh* GetUserCloudPolicyManagerAsh() = 0; // Returns the ActiveDirectoryPolicyManager. virtual policy::ActiveDirectoryPolicyManager* diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index 81724e84792bc..46c6cdc32ea5e 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -178,7 +178,7 @@ #include "chrome/browser/ash/arc/session/arc_service_launcher.h" #include "chrome/browser/ash/login/session/user_session_manager.h" #include "chrome/browser/ash/policy/active_directory/active_directory_policy_manager.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/policy/core/user_policy_manager_builder_chromeos.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/ash/settings/device_settings_service.h" @@ -596,10 +596,10 @@ void ProfileImpl::LoadPrefsForNormalStartup(bool async_prefs) { policy::CreateConfigurationPolicyProvider( this, force_immediate_policy_load, io_task_runner_, - &user_cloud_policy_manager_chromeos_, &active_directory_policy_manager_); + &user_cloud_policy_manager_ash_, &active_directory_policy_manager_); user_cloud_policy_manager = nullptr; - policy_provider = GetUserCloudPolicyManagerChromeOS(); + policy_provider = GetUserCloudPolicyManagerAsh(); if (!policy_provider) { policy_provider = GetActiveDirectoryPolicyManager(); } @@ -1197,9 +1197,8 @@ policy::SchemaRegistryService* ProfileImpl::GetPolicySchemaRegistryService() { } #if BUILDFLAG(IS_CHROMEOS_ASH) -policy::UserCloudPolicyManagerChromeOS* -ProfileImpl::GetUserCloudPolicyManagerChromeOS() { - return user_cloud_policy_manager_chromeos_.get(); +policy::UserCloudPolicyManagerAsh* ProfileImpl::GetUserCloudPolicyManagerAsh() { + return user_cloud_policy_manager_ash_.get(); } policy::ActiveDirectoryPolicyManager* @@ -1215,8 +1214,8 @@ policy::UserCloudPolicyManager* ProfileImpl::GetUserCloudPolicyManager() { policy::ConfigurationPolicyProvider* ProfileImpl::configuration_policy_provider() { #if BUILDFLAG(IS_CHROMEOS_ASH) - if (user_cloud_policy_manager_chromeos_) - return user_cloud_policy_manager_chromeos_.get(); + if (user_cloud_policy_manager_ash_) + return user_cloud_policy_manager_ash_.get(); if (active_directory_policy_manager_) return active_directory_policy_manager_.get(); return nullptr; diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h index 59ae8bbe26d5f..7f0357c05704c 100644 --- a/chrome/browser/profiles/profile_impl.h +++ b/chrome/browser/profiles/profile_impl.h @@ -140,8 +140,7 @@ class ProfileImpl : public Profile { PrefService* GetReadOnlyOffTheRecordPrefs() override; policy::SchemaRegistryService* GetPolicySchemaRegistryService() override; #if BUILDFLAG(IS_CHROMEOS_ASH) - policy::UserCloudPolicyManagerChromeOS* GetUserCloudPolicyManagerChromeOS() - override; + policy::UserCloudPolicyManagerAsh* GetUserCloudPolicyManagerAsh() override; policy::ActiveDirectoryPolicyManager* GetActiveDirectoryPolicyManager() override; #else @@ -255,7 +254,7 @@ class ProfileImpl : public Profile { // - |profile_policy_connector_| depends on configuration_policy_provider(), // which can be: // - |user_cloud_policy_manager_|; - // - |user_cloud_policy_manager_chromeos_|; + // - |user_cloud_policy_manager_ash_|; // - or |active_directory_policy_manager_|. // - configuration_policy_provider() depends on |schema_registry_service_| @@ -264,8 +263,8 @@ class ProfileImpl : public Profile { // configuration_policy_provider() is either of these, or nullptr in some // tests. #if BUILDFLAG(IS_CHROMEOS_ASH) - std::unique_ptr - user_cloud_policy_manager_chromeos_; + std::unique_ptr + user_cloud_policy_manager_ash_; std::unique_ptr active_directory_policy_manager_; #else diff --git a/chrome/browser/profiles/reporting_util.cc b/chrome/browser/profiles/reporting_util.cc index f9ed745a91bab..6fe35d5a3a626 100644 --- a/chrome/browser/profiles/reporting_util.cc +++ b/chrome/browser/profiles/reporting_util.cc @@ -25,7 +25,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/ash/login/users/affiliation.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/profiles/profile_helper.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) @@ -39,7 +39,7 @@ const enterprise_management::PolicyData* GetPolicyData(Profile* profile) { auto* manager = #if BUILDFLAG(IS_CHROMEOS_ASH) - profile->GetUserCloudPolicyManagerChromeOS(); + profile->GetUserCloudPolicyManagerAsh(); #else profile->GetUserCloudPolicyManager(); #endif diff --git a/chrome/browser/ui/ash/system_tray_client_impl.cc b/chrome/browser/ui/ash/system_tray_client_impl.cc index 9c17a29548990..1f9734d9e8428 100644 --- a/chrome/browser/ui/ash/system_tray_client_impl.cc +++ b/chrome/browser/ui/ash/system_tray_client_impl.cc @@ -19,7 +19,7 @@ #include "chrome/browser/ash/login/help_app_launcher.h" #include "chrome/browser/ash/policy/core/browser_policy_connector_chromeos.h" #include "chrome/browser/ash/policy/core/device_cloud_policy_manager_ash.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/ash/system/system_clock.h" #include "chrome/browser/browser_process.h" @@ -196,8 +196,8 @@ class SystemTrayClientImpl::EnterpriseAccountObserver profile_ = profile; if (profile_) { - policy::UserCloudPolicyManagerChromeOS* manager = - profile_->GetUserCloudPolicyManagerChromeOS(); + policy::UserCloudPolicyManagerAsh* manager = + profile_->GetUserCloudPolicyManagerAsh(); if (manager) policy_observation_.Observe(manager->core()->store()); } diff --git a/chrome/browser/ui/managed_ui.cc b/chrome/browser/ui/managed_ui.cc index b294b796f0719..b992372178c9f 100644 --- a/chrome/browser/ui/managed_ui.cc +++ b/chrome/browser/ui/managed_ui.cc @@ -23,7 +23,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/ash/login/demo_mode/demo_session.h" #include "chrome/browser/ash/policy/core/browser_policy_connector_chromeos.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" #include "ui/chromeos/devicetype_utils.h" @@ -48,7 +48,7 @@ std::string GetManagedBy(const policy::CloudPolicyManager* manager) { const policy::CloudPolicyManager* GetUserCloudPolicyManager(Profile* profile) { #if BUILDFLAG(IS_CHROMEOS_ASH) - return profile->GetUserCloudPolicyManagerChromeOS(); + return profile->GetUserCloudPolicyManagerAsh(); #else return profile->GetUserCloudPolicyManager(); #endif // BUILDFLAG(IS_CHROMEOS_ASH) diff --git a/chrome/browser/ui/webui/chromeos/edu_coexistence/edu_coexistence_login_handler_chromeos.cc b/chrome/browser/ui/webui/chromeos/edu_coexistence/edu_coexistence_login_handler_chromeos.cc index 48be47f4316fe..0bfbc2535720e 100644 --- a/chrome/browser/ui/webui/chromeos/edu_coexistence/edu_coexistence_login_handler_chromeos.cc +++ b/chrome/browser/ui/webui/chromeos/edu_coexistence/edu_coexistence_login_handler_chromeos.cc @@ -21,7 +21,7 @@ #include "base/values.h" #include "chrome/browser/ash/child_accounts/edu_coexistence_tos_store_utils.h" #include "chrome/browser/ash/login/login_pref_names.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/profiles/profile.h" @@ -110,8 +110,8 @@ base::Time GetSigninTime() { // required. std::string GetDeviceIdForActiveUserProfile() { Profile* profile = ProfileManager::GetActiveUserProfile(); - const policy::UserCloudPolicyManagerChromeOS* policy_manager = - profile->GetUserCloudPolicyManagerChromeOS(); + const policy::UserCloudPolicyManagerAsh* policy_manager = + profile->GetUserCloudPolicyManagerAsh(); if (!policy_manager) return std::string(); diff --git a/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_ui.cc b/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_ui.cc index 85a44fdd558ff..117674b67c987 100644 --- a/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_ui.cc +++ b/chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_ui.cc @@ -13,7 +13,7 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/browser/ash/login/login_pref_names.h" #include "chrome/browser/ash/login/saml/password_expiry_notification.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_dialogs.h" #include "chrome/browser/ui/webui/chromeos/in_session_password_change/password_change_handler.h" @@ -46,8 +46,8 @@ std::string GetPasswordChangeUrl(Profile* profile) { switches::kSamlPasswordChangeUrl); } - const policy::UserCloudPolicyManagerChromeOS* user_cloud_policy_manager = - profile->GetUserCloudPolicyManagerChromeOS(); + const policy::UserCloudPolicyManagerAsh* user_cloud_policy_manager = + profile->GetUserCloudPolicyManagerAsh(); if (user_cloud_policy_manager) { const enterprise_management::PolicyData* policy = user_cloud_policy_manager->core()->store()->policy(); diff --git a/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc b/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc index a93a0dbd7d5c6..8f9e8b16bb53b 100644 --- a/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc +++ b/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc @@ -46,7 +46,7 @@ #include "chrome/browser/ash/crostini/fake_crostini_features.h" #include "chrome/browser/ash/policy/core/device_cloud_policy_manager_ash.h" #include "chrome/browser/ash/policy/core/device_cloud_policy_store_ash.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/policy/dlp/dlp_rules_manager.h" #include "chrome/browser/ash/policy/dlp/mock_dlp_rules_manager.h" #include "chrome/browser/ash/policy/enrollment/device_cloud_policy_initializer.h" @@ -537,8 +537,7 @@ class ManagementUIHandlerTests : public TestingBaseClass { #if BUILDFLAG(IS_CHROMEOS_ASH) void OnFatalError() { DCHECK(false); } - std::unique_ptr - BuildCloudPolicyManager() { + std::unique_ptr BuildCloudPolicyManager() { auto store = std::make_unique(); EXPECT_CALL(*store, Load()).Times(AnyNumber()); @@ -553,11 +552,10 @@ class ManagementUIHandlerTests : public TestingBaseClass { std::make_unique(); EXPECT_CALL(*data_manager, Disconnect()); - return std::make_unique( + return std::make_unique( managed_user.get(), std::move(store), std::move(data_manager), base::FilePath() /* component_policy_cache_path */, - policy::UserCloudPolicyManagerChromeOS::PolicyEnforcement:: - kPolicyRequired, + policy::UserCloudPolicyManagerAsh::PolicyEnforcement::kPolicyRequired, base::TimeDelta::FromMinutes(1) /* policy_refresh_timeout */, base::BindOnce(&ManagementUIHandlerTests::OnFatalError, base::Unretained(this)), @@ -1397,16 +1395,15 @@ TEST_F(ManagementUIHandlerTests, GetAccountManager) { std::make_unique( TestingBrowserProcess::GetGlobal()); ASSERT_TRUE(profile_manager->SetUp()); - builder_managed_user.SetUserCloudPolicyManagerChromeOS( - BuildCloudPolicyManager()); + builder_managed_user.SetUserCloudPolicyManagerAsh(BuildCloudPolicyManager()); #else builder_managed_user.SetUserCloudPolicyManager(BuildCloudPolicyManager()); #endif auto managed_user = builder_managed_user.Build(); #if BUILDFLAG(IS_CHROMEOS_ASH) - policy::UserCloudPolicyManagerChromeOS* policy_manager = - managed_user->GetUserCloudPolicyManagerChromeOS(); + policy::UserCloudPolicyManagerAsh* policy_manager = + managed_user->GetUserCloudPolicyManagerAsh(); policy::MockCloudPolicyStore* mock_store = static_cast( policy_manager->core()->store()); diff --git a/chrome/browser/ui/webui/policy/policy_ui_handler.cc b/chrome/browser/ui/webui/policy/policy_ui_handler.cc index 35b8ebd94c875..a41d599c158b9 100644 --- a/chrome/browser/ui/webui/policy/policy_ui_handler.cc +++ b/chrome/browser/ui/webui/policy/policy_ui_handler.cc @@ -95,7 +95,7 @@ #include "chrome/browser/ash/policy/core/browser_policy_connector_chromeos.h" #include "chrome/browser/ash/policy/core/device_cloud_policy_store_ash.h" #include "chrome/browser/ash/policy/core/device_local_account_policy_service.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/policy/off_hours/device_off_hours_controller.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/browser_process_platform_part.h" @@ -683,8 +683,8 @@ void PolicyUIHandler::RegisterMessages() { user_manager->IsLoggedInAsPublicAccount() ? connector->GetDeviceLocalAccountPolicyService() : nullptr; - policy::UserCloudPolicyManagerChromeOS* user_cloud_policy = - profile->GetUserCloudPolicyManagerChromeOS(); + policy::UserCloudPolicyManagerAsh* user_cloud_policy = + profile->GetUserCloudPolicyManagerAsh(); policy::ActiveDirectoryPolicyManager* active_directory_policy = profile->GetActiveDirectoryPolicyManager(); if (local_account_service) { @@ -1047,7 +1047,7 @@ void PolicyUIHandler::HandleReloadPolicies(const base::ListValue* args) { ->GetDeviceCloudPolicyManager(); Profile* const profile = Profile::FromWebUI(web_ui()); policy::CloudPolicyManager* const user_manager = - profile->GetUserCloudPolicyManagerChromeOS(); + profile->GetUserCloudPolicyManagerAsh(); // Fetch both device and user remote commands. for (policy::CloudPolicyManager* manager : {device_manager, user_manager}) { diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 57c593d1857c4..8b861ba7ef1fd 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn @@ -3292,7 +3292,7 @@ if (!is_android) { "../browser/ash/policy/core/device_local_account_browsertest.cc", "../browser/ash/policy/core/device_policy_cros_browser_test.cc", "../browser/ash/policy/core/device_policy_cros_browser_test.h", - "../browser/ash/policy/core/user_cloud_policy_manager_chromeos_browsertest.cc", + "../browser/ash/policy/core/user_cloud_policy_manager_ash_browsertest.cc", "../browser/ash/policy/display/device_display_cros_browser_test.cc", "../browser/ash/policy/display/device_display_cros_browser_test.h", "../browser/ash/policy/display/display_resolution_handler_browsertest.cc", diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index fdcf1aeca24c9..59819ad558ac9 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc @@ -130,7 +130,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/components/account_manager/account_manager_factory.h" #include "chrome/browser/ash/arc/session/arc_service_launcher.h" -#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_chromeos.h" +#include "chrome/browser/ash/policy/core/user_cloud_policy_manager_ash.h" #include "chrome/browser/ash/settings/cros_settings.h" #include "chrome/browser/chromeos/net/delay_network_call.h" #include "components/account_manager_core/chromeos/account_manager.h" @@ -224,7 +224,7 @@ TestingProfile::TestingProfile( bool is_new_profile, const std::string& supervised_user_id, #if BUILDFLAG(IS_CHROMEOS_ASH) - std::unique_ptr policy_manager, + std::unique_ptr policy_manager, #else std::unique_ptr policy_manager, #endif // BUILDFLAG(IS_CHROMEOS_ASH) @@ -868,8 +868,8 @@ TestingProfile::GetPolicySchemaRegistryService() { } #if BUILDFLAG(IS_CHROMEOS_ASH) -policy::UserCloudPolicyManagerChromeOS* -TestingProfile::GetUserCloudPolicyManagerChromeOS() { +policy::UserCloudPolicyManagerAsh* +TestingProfile::GetUserCloudPolicyManagerAsh() { return user_cloud_policy_manager_.get(); } @@ -1038,8 +1038,8 @@ void TestingProfile::Builder::SetSupervisedUserId( } #if BUILDFLAG(IS_CHROMEOS_ASH) -void TestingProfile::Builder::SetUserCloudPolicyManagerChromeOS( - std::unique_ptr +void TestingProfile::Builder::SetUserCloudPolicyManagerAsh( + std::unique_ptr user_cloud_policy_manager) { user_cloud_policy_manager_ = std::move(user_cloud_policy_manager); } diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h index 4bf39660ece4b..6c92e91caf16d 100644 --- a/chrome/test/base/testing_profile.h +++ b/chrome/test/base/testing_profile.h @@ -61,7 +61,7 @@ class PolicyService; class ProfilePolicyConnector; class SchemaRegistryService; #if BUILDFLAG(IS_CHROMEOS_ASH) -class UserCloudPolicyManagerChromeOS; +class UserCloudPolicyManagerAsh; #else class UserCloudPolicyManager; #endif // BUILDFLAG(IS_CHROMEOS_ASH) @@ -151,8 +151,8 @@ class TestingProfile : public Profile { void SetSupervisedUserId(const std::string& supervised_user_id); #if BUILDFLAG(IS_CHROMEOS_ASH) - void SetUserCloudPolicyManagerChromeOS( - std::unique_ptr + void SetUserCloudPolicyManagerAsh( + std::unique_ptr user_cloud_policy_manager); #else void SetUserCloudPolicyManager( @@ -196,7 +196,7 @@ class TestingProfile : public Profile { bool is_new_profile_ = false; std::string supervised_user_id_; #if BUILDFLAG(IS_CHROMEOS_ASH) - std::unique_ptr + std::unique_ptr user_cloud_policy_manager_; #else std::unique_ptr user_cloud_policy_manager_; @@ -235,7 +235,7 @@ class TestingProfile : public Profile { bool is_new_profile, const std::string& supervised_user_id, #if BUILDFLAG(IS_CHROMEOS_ASH) - std::unique_ptr policy_manager, + std::unique_ptr policy_manager, #else std::unique_ptr policy_manager, #endif // BUILDFLAG(IS_CHROMEOS_ASH) @@ -348,8 +348,7 @@ class TestingProfile : public Profile { ProfileKey* GetProfileKey() const override; policy::SchemaRegistryService* GetPolicySchemaRegistryService() override; #if BUILDFLAG(IS_CHROMEOS_ASH) - policy::UserCloudPolicyManagerChromeOS* GetUserCloudPolicyManagerChromeOS() - override; + policy::UserCloudPolicyManagerAsh* GetUserCloudPolicyManagerAsh() override; policy::ActiveDirectoryPolicyManager* GetActiveDirectoryPolicyManager() override; #else @@ -484,8 +483,7 @@ class TestingProfile : public Profile { std::unique_ptr schema_registry_service_; #if BUILDFLAG(IS_CHROMEOS_ASH) - std::unique_ptr - user_cloud_policy_manager_; + std::unique_ptr user_cloud_policy_manager_; #else std::unique_ptr user_cloud_policy_manager_; #endif // BUILDFLAG(IS_CHROMEOS_ASH)