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

Unified Diff: components/omnibox/search_suggestion_parser.h

Issue 669573005: Add a class to parse answer json. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and respond to comments Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: components/omnibox/search_suggestion_parser.h
diff --git a/components/omnibox/search_suggestion_parser.h b/components/omnibox/search_suggestion_parser.h
index c66de348c14c49858a3d1f1d8a5ef97242dd50d0..f28ba0f8b42d7289c4c7617f68a190e5038b6b18 100644
--- a/components/omnibox/search_suggestion_parser.h
+++ b/components/omnibox/search_suggestion_parser.h
@@ -13,6 +13,7 @@
#include "base/strings/string16.h"
#include "components/omnibox/autocomplete_match.h"
#include "components/omnibox/autocomplete_match_type.h"
+#include "components/omnibox/suggestion_answer.h"
#include "url/gurl.h"
class AutocompleteInput;
@@ -118,6 +119,7 @@ class SearchSuggestionParser {
const base::string16& annotation,
const base::string16& answer_contents,
const base::string16& answer_type,
+ const SuggestionAnswer& answer,
const std::string& suggest_query_params,
const std::string& deletion_url,
bool from_keyword_provider,
@@ -138,6 +140,7 @@ class SearchSuggestionParser {
const base::string16& answer_contents() const { return answer_contents_; }
const base::string16& answer_type() const { return answer_type_; }
+ const SuggestionAnswer& answer() const { return answer_; }
bool should_prefetch() const { return should_prefetch_; }
@@ -170,12 +173,17 @@ class SearchSuggestionParser {
// Optional additional parameters to be added to the search URL.
std::string suggest_query_params_;
+ // TODO(jdonnelly): Remove the following two properties once the downstream
+ // clients are using the SuggestionAnswer.
// Optional formatted Answers result.
base::string16 answer_contents_;
// Type of optional formatted Answers result.
base::string16 answer_type_;
+ // Optional short answer to the input that produced this suggestion.
+ SuggestionAnswer answer_;
+
// Should this result be prefetched?
bool should_prefetch_;
};
@@ -264,7 +272,7 @@ class SearchSuggestionParser {
bool relevances_from_server;
// URLs of any images in Answers results.
- std::vector<GURL> answers_image_urls;
+ SuggestionAnswer::URLs answers_image_urls;
private:
DISALLOW_COPY_AND_ASSIGN(Results);
@@ -292,15 +300,6 @@ class SearchSuggestionParser {
Results* results);
private:
- FRIEND_TEST_ALL_PREFIXES(SearchSuggestionParser,
groby-ooo-7-16 2014/10/28 00:50:02 Yay for less friends!
- GetAnswersImageURLsWithoutImagelines);
- FRIEND_TEST_ALL_PREFIXES(SearchSuggestionParser,
- GetAnswersImageURLsWithValidImage);
-
- // Gets URLs of any images in Answers results.
- static void GetAnswersImageURLs(const base::DictionaryValue* answer_json,
- std::vector<GURL>* urls);
-
DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser);
};

Powered by Google App Engine
This is Rietveld 408576698