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 // If handling the operation results in dismissing the infobar, returns false | |
35 // (i.e. the caller must not dismiss the infobar). | |
36 virtual bool OverwriteExistingFile() = 0; | |
37 | |
38 // This is called when the user chooses to create a new file. | |
39 // If handling the operation results in dismissing the infobar, returns false | |
40 // (i.e. the caller must not dismiss the infobar). | |
41 virtual bool CreateNewFile() = 0; | |
42 | |
43 // Gets the file name to be downloaded. | |
44 virtual std::string GetFileName() const = 0; | |
45 // Gets the download directory name. | |
46 virtual std::string GetDirName() const = 0; | |
47 // Gets the full directory path. | |
48 virtual std::string GetDirFullPath() const = 0; | |
49 | |
50 bool ShouldExpire(const NavigationDetails& details) const override; | |
51 }; | |
52 | |
53 } // namespace android | |
54 } // namespace chrome | |
55 | |
56 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_H
_ | |
OLD | NEW |