1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_OMNIBOX_BROWSER_HISTORY_PROVIDER_H_
6 #define COMPONENTS_OMNIBOX_BROWSER_HISTORY_PROVIDER_H_
8 #include "base/compiler_specific.h"
9 #include "components/omnibox/browser/autocomplete_provider.h"
10 #include "components/omnibox/browser/autocomplete_provider_client.h"
11 #include "components/omnibox/browser/in_memory_url_index_types.h"
13 class AutocompleteInput
;
15 struct AutocompleteMatch
;
17 // This class is a base class for the history autocomplete providers and
18 // provides functions useful to all derived classes.
19 class HistoryProvider
: public AutocompleteProvider
{
21 void DeleteMatch(const AutocompleteMatch
& match
) override
;
23 // Returns true if inline autocompletion should be prevented for URL-like
24 // input. This method returns true if input.prevent_inline_autocomplete()
25 // is true or the input text contains trailing whitespace.
26 static bool PreventInlineAutocomplete(const AutocompleteInput
& input
);
29 HistoryProvider(AutocompleteProvider::Type type
,
30 AutocompleteProviderClient
* client
);
32 ~HistoryProvider() override
;
34 // Finds and removes the match from the current collection of matches and
36 void DeleteMatchFromMatches(const AutocompleteMatch
& match
);
38 // Fill and return an ACMatchClassifications structure given the |matches|
40 static ACMatchClassifications
SpansFromTermMatch(const TermMatches
& matches
,
44 AutocompleteProviderClient
* client() { return client_
; }
47 AutocompleteProviderClient
* client_
;
49 DISALLOW_COPY_AND_ASSIGN(HistoryProvider
);
52 #endif // COMPONENTS_OMNIBOX_BROWSER_HISTORY_PROVIDER_H_