OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_H_ |
| 7 |
| 8 #include "base/android/scoped_java_ref.h" |
| 9 #include "base/callback.h" |
| 10 #include "base/files/file_path.h" |
| 11 #include "chrome/browser/download/download_target_determiner_delegate.h" |
| 12 #include "components/infobars/core/infobar_delegate.h" |
| 13 |
| 14 class InfoBarService; |
| 15 |
| 16 namespace chrome { |
| 17 namespace android { |
| 18 |
| 19 // An infobar that asks if it is ok to overwrite an |
| 20 // existing file. Due to limited disk space on Android, two options are |
| 21 // presented to the user when downloading a file whose name conflicts with an |
| 22 // already present file: |
| 23 // |
| 24 // 1. Overwrite the file. |
| 25 // 2. Create a new file. |
| 26 // |
| 27 // Also, the user can dismiss the infobar to abort the download. |
| 28 // |
| 29 // Note that this infobar does not expire if the user subsequently navigates, |
| 30 // since such navigations won't automatically cancel the underlying download. |
| 31 class DownloadOverwriteInfoBarDelegate : public infobars::InfoBarDelegate { |
| 32 public: |
| 33 // This is called when the user chooses to overwrite the existing file. |
| 34 virtual void OverwriteExistingFile() = 0; |
| 35 |
| 36 // This is called when the user chooses to create a new file. |
| 37 virtual void CreateNewFile() = 0; |
| 38 |
| 39 // Gets the file name to be downloaded. |
| 40 virtual std::string GetFileName() const = 0; |
| 41 // Gets the download directory name. |
| 42 virtual std::string GetDirName() const = 0; |
| 43 // Gets the full directory path. |
| 44 virtual std::string GetDirFullPath() const = 0; |
| 45 |
| 46 bool ShouldExpire(const NavigationDetails& details) const override; |
| 47 }; |
| 48 |
| 49 } // namespace android |
| 50 } // namespace chrome |
| 51 |
| 52 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_H
_ |
OLD | NEW |