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

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

Issue 10913262: Implement Bookmark Autocomplete Provider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fixed match position coalescing. Created 8 years, 2 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_AUTOCOMPLETE_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // HistoryURL (good exact or inline autocomplete matches, some inexact)| 1410++ 43 // HistoryURL (good exact or inline autocomplete matches, some inexact)| 1410++
44 // HistoryURL (intranet url never visited match, some inexact matches) | 1400++ 44 // HistoryURL (intranet url never visited match, some inexact matches) | 1400++
45 // Search Primary Provider (past query in history within 2 days) | 1399** 45 // Search Primary Provider (past query in history within 2 days) | 1399**
46 // Search Primary Provider (what you typed) | 1300 46 // Search Primary Provider (what you typed) | 1300
47 // HistoryURL (what you typed, some inexact matches) | 1200++ 47 // HistoryURL (what you typed, some inexact matches) | 1200++
48 // Extension App (inexact match) | 1175*~ 48 // Extension App (inexact match) | 1175*~
49 // Keyword (substituting, exact match) | 1100 49 // Keyword (substituting, exact match) | 1100
50 // Search Primary Provider (past query in history older than 2 days) | 1050-- 50 // Search Primary Provider (past query in history older than 2 days) | 1050--
51 // HistoryContents (any match in title of starred page) | 1000++ 51 // HistoryContents (any match in title of starred page) | 1000++
52 // HistoryURL (some inexact matches) | 900++ 52 // HistoryURL (some inexact matches) | 900++
53 // BookmarkProvider (prefix match in bookmark title) | 900+-
53 // Search Primary Provider (navigational suggestion) | 800++ 54 // Search Primary Provider (navigational suggestion) | 800++
54 // HistoryContents (any match in title of nonstarred page) | 700++ 55 // HistoryContents (any match in title of nonstarred page) | 700++
55 // Search Primary Provider (suggestion) | 600++ 56 // Search Primary Provider (suggestion) | 600++
56 // Built-in | 575++ 57 // Built-in | 575++
57 // HistoryContents (any match in body of starred page) | 550++ 58 // HistoryContents (any match in body of starred page) | 550++
58 // HistoryContents (any match in body of nonstarred page) | 500++ 59 // HistoryContents (any match in body of nonstarred page) | 500++
59 // Keyword (inexact match) | 450 60 // Keyword (inexact match) | 450
60 // Search Secondary Provider (what you typed) | 250 61 // Search Secondary Provider (what you typed) | 250
61 // Search Secondary Provider (past query in history) | 200-- 62 // Search Secondary Provider (past query in history) | 200--
62 // Search Secondary Provider (navigational suggestion) | 150++ 63 // Search Secondary Provider (navigational suggestion) | 150++
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Search Primary or Secondary (past query in history within 2 days) | 1599** 115 // Search Primary or Secondary (past query in history within 2 days) | 1599**
115 // Keyword (non-substituting or in keyword UI mode, exact match) | 1500 116 // Keyword (non-substituting or in keyword UI mode, exact match) | 1500
116 // Keyword (substituting, exact match) | 1450 117 // Keyword (substituting, exact match) | 1450
117 // Extension App (exact match) | 1425 118 // Extension App (exact match) | 1425
118 // Search Primary Provider (past query in history within 2 days) | 1399** 119 // Search Primary Provider (past query in history within 2 days) | 1399**
119 // Search Primary Provider (what you typed) | 1300 120 // Search Primary Provider (what you typed) | 1300
120 // Extension App (inexact match) | 1175*~ 121 // Extension App (inexact match) | 1175*~
121 // Search Primary Provider (past query in history older than 2 days) | 1050-- 122 // Search Primary Provider (past query in history older than 2 days) | 1050--
122 // HistoryContents (any match in title of starred page) | 1000++ 123 // HistoryContents (any match in title of starred page) | 1000++
123 // HistoryURL (inexact match) | 900++ 124 // HistoryURL (inexact match) | 900++
125 // BookmarkProvider (prefix match in bookmark title) | 900+-
124 // Search Primary Provider (navigational suggestion) | 800++ 126 // Search Primary Provider (navigational suggestion) | 800++
125 // HistoryContents (any match in title of nonstarred page) | 700++ 127 // HistoryContents (any match in title of nonstarred page) | 700++
126 // Search Primary Provider (suggestion) | 600++ 128 // Search Primary Provider (suggestion) | 600++
127 // HistoryContents (any match in body of starred page) | 550++ 129 // HistoryContents (any match in body of starred page) | 550++
128 // HistoryContents (any match in body of nonstarred page) | 500++ 130 // HistoryContents (any match in body of nonstarred page) | 500++
129 // Keyword (inexact match) | 450 131 // Keyword (inexact match) | 450
130 // Search Secondary Provider (what you typed) | 250 132 // Search Secondary Provider (what you typed) | 250
131 // Search Secondary Provider (past query in history) | 200-- 133 // Search Secondary Provider (past query in history) | 200--
132 // Search Secondary Provider (navigational suggestion) | 150++ 134 // Search Secondary Provider (navigational suggestion) | 150++
133 // Search Secondary Provider (suggestion) | 100++ 135 // Search Secondary Provider (suggestion) | 100++
(...skipping 25 matching lines...) Expand all
159 // 161 //
160 // The value column gives the ranking returned from the various providers. 162 // The value column gives the ranking returned from the various providers.
161 // ++: a series of matches with relevance from n up to (n + max_matches). 163 // ++: a series of matches with relevance from n up to (n + max_matches).
162 // --: relevance score falls off over time (discounted 50 points @ 15 minutes, 164 // --: relevance score falls off over time (discounted 50 points @ 15 minutes,
163 // 450 points @ two weeks) 165 // 450 points @ two weeks)
164 // **: relevance score falls off over two days (discounted 99 points after two 166 // **: relevance score falls off over two days (discounted 99 points after two
165 // days). 167 // days).
166 // *~: Partial matches get a score on a sliding scale from about 575-1125 based 168 // *~: Partial matches get a score on a sliding scale from about 575-1125 based
167 // on how many times the URL for the Extension App has been typed and how 169 // on how many times the URL for the Extension App has been typed and how
168 // many of the letters match. 170 // many of the letters match.
171 // +-: A base score that the provider will adjust upward or downward based on
172 // provider-specific metrics.
169 // 173 //
170 // A single result provider for the autocomplete system. Given user input, the 174 // A single result provider for the autocomplete system. Given user input, the
171 // provider decides what (if any) matches to return, their relevance, and their 175 // provider decides what (if any) matches to return, their relevance, and their
172 // classifications. 176 // classifications.
173 class AutocompleteProvider 177 class AutocompleteProvider
174 : public base::RefCountedThreadSafe<AutocompleteProvider> { 178 : public base::RefCountedThreadSafe<AutocompleteProvider> {
175 public: 179 public:
176 // Different AutocompleteProvider implementations. 180 // Different AutocompleteProvider implementations.
177 enum Type { 181 enum Type {
178 TYPE_BUILTIN = 1 << 0, 182 TYPE_BOOKMARK = 1 << 0,
179 TYPE_CONTACT = 1 << 1, 183 TYPE_BUILTIN = 1 << 1,
180 TYPE_EXTENSION_APP = 1 << 2, 184 TYPE_CONTACT = 1 << 2,
181 TYPE_HISTORY_CONTENTS = 1 << 3, 185 TYPE_EXTENSION_APP = 1 << 3,
182 TYPE_HISTORY_QUICK = 1 << 4, 186 TYPE_HISTORY_CONTENTS = 1 << 4,
183 TYPE_HISTORY_URL = 1 << 5, 187 TYPE_HISTORY_QUICK = 1 << 5,
184 TYPE_KEYWORD = 1 << 6, 188 TYPE_HISTORY_URL = 1 << 6,
185 TYPE_SEARCH = 1 << 7, 189 TYPE_KEYWORD = 1 << 7,
186 TYPE_SHORTCUTS = 1 << 8, 190 TYPE_SEARCH = 1 << 8,
187 TYPE_ZERO_SUGGEST = 1 << 9, 191 TYPE_SHORTCUTS = 1 << 9,
192 TYPE_ZERO_SUGGEST = 1 << 10,
188 }; 193 };
189 194
190 AutocompleteProvider(AutocompleteProviderListener* listener, 195 AutocompleteProvider(AutocompleteProviderListener* listener,
191 Profile* profile, 196 Profile* profile,
192 Type type); 197 Type type);
193 198
194 // Returns a string describing a particular AutocompleteProvider type. 199 // Returns a string describing a particular AutocompleteProvider type.
195 static const char* TypeToString(Type type); 200 static const char* TypeToString(Type type);
196 201
197 // Called to start an autocomplete query. The provider is responsible for 202 // Called to start an autocomplete query. The provider is responsible for
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 293
289 Type type_; 294 Type type_;
290 295
291 private: 296 private:
292 DISALLOW_COPY_AND_ASSIGN(AutocompleteProvider); 297 DISALLOW_COPY_AND_ASSIGN(AutocompleteProvider);
293 }; 298 };
294 299
295 typedef std::vector<AutocompleteProvider*> ACProviders; 300 typedef std::vector<AutocompleteProvider*> ACProviders;
296 301
297 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ 302 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698