Move Webstore URL concepts to //extensions and out
[chromium-blink-merge.git] / chrome / browser / autocomplete / history_provider.h
blobf06d5079123b527f257805d64862009c69857498
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 CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_
8 #include "base/compiler_specific.h"
9 #include "chrome/browser/history/in_memory_url_index_types.h"
10 #include "components/omnibox/autocomplete_provider.h"
12 class AutocompleteInput;
13 class Profile;
14 struct AutocompleteMatch;
16 // This class is a base class for the history autocomplete providers and
17 // provides functions useful to all derived classes.
18 class HistoryProvider : public AutocompleteProvider {
19 public:
20 virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE;
22 // Returns true if inline autocompletion should be prevented for URL-like
23 // input. This method returns true if input.prevent_inline_autocomplete()
24 // is true or the input text contains trailing whitespace.
25 static bool PreventInlineAutocomplete(const AutocompleteInput& input);
27 protected:
28 HistoryProvider(Profile* profile, AutocompleteProvider::Type type);
29 virtual ~HistoryProvider();
31 // Finds and removes the match from the current collection of matches and
32 // backing data.
33 void DeleteMatchFromMatches(const AutocompleteMatch& match);
35 // Fill and return an ACMatchClassifications structure given the |matches|
36 // to highlight.
37 static ACMatchClassifications SpansFromTermMatch(
38 const history::TermMatches& matches,
39 size_t text_length,
40 bool is_url);
42 Profile* profile_;
45 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_