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

Unified Diff: chrome/browser/ui/android/infobars/download_overwrite_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/download_overwrite_infobar.cc
diff --git a/chrome/browser/ui/android/infobars/download_overwrite_infobar.cc b/chrome/browser/ui/android/infobars/download_overwrite_infobar.cc
deleted file mode 100644
index 3eb9519688c6e9d56052a11b389ccbdd152dfe46..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/android/infobars/download_overwrite_infobar.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2015 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/download_overwrite_infobar.h"
-
-#include <utility>
-
-#include "base/android/jni_android.h"
-#include "base/android/jni_array.h"
-#include "base/android/jni_string.h"
-#include "base/android/jni_weak_ref.h"
-#include "base/files/file_path.h"
-#include "base/memory/ptr_util.h"
-#include "chrome/browser/android/download/download_overwrite_infobar_delegate.h"
-#include "jni/DownloadOverwriteInfoBar_jni.h"
-
-using base::android::ScopedJavaLocalRef;
-using chrome::android::DownloadOverwriteInfoBarDelegate;
-
-// static
-std::unique_ptr<infobars::InfoBar> DownloadOverwriteInfoBar::CreateInfoBar(
- std::unique_ptr<DownloadOverwriteInfoBarDelegate> delegate) {
- return base::WrapUnique(new DownloadOverwriteInfoBar(std::move(delegate)));
-}
-
-DownloadOverwriteInfoBar::~DownloadOverwriteInfoBar() {
-}
-
-DownloadOverwriteInfoBar::DownloadOverwriteInfoBar(
- std::unique_ptr<DownloadOverwriteInfoBarDelegate> delegate)
- : InfoBarAndroid(std::move(delegate)) {}
-
-base::android::ScopedJavaLocalRef<jobject>
-DownloadOverwriteInfoBar::CreateRenderInfoBar(JNIEnv* env) {
- DownloadOverwriteInfoBarDelegate* delegate = GetDelegate();
-
- ScopedJavaLocalRef<jstring> j_file_name =
- base::android::ConvertUTF8ToJavaString(env, delegate->GetFileName());
- ScopedJavaLocalRef<jstring> j_dir_name =
- base::android::ConvertUTF8ToJavaString(env, delegate->GetDirName());
- ScopedJavaLocalRef<jstring> j_dir_full_path =
- base::android::ConvertUTF8ToJavaString(env, delegate->GetDirFullPath());
- base::android::ScopedJavaLocalRef<jobject> java_infobar(
- Java_DownloadOverwriteInfoBar_createInfoBar(env, j_file_name, j_dir_name,
- j_dir_full_path));
- return java_infobar;
-}
-
-void DownloadOverwriteInfoBar::ProcessButton(int action) {
- if (!owner())
- return; // We're closing; don't call anything, it might access the owner.
-
- DownloadOverwriteInfoBarDelegate* delegate = GetDelegate();
- if (action == InfoBarAndroid::ACTION_OVERWRITE) {
- if (delegate->OverwriteExistingFile())
- RemoveSelf();
- } else if (action == InfoBarAndroid::ACTION_CREATE_NEW_FILE) {
- if (delegate->CreateNewFile())
- RemoveSelf();
- } else {
- CHECK(false);
- }
-}
-
-DownloadOverwriteInfoBarDelegate* DownloadOverwriteInfoBar::GetDelegate() {
- return static_cast<DownloadOverwriteInfoBarDelegate*>(delegate());
-}

Powered by Google App Engine
This is Rietveld 408576698