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

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

Issue 477293002: Revert 290058 "Omnibox: Prevent Asynchronous Suggestions from Ch..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 bool from_keyword_provider() const { return from_keyword_provider_; } 47 bool from_keyword_provider() const { return from_keyword_provider_; }
48 48
49 const base::string16& match_contents() const { return match_contents_; } 49 const base::string16& match_contents() const { return match_contents_; }
50 const ACMatchClassifications& match_contents_class() const { 50 const ACMatchClassifications& match_contents_class() const {
51 return match_contents_class_; 51 return match_contents_class_;
52 } 52 }
53 53
54 AutocompleteMatchType::Type type() const { return type_; } 54 AutocompleteMatchType::Type type() const { return type_; }
55 int relevance() const { return relevance_; } 55 int relevance() const { return relevance_; }
56 void set_relevance(int relevance) { relevance_ = relevance; } 56 void set_relevance(int relevance) { relevance_ = relevance; }
57 bool received_after_last_keystroke() const {
58 return received_after_last_keystroke_;
59 }
60 void set_received_after_last_keystroke(
61 bool received_after_last_keystroke) {
62 received_after_last_keystroke_ = received_after_last_keystroke;
63 }
64 57
65 bool relevance_from_server() const { return relevance_from_server_; } 58 bool relevance_from_server() const { return relevance_from_server_; }
66 void set_relevance_from_server(bool relevance_from_server) { 59 void set_relevance_from_server(bool relevance_from_server) {
67 relevance_from_server_ = relevance_from_server; 60 relevance_from_server_ = relevance_from_server;
68 } 61 }
69 62
70 const std::string& deletion_url() const { return deletion_url_; } 63 const std::string& deletion_url() const { return deletion_url_; }
71 64
72 // Returns the default relevance value for this result (which may 65 // Returns the default relevance value for this result (which may
73 // be left over from a previous omnibox input) given the current 66 // be left over from a previous omnibox input) given the current
(...skipping 16 matching lines...) Expand all
90 int relevance_; 83 int relevance_;
91 84
92 private: 85 private:
93 // Whether this result's relevance score was fully or partly calculated 86 // Whether this result's relevance score was fully or partly calculated
94 // based on server information, and thus is assumed to be more accurate. 87 // based on server information, and thus is assumed to be more accurate.
95 // This is ultimately used in 88 // This is ultimately used in
96 // SearchProvider::ConvertResultsToAutocompleteMatches(), see comments 89 // SearchProvider::ConvertResultsToAutocompleteMatches(), see comments
97 // there. 90 // there.
98 bool relevance_from_server_; 91 bool relevance_from_server_;
99 92
100 // Whether this result was received asynchronously after the last
101 // keystroke, otherwise it must have come from prior cached results
102 // or from a synchronous provider.
103 bool received_after_last_keystroke_;
104
105 // Optional deletion URL provided with suggestions. Fetching this URL 93 // Optional deletion URL provided with suggestions. Fetching this URL
106 // should result in some reasonable deletion behaviour on the server, 94 // should result in some reasonable deletion behaviour on the server,
107 // e.g. deleting this term out of a user's server-side search history. 95 // e.g. deleting this term out of a user's server-side search history.
108 std::string deletion_url_; 96 std::string deletion_url_;
109 }; 97 };
110 98
111 class SuggestResult : public Result { 99 class SuggestResult : public Result {
112 public: 100 public:
113 SuggestResult(const base::string16& suggestion, 101 SuggestResult(const base::string16& suggestion,
114 AutocompleteMatchType::Type type, 102 AutocompleteMatchType::Type type,
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 282
295 private: 283 private:
296 // Gets URLs of any images in Answers results. 284 // Gets URLs of any images in Answers results.
297 static void GetAnswersImageURLs(const base::DictionaryValue* answer_json, 285 static void GetAnswersImageURLs(const base::DictionaryValue* answer_json,
298 std::vector<GURL>* urls); 286 std::vector<GURL>* urls);
299 287
300 DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser); 288 DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser);
301 }; 289 };
302 290
303 #endif // COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_ 291 #endif // COMPONENTS_OMNIBOX_SEARCH_SUGGESTION_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698