Index: chrome/browser/android/download/download_overwrite_infobar_delegate_native_initiated.h |
diff --git a/chrome/browser/android/download/download_overwrite_infobar_delegate_native_initiated.h b/chrome/browser/android/download/download_overwrite_infobar_delegate_native_initiated.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..578c529ed76078c35e4ab64e2ff6ca5aa560f2d8 |
--- /dev/null |
+++ b/chrome/browser/android/download/download_overwrite_infobar_delegate_native_initiated.h |
@@ -0,0 +1,72 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_NATIVE_INITIATED_H_ |
+#define CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_NATIVE_INITIATED_H_ |
+ |
+#include "base/callback.h" |
+#include "base/files/file_path.h" |
+#include "chrome/browser/android/download/download_overwrite_infobar_delegate.h" |
+#include "chrome/browser/download/download_target_determiner_delegate.h" |
+#include "components/infobars/core/infobar_delegate.h" |
+ |
+class InfoBarService; |
+ |
+namespace chrome { |
+namespace android { |
+ |
+// An infobar delegate that starts from the given file path. |
+class DownloadOverwriteInfoBarDelegateNativeInitiated |
+ : public DownloadOverwriteInfoBarDelegate { |
+ public: |
+ ~DownloadOverwriteInfoBarDelegateNativeInitiated() override; |
+ |
+ static void Create( |
+ InfoBarService* infobar_service, |
+ const base::FilePath& suggested_download_path, |
+ const DownloadTargetDeterminerDelegate::FileSelectedCallback& |
+ file_selected_callback); |
+ |
+ // This is called when the user chooses to overwrite the existing file. |
+ void OverwriteExistingFile() override; |
+ |
+ // This is called when the user chooses to create a new file. |
+ void CreateNewFile() override; |
+ |
+ std::string GetFileName() const override; |
Peter Kasting
2015/02/25 06:24:57
Same comments as other header
Changwan Ryu
2015/03/02 14:46:37
Done.
|
+ std::string GetDirName() const override; |
+ std::string GetDirFullPath() const override; |
+ |
+ private: |
+ DownloadOverwriteInfoBarDelegateNativeInitiated( |
+ const base::FilePath& suggested_path, |
+ const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback); |
+ |
+ // infobars::InfoBarDelegate: |
Peter Kasting
2015/02/25 06:24:57
See comment in other header re: you no longer inhe
Changwan Ryu
2015/03/02 14:46:37
Done.
|
+ bool ShouldExpire(const infobars::InfoBarDelegate::NavigationDetails& details) |
+ const override; |
+ void InfoBarDismissed() override; |
+ |
+ // Creates a new file in content::BrowserThread::FILE thread, and when it's |
+ // done, calls |callback| in the UI thread. |
Peter Kasting
2015/02/25 06:24:57
Nit: Clearer:
Called on the FILE thread to create
Changwan Ryu
2015/03/02 14:46:37
Done.
|
+ static void CreateNewFileInternal( |
+ const base::FilePath& suggested_download_path, |
+ const DownloadTargetDeterminerDelegate::FileSelectedCallback& callback); |
+ |
+ // The suggested download path from download target determiner. This is used |
+ // to show users the file name and the directory that will be used. |
+ base::FilePath suggested_download_path_; |
+ |
+ // A callback to download target determiner to notify that file selection |
+ // is made (or cancelled). |
+ DownloadTargetDeterminerDelegate::FileSelectedCallback |
+ file_selected_callback_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DownloadOverwriteInfoBarDelegateNativeInitiated); |
+}; |
+ |
+} // namespace android |
+} // namespace chrome |
+ |
+#endif // CHROME_BROWSER_ANDROID_DOWNLOAD_DOWNLOAD_OVERWRITE_INFOBAR_DELEGATE_NATIVE_INITIATED_H_ |