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

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

Issue 184663002: Omnibox: Make URLs of Bookmarks Searchable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix ALL_MATCHES (in response to recent changes) Created 6 years, 8 months 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
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_URL_PREFIX_H_ 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_URL_PREFIX_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_URL_PREFIX_H_ 6 #define CHROME_BROWSER_AUTOCOMPLETE_URL_PREFIX_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 21 matching lines...) Expand all
32 const base::string16& prefix_suffix); 32 const base::string16& prefix_suffix);
33 33
34 // A helper function for BestURLPrefix(). Returns true if |text| starts 34 // A helper function for BestURLPrefix(). Returns true if |text| starts
35 // with |prefix| which is then followed by |prefix_suffix|. 35 // with |prefix| which is then followed by |prefix_suffix|.
36 // Performs case insensitive string comparison. 36 // Performs case insensitive string comparison.
37 static bool PrefixMatch(const URLPrefix& prefix, 37 static bool PrefixMatch(const URLPrefix& prefix,
38 const base::string16& text, 38 const base::string16& text,
39 const base::string16& prefix_suffix); 39 const base::string16& prefix_suffix);
40 40
41 // Sees if |text| is inlineable against either |input| or |fixed_up_input|, 41 // Sees if |text| is inlineable against either |input| or |fixed_up_input|,
42 // filling in |match_start| and |inline_autocomplete_offset| appropriately. 42 // returning the appropriate inline autocomplete offset or
43 // base::string16::npos if |text| is not inlineable.
43 // |allow_www_prefix_without_scheme| says whether to consider an input such 44 // |allow_www_prefix_without_scheme| says whether to consider an input such
44 // as "foo" to be allowed to match against text "www.foo.com". This is 45 // as "foo" to be allowed to match against text "www.foo.com". This is
45 // needed because sometimes the string we're matching against here can come 46 // needed because sometimes the string we're matching against here can come
46 // from a match's fill_into_edit, which can start with "www." without having 47 // from a match's fill_into_edit, which can start with "www." without having
47 // a protocol at the beginning, and we want to allow these matches to be 48 // a protocol at the beginning, and we want to allow these matches to be
48 // inlineable. ("www." is not otherwise on the default prefix list.) 49 // inlineable. ("www." is not otherwise on the default prefix list.)
49 static void ComputeMatchStartAndInlineAutocompleteOffset( 50 static size_t GetInlineAutocompleteOffset(
50 const AutocompleteInput& input, 51 const AutocompleteInput& input,
51 const AutocompleteInput& fixed_up_input, 52 const AutocompleteInput& fixed_up_input,
52 const bool allow_www_prefix_without_scheme, 53 const bool allow_www_prefix_without_scheme,
53 const base::string16& text, 54 const base::string16& text);
54 size_t* match_start,
55 size_t* inline_autocomplete_offset);
56 55
57 base::string16 prefix; 56 base::string16 prefix;
58 57
59 // The number of URL components (scheme, domain label, etc.) in the prefix. 58 // The number of URL components (scheme, domain label, etc.) in the prefix.
60 // For example, "http://foo.com" and "www.bar.com" each have one component, 59 // For example, "http://foo.com" and "www.bar.com" each have one component,
61 // while "ftp://ftp.ftp.com" has two, and "mysite.com" has none. 60 // while "ftp://ftp.ftp.com" has two, and "mysite.com" has none.
62 size_t num_components; 61 size_t num_components;
63 }; 62 };
64 63
65 #endif // CHROME_BROWSER_AUTOCOMPLETE_URL_PREFIX_H_ 64 #endif // CHROME_BROWSER_AUTOCOMPLETE_URL_PREFIX_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/shortcuts_provider.cc ('k') | chrome/browser/autocomplete/url_prefix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698