Chromium Code Reviews| 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 "chrome/browser/download/download_target_determiner_delegate.h" | |
| 11 #include "components/infobars/core/infobar_delegate.h" | |
| 12 | |
| 13 namespace content { | |
| 14 class DownloadItem; | |
| 15 } | |
| 16 | |
| 17 namespace chrome { | |
| 18 namespace android { | |
| 19 | |
| 20 // A class to implement an infobar that asks if it is ok to overwrite an exist | |
|
Ted C
2014/10/27 15:30:12
an exist[ing]
Changwan Ryu
2014/10/28 04:59:44
Done.
| |
| 21 // file. In Android, since we have limited disk space, we give users two options | |
| 22 // when we are downloading a file but there exists another file with the same | |
|
Ted C
2014/10/27 15:30:11
I think this might be easier to read:
Due to limi
Changwan Ryu
2014/10/28 04:59:44
Done. Please let me know if the comment still need
| |
| 23 // file name: 1) Overwrite the file. 2) Do not download. | |
| 24 class DownloadOverwriteInfoBarDelegate : public infobars::InfoBarDelegate { | |
| 25 public: | |
| 26 ~DownloadOverwriteInfoBarDelegate() override; | |
| 27 | |
| 28 static infobars::InfoBar* Create( | |
| 29 content::DownloadItem* download, | |
| 30 const base::FilePath& suggested_download_path, | |
| 31 const DownloadTargetDeterminerDelegate::FileSelectedCallback& | |
| 32 file_selected_callback); | |
| 33 | |
| 34 // This is called when the user accepts overwriting. | |
| 35 bool AcceptOverwrite(); | |
| 36 | |
| 37 // This is called when the user rejects overwriting and cancels downloading. | |
| 38 bool CancelDownload(); | |
| 39 std::string GetFileName() const; | |
| 40 std::string GetDirName() const; | |
| 41 std::string GetDirFullPath() const; | |
| 42 | |
| 43 private: | |
| 44 DownloadOverwriteInfoBarDelegate( | |
| 45 content::DownloadItem* download, | |
| 46 const base::FilePath& suggested_path, | |
| 47 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback); | |
| 48 | |
| 49 // The suggested download path from download target determiner. This is used | |
| 50 // to show users the file name and the directory that will be used. | |
| 51 base::FilePath suggested_download_path_; | |
| 52 | |
| 53 // A callback to download target determiner to notify that file selection | |
| 54 // is made (or cancelled). | |
| 55 DownloadTargetDeterminerDelegate::FileSelectedCallback | |
| 56 file_selected_callback_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(DownloadOverwriteInfoBarDelegate); | |
| 59 }; | |
| 60 | |
| 61 } // namespace android | |
| 62 } // namespace chrome | |
| 63 | |
| 64 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_H_ | |
| OLD | NEW |