• Cliff Smolinsky's avatar
    Add support for detecting metered networks on Windows. · 81edb9c6
    Cliff Smolinsky authored
    This change adds GetConnectionCost() to the NetworkChangeNotifier class.
    The structure is modeled after the existing functions of the class. The
    base class implements a basic best-effort guess that works on platforms
    that can detect cellular versus non-cellular types, which is essentially
    the same as how "metered" network checks exist today.
    
    This change updates the NetworkChangeNotifierWin class to retrieve the
    metered network status and register for updates from the OS. It also
    creates an Observer class similar to the other existing ones to notify
    other components when it changes.
    
    It's important to note that NetworkChangeNotifierWin will only register
    for updates from the OS once an Observer is connected. If there is no
    observer connected and someone asks for the current connection cost it
    will be retrieved from the OS at that time rather than using the cached
    value.
    
    Bug: 1143428
    Change-Id: I6f03ae91869087c6ad72a7f5891df158815137d7
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2542047Reviewed-by: default avatarPaul Jensen <pauljensen@chromium.org>
    Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
    Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
    Commit-Queue: Cliff Smolinsky <cliffsmo@microsoft.com>
    Cr-Commit-Position: refs/heads/master@{#844383}
    81edb9c6
mock_network_change_notifier.cc 4.28 KB