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

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: Fix case on "copyright" 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
« no previous file with comments | « components/omnibox/search_provider.cc ('k') | components/omnibox/search_suggestion_parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4cba6023be22f75fa4a8c7b666ce9cf0a412d743 100644
--- a/components/omnibox/search_suggestion_parser.h
+++ b/components/omnibox/search_suggestion_parser.h
@@ -9,10 +9,10 @@
#include <vector>
#include "base/basictypes.h"
-#include "base/gtest_prod_util.h"
#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 +118,7 @@ class SearchSuggestionParser {
const base::string16& annotation,
const base::string16& answer_contents,
const base::string16& answer_type,
+ scoped_ptr<SuggestionAnswer> answer,
const std::string& suggest_query_params,
const std::string& deletion_url,
bool from_keyword_provider,
@@ -125,8 +126,11 @@ class SearchSuggestionParser {
bool relevance_from_server,
bool should_prefetch,
const base::string16& input_text);
+ SuggestResult(const SuggestResult& result);
~SuggestResult() override;
+ SuggestResult& operator=(const SuggestResult& rhs);
+
const base::string16& suggestion() const { return suggestion_; }
const base::string16& match_contents_prefix() const {
return match_contents_prefix_;
@@ -138,6 +142,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_.get(); }
bool should_prefetch() const { return should_prefetch_; }
@@ -170,12 +175,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.
+ scoped_ptr<SuggestionAnswer> answer_;
+
// Should this result be prefetched?
bool should_prefetch_;
};
@@ -264,7 +274,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 +302,6 @@ class SearchSuggestionParser {
Results* results);
private:
- FRIEND_TEST_ALL_PREFIXES(SearchSuggestionParser,
- 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);
};
« 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