| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/ui/webui/snippets_internals_message_handler.h" | 5 #include "chrome/browser/ui/webui/snippets_internals_message_handler.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 entry->SetString("title", snippet.title()); | 38 entry->SetString("title", snippet.title()); |
| 39 entry->SetString("siteTitle", snippet.best_source().publisher_name); | 39 entry->SetString("siteTitle", snippet.best_source().publisher_name); |
| 40 entry->SetString("snippet", snippet.snippet()); | 40 entry->SetString("snippet", snippet.snippet()); |
| 41 entry->SetString("published", | 41 entry->SetString("published", |
| 42 TimeFormatShortDateAndTime(snippet.publish_date())); | 42 TimeFormatShortDateAndTime(snippet.publish_date())); |
| 43 entry->SetString("expires", | 43 entry->SetString("expires", |
| 44 TimeFormatShortDateAndTime(snippet.expiry_date())); | 44 TimeFormatShortDateAndTime(snippet.expiry_date())); |
| 45 entry->SetString("url", snippet.url().spec()); | 45 entry->SetString("url", snippet.url().spec()); |
| 46 entry->SetString("ampUrl", snippet.best_source().amp_url.spec()); | 46 entry->SetString("ampUrl", snippet.best_source().amp_url.spec()); |
| 47 entry->SetString("salientImageUrl", snippet.salient_image_url().spec()); | 47 entry->SetString("salientImageUrl", snippet.salient_image_url().spec()); |
| 48 entry->SetDouble("score", snippet.score()); |
| 48 | 49 |
| 49 if (discarded) | 50 if (discarded) |
| 50 entry->SetString("id", "discarded-snippet-" + base::IntToString(index)); | 51 entry->SetString("id", "discarded-snippet-" + base::IntToString(index)); |
| 51 else | 52 else |
| 52 entry->SetString("id", "snippet-" + base::IntToString(index)); | 53 entry->SetString("id", "snippet-" + base::IntToString(index)); |
| 53 | 54 |
| 54 return entry; | 55 return entry; |
| 55 } | 56 } |
| 56 | 57 |
| 57 } // namespace | 58 } // namespace |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 } | 234 } |
| 234 | 235 |
| 235 void SnippetsInternalsMessageHandler::SendString(const std::string& name, | 236 void SnippetsInternalsMessageHandler::SendString(const std::string& name, |
| 236 const std::string& value) { | 237 const std::string& value) { |
| 237 base::StringValue string_name(name); | 238 base::StringValue string_name(name); |
| 238 base::StringValue string_value(value); | 239 base::StringValue string_value(value); |
| 239 | 240 |
| 240 web_ui()->CallJavascriptFunction("chrome.SnippetsInternals.receiveProperty", | 241 web_ui()->CallJavascriptFunction("chrome.SnippetsInternals.receiveProperty", |
| 241 string_name, string_value); | 242 string_name, string_value); |
| 242 } | 243 } |
| OLD | NEW |