Chromium Code Reviews| 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_AUTOCOMPLETE_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
| 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 // their own thread management when they need to return matches asynchronously. | 36 // their own thread management when they need to return matches asynchronously. |
| 37 // | 37 // |
| 38 // The AutocompleteProviders each return different kinds of matches, such as | 38 // The AutocompleteProviders each return different kinds of matches, such as |
| 39 // history or search matches. These matches are given "relevance" scores. | 39 // history or search matches. These matches are given "relevance" scores. |
| 40 // Higher scores are better matches than lower scores. The relevance scores and | 40 // Higher scores are better matches than lower scores. The relevance scores and |
| 41 // classes providing the respective matches are as follows: | 41 // classes providing the respective matches are as follows: |
| 42 // | 42 // |
| 43 // UNKNOWN input type: | 43 // UNKNOWN input type: |
| 44 // --------------------------------------------------------------------|----- | 44 // --------------------------------------------------------------------|----- |
| 45 // Keyword (non-substituting or in keyword UI mode, exact match) | 1500 | 45 // Keyword (non-substituting or in keyword UI mode, exact match) | 1500 |
| 46 // Extension App (exact match) | 1425 | |
| 46 // HistoryURL (exact or inline autocomplete match) | 1400 | 47 // HistoryURL (exact or inline autocomplete match) | 1400 |
| 47 // Search Primary Provider (past query in history within 2 days) | 1399** | 48 // Search Primary Provider (past query in history within 2 days) | 1399** |
| 48 // Search Primary Provider (what you typed) | 1300 | 49 // Search Primary Provider (what you typed) | 1300 |
| 49 // HistoryURL (what you typed) | 1200 | 50 // HistoryURL (what you typed) | 1200 |
| 51 // Extension App (inexact match) | 1175*~ | |
| 50 // Keyword (substituting, exact match) | 1100 | 52 // Keyword (substituting, exact match) | 1100 |
| 51 // Search Primary Provider (past query in history older than 2 days) | 1050-- | 53 // Search Primary Provider (past query in history older than 2 days) | 1050-- |
| 52 // HistoryContents (any match in title of starred page) | 1000++ | 54 // HistoryContents (any match in title of starred page) | 1000++ |
| 53 // HistoryURL (inexact match) | 900++ | 55 // HistoryURL (inexact match) | 900++ |
| 54 // Search Primary Provider (navigational suggestion) | 800++ | 56 // Search Primary Provider (navigational suggestion) | 800++ |
| 55 // HistoryContents (any match in title of nonstarred page) | 700++ | 57 // HistoryContents (any match in title of nonstarred page) | 700++ |
| 56 // Search Primary Provider (suggestion) | 600++ | 58 // Search Primary Provider (suggestion) | 600++ |
| 57 // Built-in | 575++ | 59 // Built-in | 575++ |
| 58 // HistoryContents (any match in body of starred page) | 550++ | 60 // HistoryContents (any match in body of starred page) | 550++ |
| 59 // HistoryContents (any match in body of nonstarred page) | 500++ | 61 // HistoryContents (any match in body of nonstarred page) | 500++ |
| 60 // Keyword (inexact match) | 450 | 62 // Keyword (inexact match) | 450 |
| 61 // Search Secondary Provider (what you typed) | 250 | 63 // Search Secondary Provider (what you typed) | 250 |
| 62 // Search Secondary Provider (past query in history) | 200-- | 64 // Search Secondary Provider (past query in history) | 200-- |
| 63 // Search Secondary Provider (navigational suggestion) | 150++ | 65 // Search Secondary Provider (navigational suggestion) | 150++ |
| 64 // Search Secondary Provider (suggestion) | 100++ | 66 // Search Secondary Provider (suggestion) | 100++ |
| 65 // | 67 // |
| 66 // REQUESTED_URL input type: | 68 // REQUESTED_URL input type: |
| 67 // --------------------------------------------------------------------|----- | 69 // --------------------------------------------------------------------|----- |
| 68 // Keyword (non-substituting or in keyword UI mode, exact match) | 1500 | 70 // Keyword (non-substituting or in keyword UI mode, exact match) | 1500 |
| 71 // Extension App (exact match) | 1425 | |
| 69 // HistoryURL (exact or inline autocomplete match) | 1400 | 72 // HistoryURL (exact or inline autocomplete match) | 1400 |
| 70 // Search Primary Provider (past query in history within 2 days) | 1399** | 73 // Search Primary Provider (past query in history within 2 days) | 1399** |
| 71 // HistoryURL (what you typed) | 1200 | 74 // HistoryURL (what you typed) | 1200 |
| 75 // Extension App (inexact match) | 1175*~ | |
| 72 // Search Primary Provider (what you typed) | 1150 | 76 // Search Primary Provider (what you typed) | 1150 |
| 73 // Keyword (substituting, exact match) | 1100 | 77 // Keyword (substituting, exact match) | 1100 |
| 74 // Search Primary Provider (past query in history older than 2 days) | 1050-- | 78 // Search Primary Provider (past query in history older than 2 days) | 1050-- |
| 75 // HistoryContents (any match in title of starred page) | 1000++ | 79 // HistoryContents (any match in title of starred page) | 1000++ |
| 76 // HistoryURL (inexact match) | 900++ | 80 // HistoryURL (inexact match) | 900++ |
| 77 // Search Primary Provider (navigational suggestion) | 800++ | 81 // Search Primary Provider (navigational suggestion) | 800++ |
| 78 // HistoryContents (any match in title of nonstarred page) | 700++ | 82 // HistoryContents (any match in title of nonstarred page) | 700++ |
| 79 // Search Primary Provider (suggestion) | 600++ | 83 // Search Primary Provider (suggestion) | 600++ |
| 80 // Built-in | 575++ | 84 // Built-in | 575++ |
| 81 // HistoryContents (any match in body of starred page) | 550++ | 85 // HistoryContents (any match in body of starred page) | 550++ |
| 82 // HistoryContents (any match in body of nonstarred page) | 500++ | 86 // HistoryContents (any match in body of nonstarred page) | 500++ |
| 83 // Keyword (inexact match) | 450 | 87 // Keyword (inexact match) | 450 |
| 84 // Search Secondary Provider (what you typed) | 250 | 88 // Search Secondary Provider (what you typed) | 250 |
| 85 // Search Secondary Provider (past query in history) | 200-- | 89 // Search Secondary Provider (past query in history) | 200-- |
| 86 // Search Secondary Provider (navigational suggestion) | 150++ | 90 // Search Secondary Provider (navigational suggestion) | 150++ |
| 87 // Search Secondary Provider (suggestion) | 100++ | 91 // Search Secondary Provider (suggestion) | 100++ |
| 88 // | 92 // |
| 89 // URL input type: | 93 // URL input type: |
| 90 // --------------------------------------------------------------------|----- | 94 // --------------------------------------------------------------------|----- |
| 91 // Keyword (non-substituting or in keyword UI mode, exact match) | 1500 | 95 // Keyword (non-substituting or in keyword UI mode, exact match) | 1500 |
| 96 // Extension App (exact match) | 1425 | |
| 92 // HistoryURL (exact or inline autocomplete match) | 1400 | 97 // HistoryURL (exact or inline autocomplete match) | 1400 |
| 93 // HistoryURL (what you typed) | 1200 | 98 // HistoryURL (what you typed) | 1200 |
| 99 // Extension App (inexact match) | 1175*~ | |
| 94 // Keyword (substituting, exact match) | 1100 | 100 // Keyword (substituting, exact match) | 1100 |
| 95 // HistoryURL (inexact match) | 900++ | 101 // HistoryURL (inexact match) | 900++ |
| 96 // Search Primary Provider (what you typed) | 850 | 102 // Search Primary Provider (what you typed) | 850 |
| 97 // Search Primary Provider (navigational suggestion) | 800++ | 103 // Search Primary Provider (navigational suggestion) | 800++ |
| 98 // Search Primary Provider (past query in history) | 750-- | 104 // Search Primary Provider (past query in history) | 750-- |
| 99 // Keyword (inexact match) | 700 | 105 // Keyword (inexact match) | 700 |
| 100 // Built-in | 575++ | 106 // Built-in | 575++ |
| 101 // Search Primary Provider (suggestion) | 300++ | 107 // Search Primary Provider (suggestion) | 300++ |
| 102 // Search Secondary Provider (what you typed) | 250 | 108 // Search Secondary Provider (what you typed) | 250 |
| 103 // Search Secondary Provider (past query in history) | 200-- | 109 // Search Secondary Provider (past query in history) | 200-- |
| 104 // Search Secondary Provider (navigational suggestion) | 150++ | 110 // Search Secondary Provider (navigational suggestion) | 150++ |
| 105 // Search Secondary Provider (suggestion) | 100++ | 111 // Search Secondary Provider (suggestion) | 100++ |
| 106 // | 112 // |
| 107 // QUERY input type: | 113 // QUERY input type: |
| 108 // --------------------------------------------------------------------|----- | 114 // --------------------------------------------------------------------|----- |
| 109 // Keyword (non-substituting or in keyword UI mode, exact match) | 1500 | 115 // Keyword (non-substituting or in keyword UI mode, exact match) | 1500 |
| 110 // Keyword (substituting, exact match) | 1450 | 116 // Keyword (substituting, exact match) | 1450 |
| 117 // Extension App (exact match) | 1425 | |
| 111 // HistoryURL (exact or inline autocomplete match) | 1400 | 118 // HistoryURL (exact or inline autocomplete match) | 1400 |
| 112 // Search Primary Provider (past query in history within 2 days) | 1399** | 119 // Search Primary Provider (past query in history within 2 days) | 1399** |
| 113 // Search Primary Provider (what you typed) | 1300 | 120 // Search Primary Provider (what you typed) | 1300 |
| 121 // Extension App (inexact match) | 1175*~ | |
| 114 // 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-- |
| 115 // HistoryContents (any match in title of starred page) | 1000++ | 123 // HistoryContents (any match in title of starred page) | 1000++ |
| 116 // HistoryURL (inexact match) | 900++ | 124 // HistoryURL (inexact match) | 900++ |
| 117 // Search Primary Provider (navigational suggestion) | 800++ | 125 // Search Primary Provider (navigational suggestion) | 800++ |
| 118 // HistoryContents (any match in title of nonstarred page) | 700++ | 126 // HistoryContents (any match in title of nonstarred page) | 700++ |
| 119 // Search Primary Provider (suggestion) | 600++ | 127 // Search Primary Provider (suggestion) | 600++ |
| 120 // HistoryContents (any match in body of starred page) | 550++ | 128 // HistoryContents (any match in body of starred page) | 550++ |
| 121 // HistoryContents (any match in body of nonstarred page) | 500++ | 129 // HistoryContents (any match in body of nonstarred page) | 500++ |
| 122 // Keyword (inexact match) | 450 | 130 // Keyword (inexact match) | 450 |
| 123 // Search Secondary Provider (what you typed) | 250 | 131 // Search Secondary Provider (what you typed) | 250 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 142 // | 150 // |
| 143 // There are two possible providers for search suggestions. If the user has | 151 // There are two possible providers for search suggestions. If the user has |
| 144 // typed a keyword, then the primary provider is the keyword provider and the | 152 // typed a keyword, then the primary provider is the keyword provider and the |
| 145 // secondary provider is the default provider. If the user has not typed a | 153 // secondary provider is the default provider. If the user has not typed a |
| 146 // keyword, then the primary provider corresponds to the default provider. | 154 // keyword, then the primary provider corresponds to the default provider. |
| 147 // | 155 // |
| 148 // The value column gives the ranking returned from the various providers. | 156 // The value column gives the ranking returned from the various providers. |
| 149 // ++: a series of matches with relevance from n up to (n + max_matches). | 157 // ++: a series of matches with relevance from n up to (n + max_matches). |
| 150 // --: relevance score falls off over time (discounted 50 points @ 15 minutes, | 158 // --: relevance score falls off over time (discounted 50 points @ 15 minutes, |
| 151 // 450 points @ two weeks) | 159 // 450 points @ two weeks) |
| 152 // --: relevance score falls off over two days (discounted 99 points after two | 160 // --: relevance score falls off over two days (discounted 99 points after two |
|
Peter Kasting
2011/04/04 19:35:32
Nit: While you're here, This line was supposed to
Finnur
2011/04/05 15:50:24
Done.
| |
| 153 // days). | 161 // days). |
| 162 // *~: Partial matches get a score on a sliding scale from 800-1175 based on | |
| 163 // how many letters match (5 letters and above get 1175). | |
| 154 | 164 |
| 155 class AutocompleteController; | 165 class AutocompleteController; |
| 156 class AutocompleteControllerDelegate; | 166 class AutocompleteControllerDelegate; |
| 157 class AutocompleteInput; | 167 class AutocompleteInput; |
| 158 struct AutocompleteMatch; | 168 struct AutocompleteMatch; |
| 159 class AutocompleteProvider; | 169 class AutocompleteProvider; |
| 160 class AutocompleteResult; | 170 class AutocompleteResult; |
| 161 class HistoryContentsProvider; | 171 class HistoryContentsProvider; |
| 162 class Profile; | 172 class Profile; |
| 163 class SearchProvider; | 173 class SearchProvider; |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 718 AutocompleteInput::Type input_type; | 728 AutocompleteInput::Type input_type; |
| 719 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). | 729 // Selected index (if selected) or -1 (AutocompletePopupModel::kNoMatch). |
| 720 size_t selected_index; | 730 size_t selected_index; |
| 721 // Inline autocompleted length (if displayed). | 731 // Inline autocompleted length (if displayed). |
| 722 size_t inline_autocompleted_length; | 732 size_t inline_autocompleted_length; |
| 723 // Result set. | 733 // Result set. |
| 724 const AutocompleteResult& result; | 734 const AutocompleteResult& result; |
| 725 }; | 735 }; |
| 726 | 736 |
| 727 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ | 737 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_H_ |
| OLD | NEW |