Index: chrome/browser/android/download/download_overwrite_infobar_delegate_java_initiated.cc |
diff --git a/chrome/browser/android/download/download_overwrite_infobar_delegate_java_initiated.cc b/chrome/browser/android/download/download_overwrite_infobar_delegate_java_initiated.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8675be1457345f61d4d69de6ad611a2eaf44a5cb |
--- /dev/null |
+++ b/chrome/browser/android/download/download_overwrite_infobar_delegate_java_initiated.cc |
@@ -0,0 +1,73 @@ |
+// 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/android/download/download_overwrite_infobar_delegate_java_initiated.h> |
+#include "base/files/file_util.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/strings/stringprintf.h" |
+#include "chrome/browser/infobars/infobar_service.h" |
+#include "chrome/browser/ui/android/infobars/download_overwrite_infobar.h" |
+#include "components/infobars/core/infobar.h" |
+#include "content/public/browser/browser_thread.h" |
+#include "content/public/browser/web_contents.h" |
+ |
+namespace chrome { |
+namespace android { |
+ |
+DownloadOverwriteInfoBarDelegateJavaInitiated:: |
+ ~DownloadOverwriteInfoBarDelegateJavaInitiated() { |
+} |
+ |
+// static |
+void DownloadOverwriteInfoBarDelegateJavaInitiated::Create( |
+ InfoBarService* infobar_service, |
+ const DownloadOverwriteInfo& download_overwrite_info, |
+ const FileSelectedFromDownloadOverwriteInfoCallback& callback) { |
+ infobar_service->AddInfoBar(DownloadOverwriteInfoBar::CreateInfoBar( |
+ make_scoped_ptr(new DownloadOverwriteInfoBarDelegateJavaInitiated( |
+ download_overwrite_info, callback)))); |
+} |
+ |
+void DownloadOverwriteInfoBarDelegateJavaInitiated::OverwriteExistingFile() { |
+ download_overwrite_info_.overwrite = true; |
+ file_selected_callback_.Run(download_overwrite_info_); |
+} |
+ |
+void DownloadOverwriteInfoBarDelegateJavaInitiated::CreateNewFile() { |
+ file_selected_callback_.Run(download_overwrite_info_); |
+} |
+ |
+std::string DownloadOverwriteInfoBarDelegateJavaInitiated::GetFileName() const { |
+ return download_overwrite_info_.file_name; |
+} |
+ |
+std::string DownloadOverwriteInfoBarDelegateJavaInitiated::GetDirName() const { |
+ return download_overwrite_info_.dir_name; |
+} |
+std::string DownloadOverwriteInfoBarDelegateJavaInitiated::GetDirFullPath() |
Ted C
2015/02/26 00:57:56
add a blank line above this.
Changwan Ryu
2015/03/02 14:46:36
Done.
|
+ const { |
+ return download_overwrite_info_.dir_full_path; |
+} |
+ |
+DownloadOverwriteInfoBarDelegateJavaInitiated:: |
+ DownloadOverwriteInfoBarDelegateJavaInitiated( |
+ const DownloadOverwriteInfo& download_overwrite_info, |
+ const FileSelectedFromDownloadOverwriteInfoCallback& |
+ file_selected_callback) |
+ : download_overwrite_info_(download_overwrite_info), |
+ file_selected_callback_(file_selected_callback) { |
+} |
+ |
+bool DownloadOverwriteInfoBarDelegateJavaInitiated::ShouldExpire( |
+ const infobars::InfoBarDelegate::NavigationDetails& details) const { |
+ return false; |
+} |
+ |
+void DownloadOverwriteInfoBarDelegateJavaInitiated::InfoBarDismissed() { |
+ download_overwrite_info_.dismissed = true; |
+ file_selected_callback_.Run(download_overwrite_info_); |
+} |
+ |
+} // namespace android |
+} // namespace chrome |