• Fixes theme swtiching.

    mkarolin committed Aug 27, 2019
    Theme switching broke due to the introduction of "preferred color
    scheme" into native theme. See Chromium change below.
    
    On top of SetDarkMode that we already were doing, added
    SetPreferredColorScheme that sets preferred color scheme to our
    selection.
    
    Also, had to patch ChromeContentBrowserClient to catch switching
    preferred color in web prefs when the system color is switched. That
    gets triggered by the system color change, for example via control panel
    on Windows. The Windows specific implementation watches a registry value
    and updates preferred color scheme in the native theme. Would be great
    to intercept it there, but in that layer we don't have access to our
    setting stored in profile prefs, from what I can tell. Hence, the patch
    to ChromeContentBrowserClient where the setting is used. Ugly.
    cc: @simonhong perhaps you have better ideas?
    
    Chromium change:
    
    https://chromium.googlesource.com/chromium/src/+/67fd4d9f35650a079f6a636b5d19de77856bd2cf
    
    commit 67fd4d9f35650a079f6a636b5d19de77856bd2cf
    Author: Alison Maher <almaher@microsoft.com>
    Date:   Fri Jul 12 18:34:21 2019 +0000
    
        Set preferred color scheme for high contrast
    
        This change adds logic to update the preferred color scheme based on
        the OS high contrast theme. If high contrast is not enabled, preferred
        color scheme will continue to be based on the OS dark mode state.
    
        A PreferredColorScheme enum was added to NativeTheme to keep track
        of the current high contrast/dark mode preferred color scheme.
    
        The updated preferred color scheme is used to evaluate the
        prefers-color-scheme media query.
    
        Bug: 970285