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

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

Issue 2860083003: Add timestamp support to the Previews infobar (Closed)
Patch Set: ryansturm comments 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..29b52f7ba7f4af6b75255b7b90e411abca08cfe3
--- /dev/null
+++ b/chrome/browser/ui/android/infobars/previews_infobar.cc
@@ -0,0 +1,42 @@
+// 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(
+ std::unique_ptr<PreviewsInfoBarDelegate> delegate)
+ : ConfirmInfoBar(std::move(delegate)) {}
+
+PreviewsInfoBar::~PreviewsInfoBar() {}
+
+base::android::ScopedJavaLocalRef<jobject> PreviewsInfoBar::CreateRenderInfoBar(
+ JNIEnv* env) {
+ PreviewsInfoBarDelegate* delegate =
+ GetDelegate()->AsPreviewsInfoBarDelegate();
+ if (!delegate)
Peter Kasting 2017/05/08 23:33:35 When could there be no delegate? It seems like th
megjablon 2017/05/09 00:14:30 Done.
+ return nullptr;
+ 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);
+}
+
+// static
+std::unique_ptr<infobars::InfoBar> PreviewsInfoBar::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