• manuk's avatar
    [Omnibox] Move HistoryProvider::SpansFromTermMatch to promote reuse. · b5c52237
    manuk authored
    This is the 3rd refactoring CL aimed at reducing duplication and
    inconsistency for classifying omnibox results. This CL
    
    1) Creates a autocomplete_match_classification file to group static
    classification methods. This organizes related code adjacently, promotes
    code reuse instead of duplicated code per provider, and avoids providers
    calling into other providers' static classification methods.
    
    2) Renames HistoryProvider::SpansFromTermMatch to ClassifyTermMatches
    and moves it to autocomplete_match_classification. It is responsible for
    creating ACMatchClassifications from TermMatches.
    
    3) Previously, SpansFromTermMatches accepted the bool param is_url which
    determined how to style matches and non-matches. To make the method
    reusable by the search provider, which uses reversed styling compared
    to other providers for non-URL text, ClassifyTermMatches is overloaded
    with a more generic signature that parameterizes the match and non-match
    styles.
    
    Bug: 366623
    Change-Id: I60dfb82305f6e81fa00ff86662e63d2f9e24bb99
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1546783
    Commit-Queue: manuk hovanesian <manukh@chromium.org>
    Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#646455}
    b5c52237
history_provider.cc 3.01 KB