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

Unified Diff: chrome/browser/android/ntp/ntp_snippets_bridge.cc

Issue 2548213005: Add base::time::FromJavaTime (Closed)
Patch Set: Created 4 years 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 | « base/time/time.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/ntp/ntp_snippets_bridge.cc
diff --git a/chrome/browser/android/ntp/ntp_snippets_bridge.cc b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
index 1062f8ce216d16c42549e0484944af54fb7f9176..1674d00ad9ba3b2e66c6bf13b4463ead1ec16829 100644
--- a/chrome/browser/android/ntp/ntp_snippets_bridge.cc
+++ b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
@@ -46,12 +46,6 @@ using ntp_snippets::ContentSuggestion;
namespace {
-// TODO(treib): Move this into the Time class itself.
-base::Time TimeFromJavaTime(jlong timestamp_ms) {
- return base::Time::UnixEpoch() +
- base::TimeDelta::FromMilliseconds(timestamp_ms);
-}
-
// Converts a vector of ContentSuggestions to its Java equivalent.
ScopedJavaLocalRef<jobject> ToJavaSuggestionList(
JNIEnv* env,
@@ -358,7 +352,7 @@ void NTPSnippetsBridge::OnSuggestionShown(JNIEnv* env,
jfloat score) {
ntp_snippets::metrics::OnSuggestionShown(
global_position, CategoryFromIDValue(j_category_id), category_position,
- TimeFromJavaTime(publish_timestamp_ms), score);
+ base::Time::FromJavaTime(publish_timestamp_ms), score);
if (global_position == 0) {
content_suggestions_service_->user_classifier()->OnEvent(
ntp_snippets::UserClassifier::Metric::SUGGESTIONS_SHOWN);
@@ -375,7 +369,7 @@ void NTPSnippetsBridge::OnSuggestionOpened(JNIEnv* env,
int windowOpenDisposition) {
ntp_snippets::metrics::OnSuggestionOpened(
global_position, CategoryFromIDValue(j_category_id), category_position,
- TimeFromJavaTime(publish_timestamp_ms), score,
+ base::Time::FromJavaTime(publish_timestamp_ms), score,
static_cast<WindowOpenDisposition>(windowOpenDisposition));
content_suggestions_service_->user_classifier()->OnEvent(
ntp_snippets::UserClassifier::Metric::SUGGESTIONS_USED);
@@ -390,7 +384,7 @@ void NTPSnippetsBridge::OnSuggestionMenuOpened(JNIEnv* env,
jfloat score) {
ntp_snippets::metrics::OnSuggestionMenuOpened(
global_position, CategoryFromIDValue(j_category_id), category_position,
- TimeFromJavaTime(publish_timestamp_ms), score);
+ base::Time::FromJavaTime(publish_timestamp_ms), score);
}
void NTPSnippetsBridge::OnMoreButtonShown(JNIEnv* env,
« no previous file with comments | « base/time/time.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698