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

Unified Diff: chrome/browser/ui/android/infobars/previews_infobar.cc

Issue 2860083003: Add timestamp support to the Previews infobar (Closed)
Patch Set: fix copyright dates Created 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/android/infobars/previews_infobar.cc
diff --git a/chrome/browser/ui/android/infobars/previews_infobar.cc b/chrome/browser/ui/android/infobars/previews_infobar.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5a48df32ea4ae7979dbaaad31c1fcbf4a0a11f81
--- /dev/null
+++ b/chrome/browser/ui/android/infobars/previews_infobar.cc
@@ -0,0 +1,44 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/android/infobars/previews_infobar.h"
+
+#include <utility>
+
+#include "base/android/jni_android.h"
+#include "base/android/jni_string.h"
+#include "base/memory/ptr_util.h"
+#include "jni/PreviewsInfoBar_jni.h"
+
+// PreviewsInfoBar --------------------------------------------------
+
+PreviewsInfoBar::PreviewsInfoBar(
+ std::unique_ptr<PreviewsInfoBarDelegate> delegate)
+ : ConfirmInfoBar(std::move(delegate)) {}
+
+PreviewsInfoBar::~PreviewsInfoBar() {}
+
+base::android::ScopedJavaLocalRef<jobject> PreviewsInfoBar::CreateRenderInfoBar(
+ JNIEnv* env) {
+ PreviewsInfoBarDelegate* delegate =
+ static_cast<PreviewsInfoBarDelegate*>(GetDelegate());
RyanSturm 2017/05/08 20:48:17 nit: It would be cleaner to add a AsPreviewsInfoBa
megjablon 2017/05/08 22:49:19 Done.
+ base::android::ScopedJavaLocalRef<jstring> message_text =
+ base::android::ConvertUTF16ToJavaString(env, delegate->GetMessageText());
+ base::android::ScopedJavaLocalRef<jstring> link_text =
+ base::android::ConvertUTF16ToJavaString(env, delegate->GetLinkText());
+ base::android::ScopedJavaLocalRef<jstring> timestamp_text =
+ base::android::ConvertUTF16ToJavaString(env,
+ delegate->GetTimestampText());
+ return Java_PreviewsInfoBar_show(env, GetEnumeratedIconId(), message_text,
+ link_text, timestamp_text);
+}
+
+// PreviewsInfoBarDelegate ------------------------------------------
+
+// static
+std::unique_ptr<infobars::InfoBar> PreviewsInfoBarDelegate::CreateInfoBar(
+ infobars::InfoBarManager* infobar_manager,
+ std::unique_ptr<PreviewsInfoBarDelegate> delegate) {
+ return base::MakeUnique<PreviewsInfoBar>(std::move(delegate));
+}

Powered by Google App Engine
This is Rietveld 408576698