| OLD | NEW |
| 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 #include "components/omnibox/browser/suggestion_answer.h" | 5 #include "components/omnibox/browser/suggestion_answer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 const base::DictionaryValue* first_line_json; | 191 const base::DictionaryValue* first_line_json; |
| 192 if (!lines_json->GetDictionary(0, &first_line_json) || | 192 if (!lines_json->GetDictionary(0, &first_line_json) || |
| 193 !ImageLine::ParseImageLine(first_line_json, &result->first_line_)) | 193 !ImageLine::ParseImageLine(first_line_json, &result->first_line_)) |
| 194 return nullptr; | 194 return nullptr; |
| 195 | 195 |
| 196 const base::DictionaryValue* second_line_json; | 196 const base::DictionaryValue* second_line_json; |
| 197 if (!lines_json->GetDictionary(1, &second_line_json) || | 197 if (!lines_json->GetDictionary(1, &second_line_json) || |
| 198 !ImageLine::ParseImageLine(second_line_json, &result->second_line_)) | 198 !ImageLine::ParseImageLine(second_line_json, &result->second_line_)) |
| 199 return nullptr; | 199 return nullptr; |
| 200 | 200 |
| 201 return result.Pass(); | 201 return result; |
| 202 } | 202 } |
| 203 | 203 |
| 204 bool SuggestionAnswer::Equals(const SuggestionAnswer& answer) const { | 204 bool SuggestionAnswer::Equals(const SuggestionAnswer& answer) const { |
| 205 return type_ == answer.type_ && | 205 return type_ == answer.type_ && |
| 206 first_line_.Equals(answer.first_line_) && | 206 first_line_.Equals(answer.first_line_) && |
| 207 second_line_.Equals(answer.second_line_); | 207 second_line_.Equals(answer.second_line_); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void SuggestionAnswer::AddImageURLsTo(std::vector<GURL>* urls) const { | 210 void SuggestionAnswer::AddImageURLsTo(std::vector<GURL>* urls) const { |
| 211 if (first_line_.image_url().is_valid()) | 211 if (first_line_.image_url().is_valid()) |
| 212 urls->push_back(first_line_.image_url()); | 212 urls->push_back(first_line_.image_url()); |
| 213 if (second_line_.image_url().is_valid()) | 213 if (second_line_.image_url().is_valid()) |
| 214 urls->push_back(second_line_.image_url()); | 214 urls->push_back(second_line_.image_url()); |
| 215 } | 215 } |
| OLD | NEW |