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

Unified Diff: components/offline_pages/offline_page_model.h

Issue 2484223005: Store original request URL in offline page metadata table (Closed)
Patch Set: Address feedback Created 4 years, 1 month 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: components/offline_pages/offline_page_model.h
diff --git a/components/offline_pages/offline_page_model.h b/components/offline_pages/offline_page_model.h
index 4222b53917dd5cfd5aa95916c6aea2a670b35d64..4c422f243deaf612dfdec5d71ace2a10f4755d10 100644
--- a/components/offline_pages/offline_page_model.h
+++ b/components/offline_pages/offline_page_model.h
@@ -47,6 +47,25 @@ struct OfflinePageItem;
// * how to cancel requests and what to expect
class OfflinePageModel : public base::SupportsUserData {
public:
+ // Describes the parameters to control how to save a page.
+ struct SavePageParams {
+ SavePageParams();
+ SavePageParams(const SavePageParams& other);
+
+ // The last committed URL of the page to save.
+ GURL url;
+
+ // The identification used by the client.
+ ClientId client_id;
+
+ // Used for the offline_id for the saved file if non-zero. If it is
+ // kInvalidOfflineId, a new, random ID will be generated.
+ int64_t proposed_offline_id;
+
+ // The original URL of the page to save. Empty if no redirect occurs.
+ GURL original_url;
+ };
+
// Observer of the OfflinePageModel.
class Observer {
public:
@@ -83,14 +102,10 @@ class OfflinePageModel : public base::SupportsUserData {
static const int64_t kInvalidOfflineId = 0;
- // Attempts to save a page addressed by |url| offline. Requires that the model
- // is loaded. Generates a new offline id and returns
- // it. |proposed_offline_id| is used for the offline_id for the saved file if
- // it is non-zero. If it is kInvalidOfflineId, a new, random ID will be
- // generated.
- virtual void SavePage(const GURL& url,
- const ClientId& client_id,
- int64_t proposed_offline_id,
+ // Attempts to save a page offline per |save_page_params|. Requires that the
+ // model is loaded. Generates a new offline id or uses the proposed offline
+ // id in |save_page_params| and returns it.
+ virtual void SavePage(const SavePageParams& save_page_params,
std::unique_ptr<OfflinePageArchiver> archiver,
const SavePageCallback& callback) = 0;
« no previous file with comments | « components/offline_pages/offline_page_metadata_store_sql.cc ('k') | components/offline_pages/offline_page_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698