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

Unified Diff: chrome/browser/android/offline_pages/downloads/offline_page_infobar_delegate.cc

Issue 2400213003: [Offline Pages] Fix several infobar bugs. (Closed)
Patch Set: git cl web Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/offline_pages/downloads/offline_page_infobar_delegate.cc
diff --git a/chrome/browser/android/offline_pages/downloads/offline_page_infobar_delegate.cc b/chrome/browser/android/offline_pages/downloads/offline_page_infobar_delegate.cc
index 6b35eba4f99f59a65961214bdc5e4093fc14e5f1..15b32b1bdd1b115f8c4736b1869b30102b391759 100644
--- a/chrome/browser/android/offline_pages/downloads/offline_page_infobar_delegate.cc
+++ b/chrome/browser/android/offline_pages/downloads/offline_page_infobar_delegate.cc
@@ -12,20 +12,25 @@ namespace offline_pages {
// static
void OfflinePageInfoBarDelegate::Create(
- const base::Closure& confirm_continuation,
+ const base::Callback<void(Action)>& confirm_continuation,
+ const std::string& downloads_label,
const std::string& page_name,
content::WebContents* web_contents) {
InfoBarService::FromWebContents(web_contents)
- ->AddInfoBar(DownloadOverwriteInfoBar::CreateInfoBar(base::WrapUnique(
- new OfflinePageInfoBarDelegate(confirm_continuation, page_name))));
+ ->AddInfoBar(DownloadOverwriteInfoBar::CreateInfoBar(
+ base::WrapUnique(new OfflinePageInfoBarDelegate(
+ confirm_continuation, downloads_label, page_name))));
}
OfflinePageInfoBarDelegate::~OfflinePageInfoBarDelegate() {}
OfflinePageInfoBarDelegate::OfflinePageInfoBarDelegate(
- const base::Closure& confirm_continuation,
+ const base::Callback<void(Action)>& confirm_continuation,
+ const std::string& downloads_label,
const std::string& page_name)
- : confirm_continuation_(confirm_continuation), page_name_(page_name) {}
+ : confirm_continuation_(confirm_continuation),
+ downloads_label_(downloads_label),
+ page_name_(page_name) {}
infobars::InfoBarDelegate::InfoBarIdentifier
OfflinePageInfoBarDelegate::GetIdentifier() const {
@@ -41,12 +46,12 @@ bool OfflinePageInfoBarDelegate::EqualsDelegate(
bool OfflinePageInfoBarDelegate::OverwriteExistingFile() {
// TODO(dewittj): Downloads UI intends to remove this functionality.
- confirm_continuation_.Run();
+ confirm_continuation_.Run(Action::OVERWRITE);
return true;
}
bool OfflinePageInfoBarDelegate::CreateNewFile() {
- confirm_continuation_.Run();
+ confirm_continuation_.Run(Action::CONFIRM);
return true;
}
@@ -55,9 +60,7 @@ std::string OfflinePageInfoBarDelegate::GetFileName() const {
}
std::string OfflinePageInfoBarDelegate::GetDirName() const {
- // TODO(dewittj): When the downloads infobar can link to download home, use
- // that link.
- return std::string();
+ return downloads_label_;
}
std::string OfflinePageInfoBarDelegate::GetDirFullPath() const {

Powered by Google App Engine
This is Rietveld 408576698