Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/android/infobars/previews_infobar.h" | |
| 6 | |
| 7 #include <utility> | |
| 8 | |
| 9 #include "base/android/jni_android.h" | |
| 10 #include "base/android/jni_string.h" | |
| 11 #include "base/memory/ptr_util.h" | |
| 12 #include "jni/PreviewsInfoBar_jni.h" | |
| 13 | |
| 14 // PreviewsInfoBar -------------------------------------------------- | |
| 15 | |
| 16 PreviewsInfoBar::PreviewsInfoBar( | |
| 17 std::unique_ptr<PreviewsInfoBarDelegate> delegate) | |
| 18 : ConfirmInfoBar(std::move(delegate)) {} | |
| 19 | |
| 20 PreviewsInfoBar::~PreviewsInfoBar() {} | |
| 21 | |
| 22 base::android::ScopedJavaLocalRef<jobject> PreviewsInfoBar::CreateRenderInfoBar( | |
| 23 JNIEnv* env) { | |
| 24 PreviewsInfoBarDelegate* delegate = | |
| 25 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.
| |
| 26 base::android::ScopedJavaLocalRef<jstring> message_text = | |
| 27 base::android::ConvertUTF16ToJavaString(env, delegate->GetMessageText()); | |
| 28 base::android::ScopedJavaLocalRef<jstring> link_text = | |
| 29 base::android::ConvertUTF16ToJavaString(env, delegate->GetLinkText()); | |
| 30 base::android::ScopedJavaLocalRef<jstring> timestamp_text = | |
| 31 base::android::ConvertUTF16ToJavaString(env, | |
| 32 delegate->GetTimestampText()); | |
| 33 return Java_PreviewsInfoBar_show(env, GetEnumeratedIconId(), message_text, | |
| 34 link_text, timestamp_text); | |
| 35 } | |
| 36 | |
| 37 // PreviewsInfoBarDelegate ------------------------------------------ | |
| 38 | |
| 39 // static | |
| 40 std::unique_ptr<infobars::InfoBar> PreviewsInfoBarDelegate::CreateInfoBar( | |
| 41 infobars::InfoBarManager* infobar_manager, | |
| 42 std::unique_ptr<PreviewsInfoBarDelegate> delegate) { | |
| 43 return base::MakeUnique<PreviewsInfoBar>(std::move(delegate)); | |
| 44 } | |
| OLD | NEW |