mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
chrome: Support configuration of Chrome policy management (fixes #3581)
Disable Chrome policy management by default. Add CefSettings.chrome_policy_id which, when configured, enables Chrome policy management. See https://support.google.com/chrome/a/answer/9037717 for background. To test: - Start with a machine where Google Chrome is managed. - Run `cefclient --enable-chrome-runtime --url=chrome://policy/` There should be no configured policies. - Run `cefclient --enable-chrome-runtime --url=chrome://policy/ --enable-chrome-policy` Configured Platform properties should match Google Chrome. - Run `cefclient --enable-chrome-runtime --url=chrome://policy/ --enable-chrome-policy --enable-chrome-browser-cloud-management` Configured Platform and Cloud properties should match Google Chrome.
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/threading/threading_features.h"
|
||||
#include "chrome/browser/metrics/chrome_feature_list_creator.h"
|
||||
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "components/embedder_support/switches.h"
|
||||
@@ -208,6 +209,13 @@ absl::optional<int> ChromeMainDelegateCef::PreBrowserMain() {
|
||||
|
||||
absl::optional<int> ChromeMainDelegateCef::PostEarlyInitialization(
|
||||
InvokedIn invoked_in) {
|
||||
// Configure this before ChromeMainDelegate::PostEarlyInitialization triggers
|
||||
// ChromeBrowserPolicyConnector creation.
|
||||
if (settings_ && settings_->chrome_policy_id.length > 0) {
|
||||
policy::ChromeBrowserPolicyConnector::EnablePlatformPolicySupport(
|
||||
CefString(&settings_->chrome_policy_id).ToString());
|
||||
}
|
||||
|
||||
const auto result = ChromeMainDelegate::PostEarlyInitialization(invoked_in);
|
||||
if (!result) {
|
||||
const auto* invoked_in_browser =
|
||||
@@ -343,4 +351,4 @@ ChromeContentRendererClientCef* ChromeMainDelegateCef::content_renderer_client()
|
||||
return nullptr;
|
||||
}
|
||||
return g_chrome_content_renderer_client.Pointer();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user