Set preferred color scheme based on NativeTheme.

Listen to dark mode native theme changes in WebContentsImpl to pass the
preferred color scheme to the renderer and into Blink. The preferred
color scheme is used to evaluate the preferred-color-scheme[1] media
feature and will be used as the base for computing a used color-scheme
for the proposed color-scheme[1] property in CSS.

The DarkModeObserver was moved to ui/native-theme to make it available
to WebContentsImpl.


Bug: 889087
Change-Id: I2f58664d1ac75bee4ba59258cb867e698cfd508e
Commit-Queue: Rune Lillesveen <>
Reviewed-by: Kinuko Yasuda <>
Reviewed-by: Peter Kasting <>
Reviewed-by: Leonard Grey <>
Cr-Commit-Position: refs/heads/master@{#653694}
5 files changed