Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | |
| 9 #include "chrome/browser/autocomplete/autocomplete.h" | 10 #include "chrome/browser/autocomplete/autocomplete.h" |
| 10 #include "chrome/browser/autocomplete/history_provider_util.h" | |
| 11 | 11 |
| 12 namespace history { | 12 namespace history { |
| 13 | 13 |
| 14 class HistoryBackend; | 14 class HistoryBackend; |
| 15 class URLDatabase; | 15 class URLDatabase; |
| 16 class URLRow; | 16 class URLRow; |
| 17 | 17 |
| 18 } // namespace history | 18 } // namespace history |
| 19 | 19 |
| 20 // This class is a base class for the history autocomplete providers and | 20 // This class is a base class for the history autocomplete providers and |
| 21 // provides functions useful to all derived classes. | 21 // provides functions useful to all derived classes. |
| 22 class HistoryProvider : public AutocompleteProvider { | 22 class HistoryProvider : public AutocompleteProvider { |
| 23 protected: | 23 protected: |
| 24 enum MatchType { | 24 enum MatchType { |
| 25 NORMAL, | 25 NORMAL, |
| 26 WHAT_YOU_TYPED, | 26 WHAT_YOU_TYPED, |
| 27 INLINE_AUTOCOMPLETE | 27 INLINE_AUTOCOMPLETE |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 HistoryProvider(ACProviderListener* listener, | 30 HistoryProvider(ACProviderListener* listener, |
| 31 Profile* profile, | 31 Profile* profile, |
| 32 const char* name); | 32 const char* name); |
| 33 | 33 |
| 34 virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; | |
|
Peter Kasting
2010/12/17 19:32:01
This causes the HistoryQuickProvider to inherit th
| |
| 35 | |
| 34 // Fixes up user URL input to make it more possible to match against. Among | 36 // Fixes up user URL input to make it more possible to match against. Among |
| 35 // many other things, this takes care of the following: | 37 // many other things, this takes care of the following: |
| 36 // * Prepending file:// to file URLs | 38 // * Prepending file:// to file URLs |
| 37 // * Converting drive letters in file URLs to uppercase | 39 // * Converting drive letters in file URLs to uppercase |
| 38 // * Converting case-insensitive parts of URLs (like the scheme and domain) | 40 // * Converting case-insensitive parts of URLs (like the scheme and domain) |
| 39 // to lowercase | 41 // to lowercase |
| 40 // * Convert spaces to %20s | 42 // * Convert spaces to %20s |
| 41 // Note that we don't do this in AutocompleteInput's constructor, because if | 43 // Note that we don't do this in AutocompleteInput's constructor, because if |
| 42 // e.g. we convert a Unicode hostname to punycode, other providers will show | 44 // e.g. we convert a Unicode hostname to punycode, other providers will show |
| 43 // output that surprises the user ("Search Google for xn--6ca.com"). | 45 // output that surprises the user ("Search Google for xn--6ca.com"). |
| 44 static std::wstring FixupUserInput(const AutocompleteInput& input); | 46 static std::wstring FixupUserInput(const AutocompleteInput& input); |
| 45 | 47 |
| 46 // Trims "http:" and up to two subsequent slashes from |url|. Returns the | 48 // Trims "http:" and up to two subsequent slashes from |url|. Returns the |
| 47 // number of characters that were trimmed. | 49 // number of characters that were trimmed. |
| 48 // NOTE: For a view-source: URL, this will trim from after "view-source:" and | 50 // NOTE: For a view-source: URL, this will trim from after "view-source:" and |
| 49 // return 0. | 51 // return 0. |
| 50 static size_t TrimHttpPrefix(std::wstring* url); | 52 static size_t TrimHttpPrefix(std::wstring* url); |
| 51 }; | 53 }; |
| 52 | 54 |
| 53 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_ | 55 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_ |
| OLD | NEW |