| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 9 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
| 10 #include "chrome/browser/history/in_memory_url_index_types.h" | 10 #include "chrome/browser/history/in_memory_url_index_types.h" |
| 11 | 11 |
| 12 class AutocompleteInput; | 12 class AutocompleteInput; |
| 13 struct AutocompleteMatch; | 13 struct AutocompleteMatch; |
| 14 | 14 |
| 15 // This class is a base class for the history autocomplete providers and | 15 // This class is a base class for the history autocomplete providers and |
| 16 // provides functions useful to all derived classes. | 16 // provides functions useful to all derived classes. |
| 17 class HistoryProvider : public AutocompleteProvider { | 17 class HistoryProvider : public AutocompleteProvider { |
| 18 public: | 18 public: |
| 19 virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; | 19 virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; |
| 20 | 20 |
| 21 // Returns true if inline autocompletion should be prevented for URL-like |
| 22 // input. This method returns true if input.prevent_inline_autocomplete() |
| 23 // is true or the input text contains trailing whitespace. |
| 24 static bool PreventInlineAutocomplete(const AutocompleteInput& input); |
| 25 |
| 21 protected: | 26 protected: |
| 22 HistoryProvider(AutocompleteProviderListener* listener, | 27 HistoryProvider(AutocompleteProviderListener* listener, |
| 23 Profile* profile, | 28 Profile* profile, |
| 24 AutocompleteProvider::Type type); | 29 AutocompleteProvider::Type type); |
| 25 virtual ~HistoryProvider(); | 30 virtual ~HistoryProvider(); |
| 26 | 31 |
| 27 // Finds and removes the match from the current collection of matches and | 32 // Finds and removes the match from the current collection of matches and |
| 28 // backing data. | 33 // backing data. |
| 29 void DeleteMatchFromMatches(const AutocompleteMatch& match); | 34 void DeleteMatchFromMatches(const AutocompleteMatch& match); |
| 30 | 35 |
| 31 // Returns true if inline autocompletion should be prevented. Use this instead | |
| 32 // of |input.prevent_inline_autocomplete| if the input is passed through | |
| 33 // FixupUserInput(). This method returns true if | |
| 34 // |input.prevent_inline_autocomplete()| is true or the input text contains | |
| 35 // trailing whitespace. | |
| 36 bool PreventInlineAutocomplete(const AutocompleteInput& input); | |
| 37 | |
| 38 // Fill and return an ACMatchClassifications structure given the |matches| | 36 // Fill and return an ACMatchClassifications structure given the |matches| |
| 39 // to highlight. | 37 // to highlight. |
| 40 static ACMatchClassifications SpansFromTermMatch( | 38 static ACMatchClassifications SpansFromTermMatch( |
| 41 const history::TermMatches& matches, | 39 const history::TermMatches& matches, |
| 42 size_t text_length, | 40 size_t text_length, |
| 43 bool is_url); | 41 bool is_url); |
| 44 }; | 42 }; |
| 45 | 43 |
| 46 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_ | 44 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_ |
| OLD | NEW |