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.
5 #ifndef CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_H_
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"
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:
24 // 1. Overwrite the file.
25 // 2. Create a new file.
27 // Also, the user can dismiss the infobar to abort the download.
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
{
33 // This is called when the user chooses to overwrite the existing file.
34 virtual void OverwriteExistingFile() = 0;
36 // This is called when the user chooses to create a new file.
37 virtual void CreateNewFile() = 0;
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;
46 bool ShouldExpire(const NavigationDetails
& details
) const override
;
49 } // namespace android
52 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_H_