Commit 617441bb authored by Brian Malcolm's avatar Brian Malcolm Committed by Commit Bot

Added ManagementUIHandler::GetAccountManager

This is the UI name of the entity that manages the user's domain, which
can either be a domain name (foo.com), or the admin's email address
(user@foo.com). This function will be used in future cl's.

BUG=chromium:1081272

Change-Id: If0526718a1ae593543711b5a65bff78671123bdf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2432090
Commit-Queue: Brian Malcolm <bmalcolm@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#812454}
parent 731bbd38
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include "chrome/browser/chromeos/policy/status_collector/status_collector.h" #include "chrome/browser/chromeos/policy/status_collector/status_collector.h"
#include "chrome/browser/chromeos/policy/status_uploader.h" #include "chrome/browser/chromeos/policy/status_uploader.h"
#include "chrome/browser/chromeos/policy/system_log_uploader.h" #include "chrome/browser/chromeos/policy/system_log_uploader.h"
#include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/ui/webui/management_ui_handler_chromeos.h" #include "chrome/browser/ui/webui/management_ui_handler_chromeos.h"
...@@ -64,6 +65,8 @@ ...@@ -64,6 +65,8 @@
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/user_manager/user_manager.h" #include "components/user_manager/user_manager.h"
#include "ui/chromeos/devicetype_utils.h" #include "ui/chromeos/devicetype_utils.h"
#else
#include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
#include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/extensions/extension_util.h"
...@@ -72,6 +75,7 @@ ...@@ -72,6 +75,7 @@
#include "components/policy/core/common/policy_namespace.h" #include "components/policy/core/common/policy_namespace.h"
#include "components/policy/core/common/policy_service.h" #include "components/policy/core/common/policy_service.h"
#include "components/policy/policy_constants.h" #include "components/policy/policy_constants.h"
#include "components/policy/proto/device_management_backend.pb.h"
#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "extensions/common/extension_set.h" #include "extensions/common/extension_set.h"
...@@ -340,6 +344,29 @@ std::string ManagementUIHandler::GetAccountDomain(Profile* profile) { ...@@ -340,6 +344,29 @@ std::string ManagementUIHandler::GetAccountDomain(Profile* profile) {
: domain; : domain;
} }
std::string ManagementUIHandler::GetAccountManager(Profile* profile) {
if (!IsProfileManaged(profile))
return std::string();
#if defined(OS_CHROMEOS)
const policy::UserCloudPolicyManagerChromeOS* user_cloud_policy_manager =
profile->GetUserCloudPolicyManagerChromeOS();
#else
const policy::UserCloudPolicyManager* user_cloud_policy_manager =
profile->GetUserCloudPolicyManager();
#endif // defined(OS_CHROMEOS)
if (user_cloud_policy_manager) {
const enterprise_management::PolicyData* policy =
user_cloud_policy_manager->core()->store()->policy();
if (policy && policy->has_managed_by()) {
return policy->managed_by();
}
}
return GetAccountDomain(profile);
}
ManagementUIHandler::ManagementUIHandler() { ManagementUIHandler::ManagementUIHandler() {
reporting_extension_ids_ = {kOnPremReportingExtensionStableId, reporting_extension_ids_ = {kOnPremReportingExtensionStableId,
kOnPremReportingExtensionBetaId, kOnPremReportingExtensionBetaId,
......
...@@ -120,8 +120,17 @@ class ManagementUIHandler : public content::WebUIMessageHandler, ...@@ -120,8 +120,17 @@ class ManagementUIHandler : public content::WebUIMessageHandler,
void SetAccountManagedForTesting(bool managed) { account_managed_ = managed; } void SetAccountManagedForTesting(bool managed) { account_managed_ = managed; }
void SetDeviceManagedForTesting(bool managed) { device_managed_ = managed; } void SetDeviceManagedForTesting(bool managed) { device_managed_ = managed; }
// This will return the domain (ie foo.com) that manages |profile|. If
// unmanaged, an empty string is returned.
static std::string GetAccountDomain(Profile* profile); static std::string GetAccountDomain(Profile* profile);
// This returns the entity that manages this |profile|. For standard dasher
// domains, this will be a domain name (ie foo.com). For FlexOrgs, this will
// be the email address of the admin of the FlexOrg (ie user@foo.com). If
// DMServer does not provide this information, this method defaults to
// |GetAccountDomain|. If unmanaged, an empty string is returned.
static std::string GetAccountManager(Profile* profile);
void OnJavascriptAllowed() override; void OnJavascriptAllowed() override;
void OnJavascriptDisallowed() override; void OnJavascriptDisallowed() override;
......
...@@ -30,8 +30,10 @@ ...@@ -30,8 +30,10 @@
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "base/files/file_path.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "base/test/test_simple_task_runner.h" #include "base/test/test_simple_task_runner.h"
#include "base/time/time.h"
#include "chrome/browser/chromeos/crostini/crostini_features.h" #include "chrome/browser/chromeos/crostini/crostini_features.h"
#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_pref_names.h"
#include "chrome/browser/chromeos/crostini/fake_crostini_features.h" #include "chrome/browser/chromeos/crostini/fake_crostini_features.h"
...@@ -42,6 +44,7 @@ ...@@ -42,6 +44,7 @@
#include "chrome/browser/chromeos/policy/status_collector/status_collector.h" #include "chrome/browser/chromeos/policy/status_collector/status_collector.h"
#include "chrome/browser/chromeos/policy/status_uploader.h" #include "chrome/browser/chromeos/policy/status_uploader.h"
#include "chrome/browser/chromeos/policy/system_log_uploader.h" #include "chrome/browser/chromeos/policy/system_log_uploader.h"
#include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
#include "chrome/browser/chromeos/settings/device_settings_service.h" #include "chrome/browser/chromeos/settings/device_settings_service.h"
#include "chrome/browser/chromeos/settings/device_settings_test_helper.h" #include "chrome/browser/chromeos/settings/device_settings_test_helper.h"
#include "chrome/browser/chromeos/settings/scoped_testing_cros_settings.h" #include "chrome/browser/chromeos/settings/scoped_testing_cros_settings.h"
...@@ -49,6 +52,7 @@ ...@@ -49,6 +52,7 @@
#include "chrome/common/chrome_features.h" #include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "chromeos/cryptohome/async_method_caller.h" #include "chromeos/cryptohome/async_method_caller.h"
#include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/power/power_manager_client.h" #include "chromeos/dbus/power/power_manager_client.h"
...@@ -58,10 +62,13 @@ ...@@ -58,10 +62,13 @@
#include "chromeos/network/proxy/ui_proxy_config_service.h" #include "chromeos/network/proxy/ui_proxy_config_service.h"
#include "chromeos/system/fake_statistics_provider.h" #include "chromeos/system/fake_statistics_provider.h"
#include "chromeos/tpm/stub_install_attributes.h" #include "chromeos/tpm/stub_install_attributes.h"
#include "components/account_id/account_id.h"
#include "components/enterprise/browser/reporting/common_pref_names.h" #include "components/enterprise/browser/reporting/common_pref_names.h"
#include "components/onc/onc_pref_names.h" #include "components/onc/onc_pref_names.h"
#include "components/policy/core/common/cloud/cloud_external_data_manager.h" #include "components/policy/core/common/cloud/cloud_external_data_manager.h"
#include "components/policy/core/common/cloud/mock_cloud_external_data_manager.h"
#include "components/policy/core/common/cloud/mock_cloud_policy_client.h" #include "components/policy/core/common/cloud/mock_cloud_policy_client.h"
#include "components/policy/core/common/cloud/mock_cloud_policy_store.h"
#include "components/policy/core/common/cloud/mock_signing_service.h" #include "components/policy/core/common/cloud/mock_signing_service.h"
#include "components/prefs/testing_pref_service.h" #include "components/prefs/testing_pref_service.h"
#include "components/proxy_config/pref_proxy_config_tracker_impl.h" #include "components/proxy_config/pref_proxy_config_tracker_impl.h"
...@@ -71,9 +78,16 @@ ...@@ -71,9 +78,16 @@
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "third_party/cros_system_api/dbus/shill/dbus-constants.h" #include "third_party/cros_system_api/dbus/shill/dbus-constants.h"
#include "ui/chromeos/devicetype_utils.h" #include "ui/chromeos/devicetype_utils.h"
#else
#include "base/threading/thread_task_runner_handle.h"
#include "components/policy/core/common/cloud/cloud_external_data_manager.h"
#include "components/policy/core/common/cloud/mock_user_cloud_policy_store.h"
#include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
#include "services/network/test/test_network_connection_tracker.h"
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
using testing::_; using testing::_;
using testing::AnyNumber;
using testing::AssertionFailure; using testing::AssertionFailure;
using testing::AssertionResult; using testing::AssertionResult;
using testing::AssertionSuccess; using testing::AssertionSuccess;
...@@ -93,6 +107,15 @@ struct ContextualManagementSourceUpdate { ...@@ -93,6 +107,15 @@ struct ContextualManagementSourceUpdate {
bool managed; bool managed;
}; };
namespace {
const char kDomain[] = "domain.com";
const char kUser[] = "user@domain.com";
const char kManager[] = "manager@domain.com";
#if defined(OS_CHROMEOS)
const char kGaiaId[] = "gaia_id";
#endif // defined(OS_CHROMEOS)
} // namespace
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// This class is just to mock the behaviour of the few flags we need for // This class is just to mock the behaviour of the few flags we need for
// simulating the behaviour of the policy::DeviceStatusCollector. // simulating the behaviour of the policy::DeviceStatusCollector.
...@@ -157,7 +180,7 @@ class TestDeviceCloudPolicyManagerChromeOS ...@@ -157,7 +180,7 @@ class TestDeviceCloudPolicyManagerChromeOS
} }
~TestDeviceCloudPolicyManagerChromeOS() override = default; ~TestDeviceCloudPolicyManagerChromeOS() override = default;
}; };
#endif #endif // defined(OS_CHROMEOS)
class TestManagementUIHandler : public ManagementUIHandler { class TestManagementUIHandler : public ManagementUIHandler {
public: public:
...@@ -487,6 +510,48 @@ class ManagementUIHandlerTests : public TestingBaseClass { ...@@ -487,6 +510,48 @@ class ManagementUIHandlerTests : public TestingBaseClass {
TestConfig& GetTestConfig() { return setup_config_; } TestConfig& GetTestConfig() { return setup_config_; }
#if defined(OS_CHROMEOS)
void OnFatalError() { DCHECK(false); }
std::unique_ptr<policy::UserCloudPolicyManagerChromeOS>
BuildCloudPolicyManager() {
auto store = std::make_unique<policy::MockCloudPolicyStore>();
EXPECT_CALL(*store, Load()).Times(AnyNumber());
const AccountId account_id = AccountId::FromUserEmailGaiaId(kUser, kGaiaId);
TestingProfile::Builder builder_managed_user;
builder_managed_user.SetProfileName(kUser);
builder_managed_user.OverridePolicyConnectorIsManagedForTesting(true);
auto managed_user = builder_managed_user.Build();
auto data_manager =
std::make_unique<policy::MockCloudExternalDataManager>();
EXPECT_CALL(*data_manager, Disconnect());
return std::make_unique<policy::UserCloudPolicyManagerChromeOS>(
managed_user.get(), std::move(store), std::move(data_manager),
base::FilePath() /* component_policy_cache_path */,
policy::UserCloudPolicyManagerChromeOS::PolicyEnforcement::
kPolicyRequired,
base::TimeDelta::FromMinutes(1) /* policy_refresh_timeout */,
base::BindOnce(&ManagementUIHandlerTests::OnFatalError,
base::Unretained(this)),
account_id, task_runner_);
}
#else
std::unique_ptr<policy::UserCloudPolicyManager> BuildCloudPolicyManager() {
auto store = std::make_unique<policy::MockUserCloudPolicyStore>();
EXPECT_CALL(*store, Load()).Times(AnyNumber());
return std::make_unique<policy::UserCloudPolicyManager>(
std::move(store), base::FilePath(),
/*cloud_external_data_manager=*/nullptr,
base::ThreadTaskRunnerHandle::Get(),
network::TestNetworkConnectionTracker::CreateGetter());
}
#endif // defined(OS_CHROMEOS)
protected: protected:
TestConfig setup_config_; TestConfig setup_config_;
TestManagementUIHandler handler_; TestManagementUIHandler handler_;
...@@ -1204,3 +1269,61 @@ TEST_F(ManagementUIHandlerTests, ThreatReportingInfo) { ...@@ -1204,3 +1269,61 @@ TEST_F(ManagementUIHandlerTests, ThreatReportingInfo) {
EXPECT_EQ(expected_info, *threat_protection_info->FindListKey("info")); EXPECT_EQ(expected_info, *threat_protection_info->FindListKey("info"));
} }
TEST_F(ManagementUIHandlerTests, GetAccountDomain) {
TestingProfile::Builder builder_unmanaged_user;
builder_unmanaged_user.SetProfileName(kUser);
builder_unmanaged_user.OverridePolicyConnectorIsManagedForTesting(false);
auto unmanaged_user = builder_unmanaged_user.Build();
EXPECT_EQ("", handler_.GetAccountDomain(unmanaged_user.get()));
TestingProfile::Builder builder_managed_user;
builder_managed_user.SetProfileName(kUser);
builder_managed_user.OverridePolicyConnectorIsManagedForTesting(true);
auto managed_user = builder_managed_user.Build();
EXPECT_EQ(kDomain, handler_.GetAccountDomain(managed_user.get()));
}
TEST_F(ManagementUIHandlerTests, GetAccountManager) {
TestingProfile::Builder builder_managed_user;
builder_managed_user.SetProfileName(kUser);
builder_managed_user.OverridePolicyConnectorIsManagedForTesting(true);
#if defined(OS_CHROMEOS)
TestingBrowserProcess::GetGlobal()->SetLocalState(nullptr);
std::unique_ptr<TestingProfileManager> profile_manager =
std::make_unique<TestingProfileManager>(
TestingBrowserProcess::GetGlobal());
ASSERT_TRUE(profile_manager->SetUp());
builder_managed_user.SetUserCloudPolicyManagerChromeOS(
BuildCloudPolicyManager());
#else
builder_managed_user.SetUserCloudPolicyManager(BuildCloudPolicyManager());
#endif
auto managed_user = builder_managed_user.Build();
#if defined(OS_CHROMEOS)
policy::UserCloudPolicyManagerChromeOS* policy_manager =
managed_user->GetUserCloudPolicyManagerChromeOS();
policy::MockCloudPolicyStore* mock_store =
static_cast<policy::MockCloudPolicyStore*>(
policy_manager->core()->store());
#else
policy::UserCloudPolicyManager* policy_manager =
managed_user->GetUserCloudPolicyManager();
policy::MockUserCloudPolicyStore* mock_store =
static_cast<policy::MockUserCloudPolicyStore*>(
policy_manager->core()->store());
#endif
DCHECK(mock_store);
mock_store->policy_ = std::make_unique<enterprise_management::PolicyData>();
// If no managed_by, then just calculate the domain from the user.
EXPECT_FALSE(mock_store->policy_->has_managed_by());
EXPECT_EQ(kDomain, handler_.GetAccountManager(managed_user.get()));
// If managed_by is set, then use that value.
mock_store->policy_->set_managed_by(kManager);
EXPECT_EQ(kManager, handler_.GetAccountManager(managed_user.get()));
}
...@@ -129,6 +129,7 @@ ...@@ -129,6 +129,7 @@
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/arc/session/arc_service_launcher.h" #include "chrome/browser/chromeos/arc/session/arc_service_launcher.h"
#include "chrome/browser/chromeos/net/delay_network_call.h" #include "chrome/browser/chromeos/net/delay_network_call.h"
#include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h"
#include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chromeos/components/account_manager/account_manager.h" #include "chromeos/components/account_manager/account_manager.h"
#include "chromeos/components/account_manager/account_manager_factory.h" #include "chromeos/components/account_manager/account_manager_factory.h"
...@@ -230,7 +231,11 @@ TestingProfile::TestingProfile( ...@@ -230,7 +231,11 @@ TestingProfile::TestingProfile(
bool allows_browser_windows, bool allows_browser_windows,
base::Optional<bool> is_new_profile, base::Optional<bool> is_new_profile,
const std::string& supervised_user_id, const std::string& supervised_user_id,
#if defined(OS_CHROMEOS)
std::unique_ptr<policy::UserCloudPolicyManagerChromeOS> policy_manager,
#else
std::unique_ptr<policy::UserCloudPolicyManager> policy_manager, std::unique_ptr<policy::UserCloudPolicyManager> policy_manager,
#endif // defined(OS_CHROMEOS)
std::unique_ptr<policy::PolicyService> policy_service, std::unique_ptr<policy::PolicyService> policy_service,
TestingFactories testing_factories, TestingFactories testing_factories,
const std::string& profile_name, const std::string& profile_name,
...@@ -832,7 +837,7 @@ TestingProfile::GetPolicySchemaRegistryService() { ...@@ -832,7 +837,7 @@ TestingProfile::GetPolicySchemaRegistryService() {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
policy::UserCloudPolicyManagerChromeOS* policy::UserCloudPolicyManagerChromeOS*
TestingProfile::GetUserCloudPolicyManagerChromeOS() { TestingProfile::GetUserCloudPolicyManagerChromeOS() {
return nullptr; return user_cloud_policy_manager_.get();
} }
policy::ActiveDirectoryPolicyManager* policy::ActiveDirectoryPolicyManager*
...@@ -1022,10 +1027,18 @@ void TestingProfile::Builder::SetSupervisedUserId( ...@@ -1022,10 +1027,18 @@ void TestingProfile::Builder::SetSupervisedUserId(
supervised_user_id_ = supervised_user_id; supervised_user_id_ = supervised_user_id;
} }
#if defined(OS_CHROMEOS)
void TestingProfile::Builder::SetUserCloudPolicyManagerChromeOS(
std::unique_ptr<policy::UserCloudPolicyManagerChromeOS>
user_cloud_policy_manager) {
user_cloud_policy_manager_ = std::move(user_cloud_policy_manager);
}
#else
void TestingProfile::Builder::SetUserCloudPolicyManager( void TestingProfile::Builder::SetUserCloudPolicyManager(
std::unique_ptr<policy::UserCloudPolicyManager> user_cloud_policy_manager) { std::unique_ptr<policy::UserCloudPolicyManager> user_cloud_policy_manager) {
user_cloud_policy_manager_ = std::move(user_cloud_policy_manager); user_cloud_policy_manager_ = std::move(user_cloud_policy_manager);
} }
#endif
void TestingProfile::Builder::SetPolicyService( void TestingProfile::Builder::SetPolicyService(
std::unique_ptr<policy::PolicyService> policy_service) { std::unique_ptr<policy::PolicyService> policy_service) {
......
...@@ -54,7 +54,11 @@ namespace policy { ...@@ -54,7 +54,11 @@ namespace policy {
class PolicyService; class PolicyService;
class ProfilePolicyConnector; class ProfilePolicyConnector;
class SchemaRegistryService; class SchemaRegistryService;
#if defined(OS_CHROMEOS)
class UserCloudPolicyManagerChromeOS;
#else
class UserCloudPolicyManager; class UserCloudPolicyManager;
#endif // defined(OS_CHROMEOS)
} // namespace policy } // namespace policy
namespace storage { namespace storage {
...@@ -139,9 +143,15 @@ class TestingProfile : public Profile { ...@@ -139,9 +143,15 @@ class TestingProfile : public Profile {
// a non-empty string, the profile is supervised. // a non-empty string, the profile is supervised.
void SetSupervisedUserId(const std::string& supervised_user_id); void SetSupervisedUserId(const std::string& supervised_user_id);
#if defined(OS_CHROMEOS)
void SetUserCloudPolicyManagerChromeOS(
std::unique_ptr<policy::UserCloudPolicyManagerChromeOS>
user_cloud_policy_manager);
#else
void SetUserCloudPolicyManager( void SetUserCloudPolicyManager(
std::unique_ptr<policy::UserCloudPolicyManager> std::unique_ptr<policy::UserCloudPolicyManager>
user_cloud_policy_manager); user_cloud_policy_manager);
#endif // defined(OS_CHROMEOS)
// Sets the PolicyService to be used by this profile. // Sets the PolicyService to be used by this profile.
void SetPolicyService( void SetPolicyService(
...@@ -178,7 +188,12 @@ class TestingProfile : public Profile { ...@@ -178,7 +188,12 @@ class TestingProfile : public Profile {
bool allows_browser_windows_; bool allows_browser_windows_;
base::Optional<bool> is_new_profile_; base::Optional<bool> is_new_profile_;
std::string supervised_user_id_; std::string supervised_user_id_;
#if defined(OS_CHROMEOS)
std::unique_ptr<policy::UserCloudPolicyManagerChromeOS>
user_cloud_policy_manager_;
#else
std::unique_ptr<policy::UserCloudPolicyManager> user_cloud_policy_manager_; std::unique_ptr<policy::UserCloudPolicyManager> user_cloud_policy_manager_;
#endif
std::unique_ptr<policy::PolicyService> policy_service_; std::unique_ptr<policy::PolicyService> policy_service_;
TestingFactories testing_factories_; TestingFactories testing_factories_;
std::string profile_name_; std::string profile_name_;
...@@ -200,23 +215,28 @@ class TestingProfile : public Profile { ...@@ -200,23 +215,28 @@ class TestingProfile : public Profile {
// Full constructor allowing the setting of all possible instance data. // Full constructor allowing the setting of all possible instance data.
// Callers should use Builder::Build() instead of invoking this constructor. // Callers should use Builder::Build() instead of invoking this constructor.
TestingProfile(const base::FilePath& path, TestingProfile(
Delegate* delegate, const base::FilePath& path,
Delegate* delegate,
#if BUILDFLAG(ENABLE_EXTENSIONS) #if BUILDFLAG(ENABLE_EXTENSIONS)
scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy, scoped_refptr<ExtensionSpecialStoragePolicy> extension_policy,
#endif #endif
std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs, std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs,
TestingProfile* parent, TestingProfile* parent,
bool guest_session, bool guest_session,
bool allows_browser_windows, bool allows_browser_windows,
base::Optional<bool> is_new_profile, base::Optional<bool> is_new_profile,
const std::string& supervised_user_id, const std::string& supervised_user_id,
std::unique_ptr<policy::UserCloudPolicyManager> policy_manager, #if defined(OS_CHROMEOS)
std::unique_ptr<policy::PolicyService> policy_service, std::unique_ptr<policy::UserCloudPolicyManagerChromeOS> policy_manager,
TestingFactories testing_factories, #else
const std::string& profile_name, std::unique_ptr<policy::UserCloudPolicyManager> policy_manager,
base::Optional<bool> override_policy_connector_is_managed, #endif // defined(OS_CHROMEOS)
base::Optional<OTRProfileID> otr_profile_id); std::unique_ptr<policy::PolicyService> policy_service,
TestingFactories testing_factories,
const std::string& profile_name,
base::Optional<bool> override_policy_connector_is_managed,
base::Optional<OTRProfileID> otr_profile_id);
~TestingProfile() override; ~TestingProfile() override;
...@@ -459,7 +479,12 @@ class TestingProfile : public Profile { ...@@ -459,7 +479,12 @@ class TestingProfile : public Profile {
content::MockResourceContext* resource_context_; content::MockResourceContext* resource_context_;
std::unique_ptr<policy::SchemaRegistryService> schema_registry_service_; std::unique_ptr<policy::SchemaRegistryService> schema_registry_service_;
#if defined(OS_CHROMEOS)
std::unique_ptr<policy::UserCloudPolicyManagerChromeOS>
user_cloud_policy_manager_;
#else
std::unique_ptr<policy::UserCloudPolicyManager> user_cloud_policy_manager_; std::unique_ptr<policy::UserCloudPolicyManager> user_cloud_policy_manager_;
#endif // defined(OS_CHROMEOS)
std::unique_ptr<policy::ProfilePolicyConnector> profile_policy_connector_; std::unique_ptr<policy::ProfilePolicyConnector> profile_policy_connector_;
// Weak pointer to a delegate for indicating that a profile was created. // Weak pointer to a delegate for indicating that a profile was created.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment