Page 1 of 1

Delegating CreatePlatformProvider() to a CEF app

PostPosted: Sun Jun 06, 2021 2:51 am
by hunterlaux
For the chrome runtime, it would be neat if there could be a hook to override the behavior of ChromeBrowserPolicyConnector::CreatePlatformProvider(), so that platform policies can be easily specified from within the app. This would give control to almost all those juicy chrome policies that an app might depend upon and ensuring that it doesn't conflict with other copies of apps that may be installed on the system.

Re: Delegating CreatePlatformProvider() to a CEF app

PostPosted: Sun Jun 06, 2021 12:11 pm
by magreenblatt
Do you have a particular API in mind?

Re: Delegating CreatePlatformProvider() to a CEF app

PostPosted: Sun Jun 06, 2021 6:51 pm
by hunterlaux
CEF uses command line options for most configurations. The CommandLinePolicyProvider is consistent with that philosophy.

Just spitballing here...
Code: Select all
std::vector<std::unique_ptr<policy::ConfigurationPolicyProvider>>
ChromeBrowserPolicyConnector::CreatePolicyProviders() {
  auto providers = BrowserPolicyConnector::CreatePolicyProviders();
+ if (cef::IsChromeRuntimeEnabled())
+ {
+   std::unique_ptr<CommandLinePolicyProvider> command_line_provider =
+   CommandLinePolicyProvider::CreateForTesting(
+     base::CommandLine::ForCurrentProcess());
+   );
+   command_line_provider_ = command_line_provider.get();
+   providers.push_back(std::move(command_line_provider));
+   return providers;
+ }
  std::unique_ptr<ConfigurationPolicyProvider> platform_provider =
      CreatePlatformProvider();
...