Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/browser/autocomplete/history_provider.h

Issue 108643003: Omnibox: Bug Fixes for Shortcuts Inlining (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: new fixup strategy Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/autocomplete/history_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 protected:
22 HistoryProvider(AutocompleteProviderListener* listener,
23 Profile* profile,
24 AutocompleteProvider::Type type);
25 virtual ~HistoryProvider();
26
27 // Finds and removes the match from the current collection of matches and
28 // backing data.
29 void DeleteMatchFromMatches(const AutocompleteMatch& match);
30
31 // Fixes up user URL input to make it more possible to match against. Among 21 // Fixes up user URL input to make it more possible to match against. Among
32 // many other things, this takes care of the following: 22 // many other things, this takes care of the following:
33 // * Prepending file:// to file URLs 23 // * Prepending file:// to file URLs
34 // * Converting drive letters in file URLs to uppercase 24 // * Converting drive letters in file URLs to uppercase
35 // * Converting case-insensitive parts of URLs (like the scheme and domain) 25 // * Converting case-insensitive parts of URLs (like the scheme and domain)
36 // to lowercase 26 // to lowercase
37 // * Convert spaces to %20s 27 // * Convert spaces to %20s
38 // Note that we don't do this in AutocompleteInput's constructor, because if 28 // Note that we don't do this in AutocompleteInput's constructor, because if
39 // e.g. we convert a Unicode hostname to punycode, other providers will show 29 // e.g. we convert a Unicode hostname to punycode, other providers will show
40 // output that surprises the user ("Search Google for xn--6ca.com"). 30 // output that surprises the user ("Search Google for xn--6ca.com").
41 // Returns false if the fixup attempt resulted in an empty string (which 31 // Returns false if the fixup attempt resulted in an empty string (which
42 // providers generally can't do anything with). 32 // providers generally can't do anything with).
43 static bool FixupUserInput(AutocompleteInput* input); 33 static bool FixupUserInput(AutocompleteInput* input);
Mark P 2013/12/17 22:52:40 This is a simple cut-and-paste of FixupUserInput f
44 34
35 protected:
36 HistoryProvider(AutocompleteProviderListener* listener,
37 Profile* profile,
38 AutocompleteProvider::Type type);
39 virtual ~HistoryProvider();
40
41 // Finds and removes the match from the current collection of matches and
42 // backing data.
43 void DeleteMatchFromMatches(const AutocompleteMatch& match);
44
45 // Trims "http:" and up to two subsequent slashes from |url|. Returns the 45 // Trims "http:" and up to two subsequent slashes from |url|. Returns the
46 // number of characters that were trimmed. 46 // number of characters that were trimmed.
47 // NOTE: For a view-source: URL, this will trim from after "view-source:" and 47 // NOTE: For a view-source: URL, this will trim from after "view-source:" and
48 // return 0. 48 // return 0.
49 static size_t TrimHttpPrefix(base::string16* url); 49 static size_t TrimHttpPrefix(base::string16* url);
50 50
51 // Returns true if inline autocompletion should be prevented. Use this instead 51 // Returns true if inline autocompletion should be prevented. Use this instead
52 // of |input.prevent_inline_autocomplete| if the input is passed through 52 // of |input.prevent_inline_autocomplete| if the input is passed through
53 // FixupUserInput(). This method returns true if 53 // FixupUserInput(). This method returns true if
54 // |input.prevent_inline_autocomplete()| is true or the input text contains 54 // |input.prevent_inline_autocomplete()| is true or the input text contains
55 // trailing whitespace. 55 // trailing whitespace.
56 bool PreventInlineAutocomplete(const AutocompleteInput& input); 56 bool PreventInlineAutocomplete(const AutocompleteInput& input);
57 57
58 // Fill and return an ACMatchClassifications structure given the |matches| 58 // Fill and return an ACMatchClassifications structure given the |matches|
59 // to highlight. 59 // to highlight.
60 static ACMatchClassifications SpansFromTermMatch( 60 static ACMatchClassifications SpansFromTermMatch(
61 const history::TermMatches& matches, 61 const history::TermMatches& matches,
62 size_t text_length, 62 size_t text_length,
63 bool is_url); 63 bool is_url);
64 }; 64 };
65 65
66 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_ 66 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/history_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698