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

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: Tweaked API and finished unit tests 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 f5493f190c24498310a18d04fa9bf2e0759c86f4..e16262f14a87d540ccc28dfc29acf6c3fc1dbf5a 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,
groby-ooo-7-16 2014/10/23 00:46:19 Can we roll answer_contents/answer_type into Sugge
Justin Donnelly 2014/10/23 17:59:37 Oh, I see what you're saying now. True, SuggestRe
groby-ooo-7-16 2014/10/23 21:59:54 Works for me
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_; }
@@ -171,12 +174,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.
groby-ooo-7-16 2014/10/23 00:46:19 Ah. See above. Nobody should use the member vars d
Justin Donnelly 2014/10/23 17:59:37 See previous response.
// 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_;
};
@@ -300,7 +308,7 @@ class SearchSuggestionParser {
GetAnswersImageURLsWithValidImage);
// Gets URLs of any images in Answers results.
- static void GetAnswersImageURLs(const base::DictionaryValue* answer_json,
+ static void GetAnswersImageURLs(const SuggestionAnswer& answer,
std::vector<GURL>* urls);
DISALLOW_COPY_AND_ASSIGN(SearchSuggestionParser);

Powered by Google App Engine
This is Rietveld 408576698