Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / components / omnibox / browser / history_provider.h
bloba64b0a6f7e7c219bb14da9e9201483a05a17407b
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;
14 class Profile;
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 {
20 public:
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);
28 protected:
29 HistoryProvider(AutocompleteProvider::Type type,
30 AutocompleteProviderClient* client);
32 ~HistoryProvider() override;
34 // Finds and removes the match from the current collection of matches and
35 // backing data.
36 void DeleteMatchFromMatches(const AutocompleteMatch& match);
38 // Fill and return an ACMatchClassifications structure given the |matches|
39 // to highlight.
40 static ACMatchClassifications SpansFromTermMatch(const TermMatches& matches,
41 size_t text_length,
42 bool is_url);
44 AutocompleteProviderClient* client() { return client_; }
46 private:
47 AutocompleteProviderClient* client_;
49 DISALLOW_COPY_AND_ASSIGN(HistoryProvider);
52 #endif // COMPONENTS_OMNIBOX_BROWSER_HISTORY_PROVIDER_H_