OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_OMNIBOX_AUTOCOMPLETE_RESULT_H_ | 5 #ifndef COMPONENTS_OMNIBOX_AUTOCOMPLETE_RESULT_H_ |
6 #define COMPONENTS_OMNIBOX_AUTOCOMPLETE_RESULT_H_ | 6 #define COMPONENTS_OMNIBOX_AUTOCOMPLETE_RESULT_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "components/metrics/proto/omnibox_event.pb.h" | 13 #include "components/metrics/proto/omnibox_event.pb.h" |
14 #include "components/omnibox/autocomplete_match.h" | 14 #include "components/omnibox/autocomplete_match.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
17 class AutocompleteInput; | 17 class AutocompleteInput; |
18 class AutocompleteProvider; | 18 class AutocompleteProvider; |
19 class AutocompleteProviderClient; | |
19 class TemplateURLService; | 20 class TemplateURLService; |
20 | 21 |
21 // All matches from all providers for a particular query. This also tracks | 22 // All matches from all providers for a particular query. This also tracks |
22 // what the default match should be if the user doesn't manually select another | 23 // what the default match should be if the user doesn't manually select another |
23 // match. | 24 // match. |
24 class AutocompleteResult { | 25 class AutocompleteResult { |
25 public: | 26 public: |
26 typedef ACMatches::const_iterator const_iterator; | 27 typedef ACMatches::const_iterator const_iterator; |
27 typedef ACMatches::iterator iterator; | 28 typedef ACMatches::iterator iterator; |
28 | 29 |
(...skipping 24 matching lines...) Expand all Loading... | |
53 // True when this is the HistoryURLProvider's "what you typed" match. This | 54 // True when this is the HistoryURLProvider's "what you typed" match. This |
54 // can't be tracked using |destination_url| because its URL changes on every | 55 // can't be tracked using |destination_url| because its URL changes on every |
55 // keystroke, so if this is set, we'll preserve the selection by simply | 56 // keystroke, so if this is set, we'll preserve the selection by simply |
56 // choosing the new "what you typed" entry and ignoring |destination_url|. | 57 // choosing the new "what you typed" entry and ignoring |destination_url|. |
57 bool is_history_what_you_typed_match; | 58 bool is_history_what_you_typed_match; |
58 }; | 59 }; |
59 | 60 |
60 // Max number of matches we'll show from the various providers. | 61 // Max number of matches we'll show from the various providers. |
61 static const size_t kMaxMatches; | 62 static const size_t kMaxMatches; |
62 | 63 |
63 AutocompleteResult(); | 64 AutocompleteResult(AutocompleteProviderClient* client); |
Peter Kasting
2015/06/29 05:04:59
Nit: explicit
Mark P
2015/06/30 04:23:17
Now moot.
| |
64 ~AutocompleteResult(); | 65 ~AutocompleteResult(); |
65 | 66 |
66 // Copies matches from |old_matches| to provide a consistant result set. See | 67 // Copies matches from |old_matches| to provide a consistant result set. See |
67 // comments in code for specifics. | 68 // comments in code for specifics. |
68 void CopyOldMatches(const AutocompleteInput& input, | 69 void CopyOldMatches(const AutocompleteInput& input, |
69 const AutocompleteResult& old_matches, | 70 const AutocompleteResult& old_matches, |
70 TemplateURLService* template_url_service); | 71 TemplateURLService* template_url_service); |
71 | 72 |
72 // Adds a new set of matches to the result set. Does not re-sort. Calls | 73 // Adds a new set of matches to the result set. Does not re-sort. Calls |
73 // PossiblySwapContentsAndDescriptionForURLSuggestion(input)" on all added | 74 // PossiblySwapContentsAndDescriptionForURLSuggestion(input)" on all added |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 | 171 |
171 // The "alternate navigation URL", if any, for this result set. This is a URL | 172 // The "alternate navigation URL", if any, for this result set. This is a URL |
172 // to try offering as a navigational option in case the user navigated to the | 173 // to try offering as a navigational option in case the user navigated to the |
173 // URL of the default match but intended something else. For example, if the | 174 // URL of the default match but intended something else. For example, if the |
174 // user's local intranet contains site "foo", and the user types "foo", we | 175 // user's local intranet contains site "foo", and the user types "foo", we |
175 // default to searching for "foo" when the user may have meant to navigate | 176 // default to searching for "foo" when the user may have meant to navigate |
176 // there. In cases like this, the default match will point to the "search for | 177 // there. In cases like this, the default match will point to the "search for |
177 // 'foo'" result, and this will contain "http://foo/". | 178 // 'foo'" result, and this will contain "http://foo/". |
178 GURL alternate_nav_url_; | 179 GURL alternate_nav_url_; |
179 | 180 |
181 AutocompleteProviderClient* client_; | |
182 | |
180 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult); | 183 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult); |
181 }; | 184 }; |
182 | 185 |
183 #endif // COMPONENTS_OMNIBOX_AUTOCOMPLETE_RESULT_H_ | 186 #endif // COMPONENTS_OMNIBOX_AUTOCOMPLETE_RESULT_H_ |
OLD | NEW |