• Dan Beam's avatar
    WebUI Dark Mode: fix hole w/ "force light mode" code · d501b02a
    Dan Beam authored
    WebContents::GetURL() wasn't the right place to query a URL
    from when checking whether to override the webkit pref sent
    to the RenderViewHost when creating a renderer.
    
    Instead, use rvh->GetSiteInstance()->GetSiteUrl(), which is
    correct at the time we need to query.
    
    The reason for this code is to ensure that:
    
      @media (prefers-color-scheme: dark) {
        /* bunch of dark mode styles go here */
      }
    
    Does not apply as we have code shared across different
    platforms (i.e. Linux, Windows, Mac, ChromeOS, etc.).
    Only Mac & Windows currently support dark mode (and hence,
    are the only platforms in which all the web UI has been
    audited and/or updated). So in order to change shared code
    that also runs on Linux/CrOS, we put both light/dark style
    into the CSS, but disallow the dark styles from running
    on non-dark-mode-enabled-platforms (Linux, CrOS).
    
    Bug: 1007892
    Fixed: 1007892
    Change-Id: I1076e48eaa160a23213e6873f1d857cf54935f42
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1825936Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
    Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
    Commit-Queue: Dan Beam <dbeam@chromium.org>
    Auto-Submit: Dan Beam <dbeam@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#702693}
    d501b02a
chrome_content_browser_client.cc 222 KB