Chromium Code Reviews| 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 #include <chrome/browser/android/download/download_overwrite_infobar_delegate_ja va_initiated.h> | |
| 6 #include "base/files/file_util.h" | |
| 7 #include "base/memory/scoped_ptr.h" | |
| 8 #include "base/strings/stringprintf.h" | |
| 9 #include "chrome/browser/infobars/infobar_service.h" | |
| 10 #include "chrome/browser/ui/android/infobars/download_overwrite_infobar.h" | |
| 11 #include "components/infobars/core/infobar.h" | |
| 12 #include "content/public/browser/browser_thread.h" | |
| 13 #include "content/public/browser/web_contents.h" | |
| 14 | |
| 15 namespace chrome { | |
| 16 namespace android { | |
| 17 | |
| 18 DownloadOverwriteInfoBarDelegateJavaInitiated:: | |
| 19 ~DownloadOverwriteInfoBarDelegateJavaInitiated() { | |
| 20 } | |
| 21 | |
| 22 // static | |
| 23 void DownloadOverwriteInfoBarDelegateJavaInitiated::Create( | |
| 24 InfoBarService* infobar_service, | |
| 25 const DownloadOverwriteInfo& download_overwrite_info, | |
| 26 const FileSelectedFromDownloadOverwriteInfoCallback& callback) { | |
| 27 infobar_service->AddInfoBar(DownloadOverwriteInfoBar::CreateInfoBar( | |
| 28 make_scoped_ptr(new DownloadOverwriteInfoBarDelegateJavaInitiated( | |
| 29 download_overwrite_info, callback)))); | |
| 30 } | |
| 31 | |
| 32 void DownloadOverwriteInfoBarDelegateJavaInitiated::OverwriteExistingFile() { | |
| 33 download_overwrite_info_.overwrite = true; | |
| 34 file_selected_callback_.Run(download_overwrite_info_); | |
| 35 } | |
| 36 | |
| 37 void DownloadOverwriteInfoBarDelegateJavaInitiated::CreateNewFile() { | |
| 38 file_selected_callback_.Run(download_overwrite_info_); | |
| 39 } | |
| 40 | |
| 41 std::string DownloadOverwriteInfoBarDelegateJavaInitiated::GetFileName() const { | |
| 42 return download_overwrite_info_.file_name; | |
| 43 } | |
| 44 | |
| 45 std::string DownloadOverwriteInfoBarDelegateJavaInitiated::GetDirName() const { | |
| 46 return download_overwrite_info_.dir_name; | |
| 47 } | |
| 48 std::string DownloadOverwriteInfoBarDelegateJavaInitiated::GetDirFullPath() | |
|
Ted C
2015/02/26 00:57:56
add a blank line above this.
Changwan Ryu
2015/03/02 14:46:36
Done.
| |
| 49 const { | |
| 50 return download_overwrite_info_.dir_full_path; | |
| 51 } | |
| 52 | |
| 53 DownloadOverwriteInfoBarDelegateJavaInitiated:: | |
| 54 DownloadOverwriteInfoBarDelegateJavaInitiated( | |
| 55 const DownloadOverwriteInfo& download_overwrite_info, | |
| 56 const FileSelectedFromDownloadOverwriteInfoCallback& | |
| 57 file_selected_callback) | |
| 58 : download_overwrite_info_(download_overwrite_info), | |
| 59 file_selected_callback_(file_selected_callback) { | |
| 60 } | |
| 61 | |
| 62 bool DownloadOverwriteInfoBarDelegateJavaInitiated::ShouldExpire( | |
| 63 const infobars::InfoBarDelegate::NavigationDetails& details) const { | |
| 64 return false; | |
| 65 } | |
| 66 | |
| 67 void DownloadOverwriteInfoBarDelegateJavaInitiated::InfoBarDismissed() { | |
| 68 download_overwrite_info_.dismissed = true; | |
| 69 file_selected_callback_.Run(download_overwrite_info_); | |
| 70 } | |
| 71 | |
| 72 } // namespace android | |
| 73 } // namespace chrome | |
| OLD | NEW |