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

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

Issue 22031002: Omnibox: Create DemoteByType Experiment (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter's comments and Alexei's improvements. Created 7 years, 4 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_RESULT_H_ 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_H_ 6 #define CHROME_BROWSER_AUTOCOMPLETE_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 "chrome/browser/autocomplete/autocomplete_input.h"
13 #include "chrome/browser/autocomplete/autocomplete_match.h" 14 #include "chrome/browser/autocomplete/autocomplete_match.h"
14 #include "url/gurl.h" 15 #include "url/gurl.h"
15 16
16 class AutocompleteInput; 17 class AutocompleteInput;
17 class AutocompleteProvider; 18 class AutocompleteProvider;
18 class Profile; 19 class Profile;
19 20
20 // All matches from all providers for a particular query. This also tracks 21 // All matches from all providers for a particular query. This also tracks
21 // what the default match should be if the user doesn't manually select another 22 // what the default match should be if the user doesn't manually select another
22 // match. 23 // match.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 #else 130 #else
130 typedef ACMatches::iterator::difference_type matches_difference_type; 131 typedef ACMatches::iterator::difference_type matches_difference_type;
131 #endif 132 #endif
132 133
133 // operator=() by another name. 134 // operator=() by another name.
134 void CopyFrom(const AutocompleteResult& rhs); 135 void CopyFrom(const AutocompleteResult& rhs);
135 136
136 // Adds a single match. The match is inserted at the appropriate position 137 // Adds a single match. The match is inserted at the appropriate position
137 // based on relevancy and display order. This is ONLY for use after 138 // based on relevancy and display order. This is ONLY for use after
138 // SortAndCull() has been invoked, and preserves default_match_. 139 // SortAndCull() has been invoked, and preserves default_match_.
139 void AddMatch(const AutocompleteMatch& match); 140 void AddMatch(AutocompleteInput::PageClassification page_classification,
141 const AutocompleteMatch& match);
140 142
141 // Populates |provider_to_matches| from |matches_|. 143 // Populates |provider_to_matches| from |matches_|.
142 void BuildProviderToMatches(ProviderToMatches* provider_to_matches) const; 144 void BuildProviderToMatches(ProviderToMatches* provider_to_matches) const;
143 145
144 // Returns true if |matches| contains a match with the same destination as 146 // Returns true if |matches| contains a match with the same destination as
145 // |match|. 147 // |match|.
146 static bool HasMatchByDestination(const AutocompleteMatch& match, 148 static bool HasMatchByDestination(const AutocompleteMatch& match,
147 const ACMatches& matches); 149 const ACMatches& matches);
148 150
149 // Copies matches into this result. |old_matches| gives the matches from the 151 // Copies matches into this result. |old_matches| gives the matches from the
150 // last result, and |new_matches| the results from this result. 152 // last result, and |new_matches| the results from this result.
151 void MergeMatchesByProvider(const ACMatches& old_matches, 153 void MergeMatchesByProvider(
152 const ACMatches& new_matches); 154 AutocompleteInput::PageClassification page_classification,
155 const ACMatches& old_matches,
156 const ACMatches& new_matches);
153 157
154 ACMatches matches_; 158 ACMatches matches_;
155 159
156 const_iterator default_match_; 160 const_iterator default_match_;
157 161
158 // The "alternate navigation URL", if any, for this result set. This is a URL 162 // The "alternate navigation URL", if any, for this result set. This is a URL
159 // to try offering as a navigational option in case the user navigated to the 163 // to try offering as a navigational option in case the user navigated to the
160 // URL of the default match but intended something else. For example, if the 164 // URL of the default match but intended something else. For example, if the
161 // user's local intranet contains site "foo", and the user types "foo", we 165 // user's local intranet contains site "foo", and the user types "foo", we
162 // default to searching for "foo" when the user may have meant to navigate 166 // default to searching for "foo" when the user may have meant to navigate
163 // there. In cases like this, the default match will point to the "search for 167 // there. In cases like this, the default match will point to the "search for
164 // 'foo'" result, and this will contain "http://foo/". 168 // 'foo'" result, and this will contain "http://foo/".
165 GURL alternate_nav_url_; 169 GURL alternate_nav_url_;
166 170
167 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult); 171 DISALLOW_COPY_AND_ASSIGN(AutocompleteResult);
168 }; 172 };
169 173
170 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_H_ 174 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698