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

Unified Diff: chrome/browser/android/offline_pages/background_loader_offliner.h

Issue 2769043002: [Offline pages] Integrate snapshot controller fully into background loader. (Closed)
Patch Set: added comment and reset Created 3 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/background_loader_offliner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/offline_pages/background_loader_offliner.h
diff --git a/chrome/browser/android/offline_pages/background_loader_offliner.h b/chrome/browser/android/offline_pages/background_loader_offliner.h
index 802294215206f0a6d55fd0e5f9a773a9c6f17ba8..608e88b3006ca0ad23cd68f24e26fb76b6f01961 100644
--- a/chrome/browser/android/offline_pages/background_loader_offliner.h
+++ b/chrome/browser/android/offline_pages/background_loader_offliner.h
@@ -12,6 +12,7 @@
#include "components/offline_pages/content/background_loader/background_loader_contents.h"
#include "components/offline_pages/core/background/offliner.h"
#include "components/offline_pages/core/offline_page_types.h"
+#include "components/offline_pages/core/snapshot_controller.h"
#include "content/public/browser/web_contents_observer.h"
namespace content {
@@ -27,7 +28,8 @@ class OfflinePageModel;
// of an offline page. It uses the BackgroundLoader to load the page and the
// OfflinePageModel to save it. Only one request may be active at a time.
class BackgroundLoaderOffliner : public Offliner,
- public content::WebContentsObserver {
+ public content::WebContentsObserver,
+ public SnapshotController::Client {
public:
BackgroundLoaderOffliner(content::BrowserContext* browser_context,
const OfflinerPolicy* policy,
@@ -45,12 +47,16 @@ class BackgroundLoaderOffliner : public Offliner,
bool HandleTimeout(const SavePageRequest& request) override;
// WebContentsObserver implementation.
+ void DocumentLoadedInFrame(content::RenderFrameHost* render_frame) override;
void DidStopLoading() override;
void RenderProcessGone(base::TerminationStatus status) override;
void WebContentsDestroyed() override;
void DidFinishNavigation(
content::NavigationHandle* navigation_handle) override;
+ // SnapshotController::Client implementation.
+ void StartSnapshot() override;
+
void SetPageDelayForTest(long delay_ms);
void OnNetworkBytesChanged(int64_t bytes);
@@ -64,9 +70,6 @@ class BackgroundLoaderOffliner : public Offliner,
enum SaveState { NONE, SAVING, DELETE_AFTER_SAVE };
enum PageLoadState { SUCCESS, RETRIABLE, NONRETRIABLE, DELAY_RETRY };
- // Called when the page is ready to be saved.
- void SavePage();
-
// Called when the page has been saved.
void OnPageSaved(SavePageResult save_result, int64_t offline_id);
@@ -83,6 +86,8 @@ class BackgroundLoaderOffliner : public Offliner,
OfflinePageModel* offline_page_model_;
// Tracks pending request, if any.
std::unique_ptr<SavePageRequest> pending_request_;
+ // Handles determining when a page should be snapshotted.
+ std::unique_ptr<SnapshotController> snapshot_controller_;
// Callback when pending request completes.
CompletionCallback completion_callback_;
// Callback to report progress.
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/background_loader_offliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698