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

Side by Side Diff: chrome/browser/android/download/chrome_download_manager_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: changed function order according to headers Created 5 years, 9 months 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 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_CHROME_DOWNLOAD_MANAGER_OVERWRITE_INFOBA R_DELEGATE_H_
6 #define CHROME_BROWSER_ANDROID_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_OVERWRITE_INFOBA R_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/android/download/download_overwrite_infobar_delegate.h"
12 #include "chrome/browser/download/download_target_determiner_delegate.h"
13 #include "components/infobars/core/infobar_delegate.h"
14
15 using base::android::ScopedJavaGlobalRef;
16
17 class InfoBarService;
18
19 namespace chrome {
20 namespace android {
21
22 // An infobar delegate that starts from the given file path.
23 class ChromeDownloadManagerOverwriteInfoBarDelegate
24 : public DownloadOverwriteInfoBarDelegate {
25 public:
26 ~ChromeDownloadManagerOverwriteInfoBarDelegate() override;
27
28 static void Create(
29 InfoBarService* infobar_service,
30 const base::FilePath& suggested_download_path,
31 const DownloadTargetDeterminerDelegate::FileSelectedCallback&
32 file_selected_callback);
33
34 private:
35 ChromeDownloadManagerOverwriteInfoBarDelegate(
36 const base::FilePath& suggested_path,
37 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback);
38
39 // DownloadOverwriteInfoBarDelegate:
40 void OverwriteExistingFile() override;
41 void CreateNewFile() override;
42 std::string GetFileName() const override;
43 std::string GetDirName() const override;
44 std::string GetDirFullPath() const override;
45 void InfoBarDismissed() override;
46
47 // Called on the FILE thread to create a new file. Calls |callback| on the UI
48 // thread when finished.
49 static void CreateNewFileInternal(
50 const base::FilePath& suggested_download_path,
51 const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback);
52
53 // The suggested download path from download target determiner. This is used
54 // to show users the file name and the directory that will be used.
55 base::FilePath suggested_download_path_;
56
57 // A callback to download target determiner to notify that file selection
58 // is made (or cancelled).
59 DownloadTargetDeterminerDelegate::FileSelectedCallback
60 file_selected_callback_;
61
62 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerOverwriteInfoBarDelegate);
63 };
64
65 } // namespace android
66 } // namespace chrome
67
68 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_OVERWRITE_INF OBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698