| Index: chrome/browser/android/offline_pages/downloads/offline_page_infobar_delegate.h
|
| diff --git a/chrome/browser/android/offline_pages/downloads/offline_page_infobar_delegate.h b/chrome/browser/android/offline_pages/downloads/offline_page_infobar_delegate.h
|
| index 0442df07648d645571109a5990888b05e4d351c8..aaa1980bde31628bce739fce0cb533ad70c44166 100644
|
| --- a/chrome/browser/android/offline_pages/downloads/offline_page_infobar_delegate.h
|
| +++ b/chrome/browser/android/offline_pages/downloads/offline_page_infobar_delegate.h
|
| @@ -15,20 +15,31 @@ class WebContents;
|
|
|
| namespace offline_pages {
|
|
|
| +// An InfoBarDelegate that appears when a user attempt to save offline pages for
|
| +// a URL that is already saved. This piggy-backs off the Download infobar,
|
| +// since the UI should be the same between Downloads and Offline Pages in this
|
| +// case. There are two actions: Create New, and Overwrite. Since Overwrite is
|
| +// not straightforward for offline pages, the behavior is to delete ALL other
|
| +// pages that are saved for the given URL, then save the newly requested page.
|
| class OfflinePageInfoBarDelegate
|
| : public chrome::android::DownloadOverwriteInfoBarDelegate {
|
| public:
|
| + enum class Action { CREATE_NEW, OVERWRITE };
|
| +
|
| // Creates an offline page infobar and a delegate and adds the infobar to the
|
| // InfoBarService associated with |web_contents|. |page_name| is the name
|
| // shown for this file in the infobar text.
|
| - static void Create(const base::Closure& confirm_continuation,
|
| + static void Create(const base::Callback<void(Action)>& confirm_continuation,
|
| + const std::string& downloads_label,
|
| const std::string& page_name,
|
| content::WebContents* web_contents);
|
| ~OfflinePageInfoBarDelegate() override;
|
|
|
| private:
|
| - OfflinePageInfoBarDelegate(const base::Closure& confirm_continuation,
|
| - const std::string& page_name);
|
| + OfflinePageInfoBarDelegate(
|
| + const base::Callback<void(Action)>& confirm_continuation,
|
| + const std::string& downloads_label,
|
| + const std::string& page_name);
|
|
|
| // DownloadOverwriteInfoBarDelegate:
|
| infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
|
| @@ -42,8 +53,9 @@ class OfflinePageInfoBarDelegate
|
| OfflinePageInfoBarDelegate* AsOfflinePageInfoBarDelegate() override;
|
|
|
| // Continuation called when the user chooses to create a new file.
|
| - base::Closure confirm_continuation_;
|
| + base::Callback<void(Action)> confirm_continuation_;
|
|
|
| + std::string downloads_label_;
|
| std::string page_name_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(OfflinePageInfoBarDelegate);
|
|
|