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

Side by Side Diff: chrome/browser/ui/webui/snippets_internals_message_handler.cc

Issue 1922083004: Allow fetching personalized snippets from ChromeReader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Yet another unittest fix Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/snippets_internals.html ('k') | components/ntp_snippets.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/snippets_internals.html ('k') | components/ntp_snippets.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698