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

Unified Diff: components/omnibox/search_suggestion_parser.cc

Issue 470403003: [AiS] Fix parsing for Answers Images. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 side-by-side diff with in-line comments
Download patch
Index: components/omnibox/search_suggestion_parser.cc
diff --git a/components/omnibox/search_suggestion_parser.cc b/components/omnibox/search_suggestion_parser.cc
index a481def345dee8aec352842f70e423d10125faeb..31a2781978df724aa17074ae3e948decebcb1a69 100644
--- a/components/omnibox/search_suggestion_parser.cc
+++ b/components/omnibox/search_suggestion_parser.cc
@@ -489,9 +489,10 @@ void SearchSuggestionParser::GetAnswersImageURLs(
return;
for (size_t line = 0; line < lines->GetSize(); ++line) {
+ const base::DictionaryValue* value = NULL;
const base::DictionaryValue* imageLine = NULL;
- lines->GetDictionary(line, &imageLine);
- if (!imageLine)
+ lines->GetDictionary(line, &value);
Mark P 2014/08/15 22:49:16 comment: you and put this at the beginning of the
groby-ooo-7-16 2014/08/22 00:43:58 I'm actually taking all comments here and rewritin
+ if (!value || !value->GetDictionary("il", &imageLine))
Mark P 2014/08/15 22:49:16 consider || !imageLine at the end
groby-ooo-7-16 2014/08/22 00:43:58 imageLine is guaranteed non-NULL if GetDictionary
continue;
const base::DictionaryValue* imageData = NULL;
imageLine->GetDictionary("i", &imageData);
@@ -499,6 +500,6 @@ void SearchSuggestionParser::GetAnswersImageURLs(
continue;
std::string imageUrl;
Mark P 2014/08/15 22:49:16 If you're going to prepend a protocol to this, the
groby-ooo-7-16 2014/08/22 00:43:58 It's odd because GWS returns paths without scheme,
imageData->GetString("d", &imageUrl);
Mark P 2014/08/15 22:49:16 Please don't ignore the return value.
groby-ooo-7-16 2014/08/22 00:43:58 Done.
- urls->push_back(GURL(imageUrl));
+ urls->push_back(GURL("https:" + imageUrl));
Mark P 2014/08/15 22:49:16 This probably should be one of the protocol value
groby-ooo-7-16 2014/08/22 00:43:58 Done.
}
}

Powered by Google App Engine
This is Rietveld 408576698