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

Side by Side Diff: components/omnibox/browser/search_suggestion_parser.h

Issue 2755503002: Add a new entry to omnibox_event.proto to log specific type of contextual suggestions (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
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_BROWSER_SEARCH_SUGGESTION_PARSER_H_ 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_SEARCH_SUGGESTION_PARSER_H_
6 #define COMPONENTS_OMNIBOX_BROWSER_SEARCH_SUGGESTION_PARSER_H_ 6 #define COMPONENTS_OMNIBOX_BROWSER_SEARCH_SUGGESTION_PARSER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 class NavigationResult : public Result { 194 class NavigationResult : public Result {
195 public: 195 public:
196 NavigationResult(const AutocompleteSchemeClassifier& scheme_classifier, 196 NavigationResult(const AutocompleteSchemeClassifier& scheme_classifier,
197 const GURL& url, 197 const GURL& url,
198 AutocompleteMatchType::Type type, 198 AutocompleteMatchType::Type type,
199 const base::string16& description, 199 const base::string16& description,
200 const std::string& deletion_url, 200 const std::string& deletion_url,
201 bool from_keyword_provider, 201 bool from_keyword_provider,
202 int relevance, 202 int relevance,
203 bool relevance_from_server, 203 bool relevance_from_server,
204 const base::string16& input_text); 204 const base::string16& input_text,
205 const std::string& zero_suggest_specific_type);
206 NavigationResult(const NavigationResult& nav);
205 ~NavigationResult() override; 207 ~NavigationResult() override;
206 208
207 const GURL& url() const { return url_; } 209 const GURL& url() const { return url_; }
208 const base::string16& description() const { return description_; } 210 const base::string16& description() const { return description_; }
209 const base::string16& formatted_url() const { return formatted_url_; } 211 const base::string16& formatted_url() const { return formatted_url_; }
212 const std::string& zero_suggest_specific_type() const {
213 return zero_suggest_specific_type_;
214 }
210 215
211 // Fills in |match_contents_| and |match_contents_class_| to reflect how 216 // Fills in |match_contents_| and |match_contents_class_| to reflect how
212 // the URL should be displayed and bolded against the current |input_text|. 217 // the URL should be displayed and bolded against the current |input_text|.
213 // If |allow_bolding_nothing| is false and |match_contents_class_| would 218 // If |allow_bolding_nothing| is false and |match_contents_class_| would
214 // result in an entirely unbolded |match_contents_|, do nothing. 219 // result in an entirely unbolded |match_contents_|, do nothing.
215 void CalculateAndClassifyMatchContents(const bool allow_bolding_nothing, 220 void CalculateAndClassifyMatchContents(const bool allow_bolding_nothing,
216 const base::string16& input_text); 221 const base::string16& input_text);
217 222
218 // Result: 223 // Result:
219 int CalculateRelevance(const AutocompleteInput& input, 224 int CalculateRelevance(const AutocompleteInput& input,
220 bool keyword_provider_requested) const override; 225 bool keyword_provider_requested) const override;
221 226
222 private: 227 private:
223 // The suggested url for navigation. 228 // The suggested url for navigation.
224 GURL url_; 229 GURL url_;
225 230
226 // The properly formatted ("fixed up") URL string with equivalent meaning 231 // The properly formatted ("fixed up") URL string with equivalent meaning
227 // to the one in |url_|. 232 // to the one in |url_|.
228 base::string16 formatted_url_; 233 base::string16 formatted_url_;
229 234
230 // The suggested navigational result description; generally the site name. 235 // The suggested navigational result description; generally the site name.
231 base::string16 description_; 236 base::string16 description_;
237
238 // If this suggestion is a zero suggest suggestion, this will be set to the
239 // specific subtype of the result.
240 std::string zero_suggest_specific_type_;
232 }; 241 };
233 242
234 typedef std::vector<SuggestResult> SuggestResults; 243 typedef std::vector<SuggestResult> SuggestResults;
235 typedef std::vector<NavigationResult> NavigationResults; 244 typedef std::vector<NavigationResult> NavigationResults;
236 245
237 // A simple structure bundling most of the information (including 246 // A simple structure bundling most of the information (including
238 // both SuggestResults and NavigationResults) returned by a call to 247 // both SuggestResults and NavigationResults) returned by a call to
239 // the suggest server. 248 // the suggest server.
240 // 249 //
241 // This has to be declared after the typedefs since it relies on some of them. 250 // This has to be declared after the typedefs since it relies on some of them.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 const AutocompleteSchemeClassifier& scheme_classifier, 306 const AutocompleteSchemeClassifier& scheme_classifier,
298 int default_result_relevance, 307 int default_result_relevance,
299 bool is_keyword_result, 308 bool is_keyword_result,
300 Results* results); 309 Results* results);
301 310
302 private: 311 private:
303 DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser); 312 DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser);
304 }; 313 };
305 314
306 #endif // COMPONENTS_OMNIBOX_BROWSER_SEARCH_SUGGESTION_PARSER_H_ 315 #endif // COMPONENTS_OMNIBOX_BROWSER_SEARCH_SUGGESTION_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698