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

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

Issue 1915983008: Adds shells of classes (PrerenderingOffliner and PrerenderingLoader) to intergrate from Background … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback updates and added comments on Loader methods Created 4 years, 8 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/prerendering_loader.h
diff --git a/chrome/browser/android/offline_pages/prerendering_loader.h b/chrome/browser/android/offline_pages/prerendering_loader.h
new file mode 100644
index 0000000000000000000000000000000000000000..5aaf94d211a869888a5d1a2a49a82f215d52508f
--- /dev/null
+++ b/chrome/browser/android/offline_pages/prerendering_loader.h
@@ -0,0 +1,61 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_
+#define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_
+
+#include "base/callback.h"
+#include "components/offline_pages/background/offliner.h"
+
+class GURL;
+class PrerenderManager;
+
+namespace content {
+class WebContents;
+class SessionStorageNamespace;
+} // namespace content
+
+namespace gfx {
+class Size;
+} // namespace gfx
+
+namespace offline_pages {
+
+// A client-side page loader that integrates with the PrerenderManager to do
+// the page loading in the background.
+class PrerenderingLoader {
+ public:
+ // Reports status of a load page request with loaded contents if available.
+ typedef base::Callback<void(
+ Offliner::CompletionStatus,
+ content::WebContents*)> LoadPageCallback;
+
+ explicit PrerenderingLoader(PrerenderManager* prerender_manager);
+ ~PrerenderingLoader();
+
+ // Loads a page in the background if possible and returns whether the
+ // request was accepted. If so, the LoadPageCallback will be informed
+ // of status. Only one load request may exist as a time. If a previous
+ // request is still in progress it must be canceled before a new
+ // request will be accepted.
+ bool LoadPage(
+ const GURL& url,
+ content::SessionStorageNamespace* session_storage_namespace,
+ const gfx::Size& size,
+ const LoadPageCallback& callback);
+
+ // Stops (completes or cancels) the load request. Must be called when
+ // LoadPageCallback is done with consuming the contents.
+ // This loader should also be responsible for stopping offline
+ // prerenders when Chrome is transitioned to foreground.
+ void StopLoading();
+
+ private:
+ // Not owned.
+ PrerenderManager* prerender_manager_;
+};
+
+} // namespace offline_pages
+
+#endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_

Powered by Google App Engine
This is Rietveld 408576698