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

Side by Side 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 unified diff | Download patch
OLDNEW
(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::PreviewsInfoBar(
15 std::unique_ptr<PreviewsInfoBarDelegate> delegate)
16 : ConfirmInfoBar(std::move(delegate)) {}
17
18 PreviewsInfoBar::~PreviewsInfoBar() {}
19
20 base::android::ScopedJavaLocalRef<jobject> PreviewsInfoBar::CreateRenderInfoBar(
21 JNIEnv* env) {
22 PreviewsInfoBarDelegate* delegate =
23 GetDelegate()->AsPreviewsInfoBarDelegate();
24 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.
25 return nullptr;
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 // static
38 std::unique_ptr<infobars::InfoBar> PreviewsInfoBar::CreateInfoBar(
39 infobars::InfoBarManager* infobar_manager,
40 std::unique_ptr<PreviewsInfoBarDelegate> delegate) {
41 return base::MakeUnique<PreviewsInfoBar>(std::move(delegate));
42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698