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

Side by Side 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, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_
7
8 #include "base/callback.h"
9 #include "components/offline_pages/background/offliner.h"
10
11 class GURL;
12 class PrerenderManager;
13
14 namespace content {
15 class WebContents;
16 class SessionStorageNamespace;
17 } // namespace content
18
19 namespace gfx {
20 class Size;
21 } // namespace gfx
22
23 namespace offline_pages {
24
25 // A client-side page loader that integrates with the PrerenderManager to do
26 // the page loading in the background.
27 class PrerenderingLoader {
28 public:
29 // Reports status of a load page request with loaded contents if available.
30 typedef base::Callback<void(
31 Offliner::CompletionStatus,
32 content::WebContents*)> LoadPageCallback;
33
34 explicit PrerenderingLoader(PrerenderManager* prerender_manager);
35 ~PrerenderingLoader();
36
37 // Loads a page in the background if possible and returns whether the
38 // request was accepted. If so, the LoadPageCallback will be informed
39 // of status. Only one load request may exist as a time. If a previous
40 // request is still in progress it must be canceled before a new
41 // request will be accepted.
42 bool LoadPage(
43 const GURL& url,
44 content::SessionStorageNamespace* session_storage_namespace,
45 const gfx::Size& size,
46 const LoadPageCallback& callback);
47
48 // Stops (completes or cancels) the load request. Must be called when
49 // LoadPageCallback is done with consuming the contents.
50 // This loader should also be responsible for stopping offline
51 // prerenders when Chrome is transitioned to foreground.
52 void StopLoading();
53
54 private:
55 // Not owned.
56 PrerenderManager* prerender_manager_;
57 };
58
59 } // namespace offline_pages
60
61 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698