Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: chrome/browser/android/download_overwrite_infobar_delegate.h

Issue 580043002: [Android] Prompt with infobar on filename conflict (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed pkasting@'s comments Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698