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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/android/infobars/duplicate_download_infobar.cc
diff --git a/chrome/browser/ui/android/infobars/duplicate_download_infobar.cc b/chrome/browser/ui/android/infobars/duplicate_download_infobar.cc
new file mode 100644
index 0000000000000000000000000000000000000000..51990667ef760c95cb76081f181625fcdf735124
--- /dev/null
+++ b/chrome/browser/ui/android/infobars/duplicate_download_infobar.cc
@@ -0,0 +1,47 @@
+// Copyright 2016 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/duplicate_download_infobar.h"
+
+#include <utility>
+
+#include "base/android/jni_android.h"
+#include "base/android/jni_string.h"
+#include "base/memory/ptr_util.h"
+#include "chrome/browser/android/download/duplicate_download_infobar_delegate.h"
+#include "jni/DuplicateDownloadInfoBar_jni.h"
+
+using chrome::android::DuplicateDownloadInfoBarDelegate;
+
+// static
+std::unique_ptr<infobars::InfoBar> DuplicateDownloadInfoBar::CreateInfoBar(
+ std::unique_ptr<DuplicateDownloadInfoBarDelegate> delegate) {
+ return base::WrapUnique(new DuplicateDownloadInfoBar(std::move(delegate)));
+}
+
+DuplicateDownloadInfoBar::~DuplicateDownloadInfoBar() {
+}
+
+DuplicateDownloadInfoBar::DuplicateDownloadInfoBar(
+ std::unique_ptr<DuplicateDownloadInfoBarDelegate> delegate)
+ : ConfirmInfoBar(std::move(delegate)) {}
+
+base::android::ScopedJavaLocalRef<jobject>
+DuplicateDownloadInfoBar::CreateRenderInfoBar(JNIEnv* env) {
+ DuplicateDownloadInfoBarDelegate* delegate = GetDelegate();
+
+ base::android::ScopedJavaLocalRef<jstring> j_file_path =
+ base::android::ConvertUTF8ToJavaString(env, delegate->GetFilePath());
+ base::android::ScopedJavaLocalRef<jstring> j_page_url =
+ base::android::ConvertUTF8ToJavaString(env, delegate->GetPageURL());
+ base::android::ScopedJavaLocalRef<jobject> java_infobar(
+ Java_DuplicateDownloadInfoBar_createInfoBar(
+ env, j_file_path, delegate->IsOfflinePage(), j_page_url,
+ delegate->IsOffTheRecord()));
+ return java_infobar;
+}
+
+DuplicateDownloadInfoBarDelegate* DuplicateDownloadInfoBar::GetDelegate() {
+ return static_cast<DuplicateDownloadInfoBarDelegate*>(delegate());
+}
« 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