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

Side by Side Diff: chrome/browser/ui/android/infobars/duplicate_download_infobar.cc

Issue 2478583004: implementation for new duplicate download UI (Closed)
Patch Set: do null check on webcontents Created 4 years, 1 month 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 2016 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/duplicate_download_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 "chrome/browser/android/download/duplicate_download_infobar_delegate.h"
13 #include "jni/DuplicateDownloadInfoBar_jni.h"
14
15 using chrome::android::DuplicateDownloadInfoBarDelegate;
16
17 // static
18 std::unique_ptr<infobars::InfoBar> DuplicateDownloadInfoBar::CreateInfoBar(
19 std::unique_ptr<DuplicateDownloadInfoBarDelegate> delegate) {
20 return base::WrapUnique(new DuplicateDownloadInfoBar(std::move(delegate)));
21 }
22
23 DuplicateDownloadInfoBar::~DuplicateDownloadInfoBar() {
24 }
25
26 DuplicateDownloadInfoBar::DuplicateDownloadInfoBar(
27 std::unique_ptr<DuplicateDownloadInfoBarDelegate> delegate)
28 : ConfirmInfoBar(std::move(delegate)) {}
29
30 base::android::ScopedJavaLocalRef<jobject>
31 DuplicateDownloadInfoBar::CreateRenderInfoBar(JNIEnv* env) {
32 DuplicateDownloadInfoBarDelegate* delegate = GetDelegate();
33
34 base::android::ScopedJavaLocalRef<jstring> j_file_path =
35 base::android::ConvertUTF8ToJavaString(env, delegate->GetFilePath());
36 base::android::ScopedJavaLocalRef<jstring> j_page_url =
37 base::android::ConvertUTF8ToJavaString(env, delegate->GetPageURL());
38 base::android::ScopedJavaLocalRef<jobject> java_infobar(
39 Java_DuplicateDownloadInfoBar_createInfoBar(
40 env, j_file_path, delegate->IsOfflinePage(), j_page_url,
41 delegate->IsOffTheRecord()));
42 return java_infobar;
43 }
44
45 DuplicateDownloadInfoBarDelegate* DuplicateDownloadInfoBar::GetDelegate() {
46 return static_cast<DuplicateDownloadInfoBarDelegate*>(delegate());
47 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/android/infobars/duplicate_download_infobar.h ('k') | chrome/browser/ui/android/infobars/infobar_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698