OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/compiler_specific.h" |
10 #include "chrome/browser/autocomplete/autocomplete.h" | 10 #include "chrome/browser/autocomplete/autocomplete.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 // Fixes up user URL input to make it more possible to match against. Among | 37 // Fixes up user URL input to make it more possible to match against. Among |
38 // many other things, this takes care of the following: | 38 // many other things, this takes care of the following: |
39 // * Prepending file:// to file URLs | 39 // * Prepending file:// to file URLs |
40 // * Converting drive letters in file URLs to uppercase | 40 // * Converting drive letters in file URLs to uppercase |
41 // * Converting case-insensitive parts of URLs (like the scheme and domain) | 41 // * Converting case-insensitive parts of URLs (like the scheme and domain) |
42 // to lowercase | 42 // to lowercase |
43 // * Convert spaces to %20s | 43 // * Convert spaces to %20s |
44 // Note that we don't do this in AutocompleteInput's constructor, because if | 44 // Note that we don't do this in AutocompleteInput's constructor, because if |
45 // e.g. we convert a Unicode hostname to punycode, other providers will show | 45 // e.g. we convert a Unicode hostname to punycode, other providers will show |
46 // output that surprises the user ("Search Google for xn--6ca.com"). | 46 // output that surprises the user ("Search Google for xn--6ca.com"). |
47 static string16 FixupUserInput(const AutocompleteInput& input); | 47 // Returns false if the fixup attempt resulted in an empty string (which |
| 48 // providers generally can't do anything with). |
| 49 static bool FixupUserInput(AutocompleteInput* input); |
48 | 50 |
49 // Trims "http:" and up to two subsequent slashes from |url|. Returns the | 51 // Trims "http:" and up to two subsequent slashes from |url|. Returns the |
50 // number of characters that were trimmed. | 52 // number of characters that were trimmed. |
51 // NOTE: For a view-source: URL, this will trim from after "view-source:" and | 53 // NOTE: For a view-source: URL, this will trim from after "view-source:" and |
52 // return 0. | 54 // return 0. |
53 static size_t TrimHttpPrefix(string16* url); | 55 static size_t TrimHttpPrefix(string16* url); |
54 | 56 |
55 // Returns true if inline autocompletion should be prevented. Use this instead | 57 // Returns true if inline autocompletion should be prevented. Use this instead |
56 // of |input.prevent_inline_autocomplete| if the input is passed through | 58 // of |input.prevent_inline_autocomplete| if the input is passed through |
57 // FixupUserInput(). This method returns true if | 59 // FixupUserInput(). This method returns true if |
58 // |input.prevent_inline_autocomplete()| is true, or the input text contains | 60 // |input.prevent_inline_autocomplete()| is true, or the input text contains |
59 // trailing whitespace. | 61 // trailing whitespace. |
60 bool PreventInlineAutocomplete(const AutocompleteInput& input); | 62 bool PreventInlineAutocomplete(const AutocompleteInput& input); |
61 }; | 63 }; |
62 | 64 |
63 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_ | 65 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_ |
OLD | NEW |