• Tommy Li's avatar
    [omnibox] ZeroSuggestProvider::TypeOfResultToRun w/ AutocompleteInput · 26a9f582
    Tommy Li authored
    This CL refactors ZeroSuggestProvider::TypeOfResultToRun to take an
    AutocompleteInput as a parameter instead of just the current page URL.
    
    We need this because differentiating the on-focus vs. on-clobber
    ZeroSuggest modes requires access to AutocompleteInput::focus_type().
    
    This CL also makes the method 'static', for three reasons:
    
     1. The function is more easily testable when it only depends on its
        parameters, rather than any state in the member variables.
    
     2. The member variables store data that's also in the |input|
        parameter, and I didn't want to introduce ambiguity as to which
        is used.
    
     3. We plan to split MostVisited into its own provider, and we will
        want to share some logic from TypeOfResultToRun. Making this
        method static is a step towards that future.
    
    For reviewability, this CL actually has no functional changes, and
    just moves things around.
    
    The followup CL will actually add the on-clobber vs. on-focus logic to
    TypeOfResultToRun.
    
    Bug: 1106096
    Change-Id: I69c8f2f08a182796be9ce1c66611fe6788a6158a
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2360562Reviewed-by: default avatarTomasz Wiszkowski <ender@google.com>
    Commit-Queue: Tommy Li <tommycli@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#799394}
    26a9f582
zero_suggest_provider.cc 30.2 KB