Commit 2d788490 authored by Dmitry Gozman's avatar Dmitry Gozman Committed by Chromium LUCI CQ

[headless] Configure renderer preferences from system settings

This is similar to what chrome/browser/renderer_preferences_util does.

Bug: none
Change-Id: I1b0b73dca22175446c143497a07c1ad2994e72e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2637081
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845043}
parent cf9445b2
......@@ -10,6 +10,7 @@
#include <vector>
#include "base/bind.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/stl_util.h"
......@@ -17,6 +18,7 @@
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
#include "base/values.h"
#include "build/build_config.h"
#include "components/security_state/content/content_utils.h"
#include "components/security_state/core/security_state.h"
#include "content/public/browser/browser_thread.h"
......@@ -29,6 +31,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/renderer_preferences_util.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/common/bindings_policy.h"
......@@ -42,6 +45,8 @@
#include "printing/buildflags/buildflags.h"
#include "third_party/blink/public/common/renderer_preferences/renderer_preferences.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/ui_base_features.h"
#include "ui/compositor/compositor.h"
#include "ui/gfx/switches.h"
......@@ -51,6 +56,28 @@
namespace headless {
namespace {
void UpdatePrefsFromSystemSettings(blink::RendererPreferences* prefs) {
#if defined(OS_LINUX) || defined(OS_WIN)
content::UpdateFontRendererPreferencesFromSystemSettings(prefs);
#endif
// The values were copied from chrome/browser/renderer_preferences_util.cc.
#if defined(USE_AURA)
prefs->focus_ring_color = SkColorSetRGB(0x4D, 0x90, 0xFE);
#endif
if (::features::IsFormControlsRefreshEnabled()) {
#if defined(OS_MAC)
prefs->focus_ring_color = SkColorSetRGB(0x00, 0x5F, 0xCC);
#else
prefs->focus_ring_color = SkColorSetRGB(0x10, 0x10, 0x10);
#endif
}
}
} // namespace
// static
HeadlessWebContentsImpl* HeadlessWebContentsImpl::From(
HeadlessWebContents* web_contents) {
......@@ -302,6 +329,7 @@ HeadlessWebContentsImpl::HeadlessWebContentsImpl(
HeadlessPrintManager::CreateForWebContents(web_contents_.get());
// TODO(weili): Add support for printing OOPIFs.
#endif
UpdatePrefsFromSystemSettings(web_contents_->GetMutableRendererPrefs());
web_contents_->GetMutableRendererPrefs()->accept_languages =
browser_context->options()->accept_language();
web_contents_->GetMutableRendererPrefs()->hinting =
......
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