Index: chrome/browser/android/download_overwrite_infobar_delegate.h |
diff --git a/chrome/browser/android/download_overwrite_infobar_delegate.h b/chrome/browser/android/download_overwrite_infobar_delegate.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..543b758c6a4e06c3f19d124025b3d9360a538379 |
--- /dev/null |
+++ b/chrome/browser/android/download_overwrite_infobar_delegate.h |
@@ -0,0 +1,61 @@ |
+// Copyright 2014 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. |
+ |
+#ifndef CHROME_BROWSER_ANDROID_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_H_ |
+#define CHROME_BROWSER_ANDROID_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_H_ |
+ |
+#include "base/callback.h" |
+#include "base/files/file_path.h" |
+#include "components/infobars/core/infobar_delegate.h" |
+ |
+namespace content { |
+class DownloadItem; |
+} |
+ |
+namespace chrome { |
+namespace android { |
+ |
+// An infobar delegate for DownloadOverwriteInfoBar implemented for |
+// use by ChromeDownloadManagerDelegate. |
+class DownloadOverwriteInfoBarDelegate : public infobars::InfoBarDelegate { |
+ public: |
+ // Callback to be invoked when PromptUserForDownloadPath() completes. |
+ // Originally defined in download_target_determiner_delegate.h, but |
+ // redefined to avoid a template-related compile error. |
+ typedef base::Callback<void(const base::FilePath& virtual_path)> |
+ FileSelectedCallback; |
+ virtual ~DownloadOverwriteInfoBarDelegate(); |
+ static infobars::InfoBar* Create( |
+ content::DownloadItem* download, |
+ const base::FilePath& suggested_path, |
+ const FileSelectedCallback& callback); |
+ |
+ // InfoBarDelegate: |
+ virtual DownloadOverwriteInfoBarDelegate* |
+ AsDownloadOverwriteInfoBarDelegate() override; |
+ |
+ bool Accept(); |
+ bool Cancel(); |
+ std::string GetFileName() const; |
+ std::string GetDirName() const; |
+ std::string GetDirFullPath() const; |
+ |
+ protected: |
+ DownloadOverwriteInfoBarDelegate( |
+ content::DownloadItem* download, |
+ const base::FilePath& suggested_path, |
+ const FileSelectedCallback& callback); |
+ |
+ private: |
+ int pending_id_; |
+ base::FilePath suggested_path_; |
+ FileSelectedCallback callback_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DownloadOverwriteInfoBarDelegate); |
+}; |
+ |
+} // namespace android |
+} // namespace chrome |
+ |
+#endif // CHROME_BROWSER_ANDROID_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_H_ |