• Peter Collingbourne's avatar
    Use @available and availability in AppController and HandoffManager. · fc74af31
    Peter Collingbourne authored
    An upcoming version of clang removes the ability to suppress
    availability warnings by redeclaring functions. The new way
    to suppress warnings is to either annotate the caller with an
    availability attribute or enclose the function reference in an "if
    (@available)" block.
    
    The functions willContinueUserActivityWithType and continueUserActivity
    are called only by the operating system, so we can use availability
    attributes. The function passURLToHandoffManager, however, may
    be called or overridden from the test suite even before 10.10 (see
    SetUpInProcessBrowserTestFixture in app_controller_mac_browsertest.mm),
    so we need to use a runtime check.
    
    Any references to NSUserActivity must have availability attributes
    because that type was introduced in 10.10. The test-only parts
    of HandoffManager are only used in an iOS-specific test, so for
    simplicity we disable that code under non-iOS.
    
    Bug: 735328
    Change-Id: Ide1dd1cdec9f8a2c286ddd09d6e4ca6da2117e6a
    Reviewed-on: https://chromium-review.googlesource.com/564226
    Commit-Queue: Peter Collingbourne <pcc@chromium.org>
    Reviewed-by: default avatarErik Chen <erikchen@chromium.org>
    Reviewed-by: default avatarNico Weber <thakis@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#485379}
    fc74af31
app_controller_mac.mm 63.8 KB