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

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

Issue 481693004: Omnibox: Prevent Asynchronous Suggestions from Changing Default Match (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 3 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
« no previous file with comments | « components/omnibox/search_provider.cc ('k') | components/omnibox/search_suggestion_parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_SEARCH_SUGGESTION_PARSER_H_ 5 #ifndef COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_
6 #define COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_ 6 #define COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 bool from_keyword_provider() const { return from_keyword_provider_; } 48 bool from_keyword_provider() const { return from_keyword_provider_; }
49 49
50 const base::string16& match_contents() const { return match_contents_; } 50 const base::string16& match_contents() const { return match_contents_; }
51 const ACMatchClassifications& match_contents_class() const { 51 const ACMatchClassifications& match_contents_class() const {
52 return match_contents_class_; 52 return match_contents_class_;
53 } 53 }
54 54
55 AutocompleteMatchType::Type type() const { return type_; } 55 AutocompleteMatchType::Type type() const { return type_; }
56 int relevance() const { return relevance_; } 56 int relevance() const { return relevance_; }
57 void set_relevance(int relevance) { relevance_ = relevance; } 57 void set_relevance(int relevance) { relevance_ = relevance; }
58 bool received_after_last_keystroke() const {
59 return received_after_last_keystroke_;
60 }
61 void set_received_after_last_keystroke(
62 bool received_after_last_keystroke) {
63 received_after_last_keystroke_ = received_after_last_keystroke;
64 }
58 65
59 bool relevance_from_server() const { return relevance_from_server_; } 66 bool relevance_from_server() const { return relevance_from_server_; }
60 void set_relevance_from_server(bool relevance_from_server) { 67 void set_relevance_from_server(bool relevance_from_server) {
61 relevance_from_server_ = relevance_from_server; 68 relevance_from_server_ = relevance_from_server;
62 } 69 }
63 70
64 const std::string& deletion_url() const { return deletion_url_; } 71 const std::string& deletion_url() const { return deletion_url_; }
65 72
66 // Returns the default relevance value for this result (which may 73 // Returns the default relevance value for this result (which may
67 // be left over from a previous omnibox input) given the current 74 // be left over from a previous omnibox input) given the current
(...skipping 16 matching lines...) Expand all
84 int relevance_; 91 int relevance_;
85 92
86 private: 93 private:
87 // Whether this result's relevance score was fully or partly calculated 94 // Whether this result's relevance score was fully or partly calculated
88 // based on server information, and thus is assumed to be more accurate. 95 // based on server information, and thus is assumed to be more accurate.
89 // This is ultimately used in 96 // This is ultimately used in
90 // SearchProvider::ConvertResultsToAutocompleteMatches(), see comments 97 // SearchProvider::ConvertResultsToAutocompleteMatches(), see comments
91 // there. 98 // there.
92 bool relevance_from_server_; 99 bool relevance_from_server_;
93 100
101 // Whether this result was received asynchronously after the last
102 // keystroke, otherwise it must have come from prior cached results
103 // or from a synchronous provider.
104 bool received_after_last_keystroke_;
105
94 // Optional deletion URL provided with suggestions. Fetching this URL 106 // Optional deletion URL provided with suggestions. Fetching this URL
95 // should result in some reasonable deletion behaviour on the server, 107 // should result in some reasonable deletion behaviour on the server,
96 // e.g. deleting this term out of a user's server-side search history. 108 // e.g. deleting this term out of a user's server-side search history.
97 std::string deletion_url_; 109 std::string deletion_url_;
98 }; 110 };
99 111
100 class SuggestResult : public Result { 112 class SuggestResult : public Result {
101 public: 113 public:
102 SuggestResult(const base::string16& suggestion, 114 SuggestResult(const base::string16& suggestion,
103 AutocompleteMatchType::Type type, 115 AutocompleteMatchType::Type type,
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 GetAnswersImageURLsWithValidImage); 300 GetAnswersImageURLsWithValidImage);
289 301
290 // Gets URLs of any images in Answers results. 302 // Gets URLs of any images in Answers results.
291 static void GetAnswersImageURLs(const base::DictionaryValue* answer_json, 303 static void GetAnswersImageURLs(const base::DictionaryValue* answer_json,
292 std::vector<GURL>* urls); 304 std::vector<GURL>* urls);
293 305
294 DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser); 306 DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser);
295 }; 307 };
296 308
297 #endif // COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_ 309 #endif // COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_
OLDNEW
« no previous file with comments | « components/omnibox/search_provider.cc ('k') | components/omnibox/search_suggestion_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698