OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_ANDROID_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/files/file_path.h" |
| 10 #include "components/infobars/core/infobar_delegate.h" |
| 11 |
| 12 namespace content { |
| 13 class DownloadItem; |
| 14 } |
| 15 |
| 16 namespace chrome { |
| 17 namespace android { |
| 18 |
| 19 // An infobar delegate for DownloadOverwriteInfoBar implemented for |
| 20 // use by ChromeDownloadManagerDelegate. |
| 21 class DownloadOverwriteInfoBarDelegate : public infobars::InfoBarDelegate { |
| 22 public: |
| 23 // Callback to be invoked when PromptUserForDownloadPath() completes. |
| 24 // Originally defined in download_target_determiner_delegate.h, but |
| 25 // redefined to avoid a template-related compile error. |
| 26 typedef base::Callback<void(const base::FilePath& virtual_path)> |
| 27 FileSelectedCallback; |
| 28 virtual ~DownloadOverwriteInfoBarDelegate(); |
| 29 static infobars::InfoBar* Create( |
| 30 content::DownloadItem* download, |
| 31 const base::FilePath& suggested_path, |
| 32 const FileSelectedCallback& callback); |
| 33 |
| 34 // InfoBarDelegate: |
| 35 virtual DownloadOverwriteInfoBarDelegate* |
| 36 AsDownloadOverwriteInfoBarDelegate() override; |
| 37 |
| 38 bool Accept(); |
| 39 bool Cancel(); |
| 40 std::string GetFileName() const; |
| 41 std::string GetDirName() const; |
| 42 std::string GetDirFullPath() const; |
| 43 |
| 44 protected: |
| 45 DownloadOverwriteInfoBarDelegate( |
| 46 content::DownloadItem* download, |
| 47 const base::FilePath& suggested_path, |
| 48 const FileSelectedCallback& callback); |
| 49 |
| 50 private: |
| 51 int pending_id_; |
| 52 base::FilePath suggested_path_; |
| 53 FileSelectedCallback callback_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(DownloadOverwriteInfoBarDelegate); |
| 56 }; |
| 57 |
| 58 } // namespace android |
| 59 } // namespace chrome |
| 60 |
| 61 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_H_ |
OLD | NEW |