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

Side by Side Diff: chrome/browser/android/offline_pages/prerendering_offliner.h

Issue 2624523003: [Offline Pages] Remove need for OfflinePolicy when constructing an Offliner. (Closed)
Patch Set: Created 3 years, 11 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_OFFLINER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_OFFLINER_H_
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_OFFLINER_H_ 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_OFFLINER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/android/application_status_listener.h" 10 #include "base/android/application_status_listener.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/android/offline_pages/prerendering_loader.h" 12 #include "chrome/browser/android/offline_pages/prerendering_loader.h"
13 #include "components/offline_pages/core/background/offliner.h" 13 #include "components/offline_pages/core/background/offliner.h"
14 #include "components/offline_pages/core/offline_page_model.h" 14 #include "components/offline_pages/core/offline_page_model.h"
15 #include "components/offline_pages/core/offline_page_types.h" 15 #include "components/offline_pages/core/offline_page_types.h"
16 16
17 namespace content { 17 namespace content {
18 class BrowserContext; 18 class BrowserContext;
19 class WebContents; 19 class WebContents;
20 } // namespace content 20 } // namespace content
21 21
22 namespace offline_pages { 22 namespace offline_pages {
23 23
24 class OfflinerPolicy;
25
26 // An Offliner implementation that attempts client-side rendering and saving 24 // An Offliner implementation that attempts client-side rendering and saving
27 // of an offline page. It uses the PrerenderingLoader to load the page and 25 // of an offline page. It uses the PrerenderingLoader to load the page and
28 // the OfflinePageModel to save it. Only one request may be active at a time. 26 // the OfflinePageModel to save it. Only one request may be active at a time.
29 class PrerenderingOffliner : public Offliner { 27 class PrerenderingOffliner : public Offliner {
30 public: 28 public:
31 PrerenderingOffliner(content::BrowserContext* browser_context, 29 PrerenderingOffliner(content::BrowserContext* browser_context,
32 const OfflinerPolicy* policy,
33 OfflinePageModel* offline_page_model); 30 OfflinePageModel* offline_page_model);
34 ~PrerenderingOffliner() override; 31 ~PrerenderingOffliner() override;
35 32
36 // Offliner implementation. 33 // Offliner implementation.
37 bool LoadAndSave(const SavePageRequest& request, 34 bool LoadAndSave(const SavePageRequest& request,
38 const CompletionCallback& callback) override; 35 const CompletionCallback& callback) override;
39 void Cancel() override; 36 void Cancel() override;
40 37
41 // Allows a loader to be injected for testing. This may only be done once 38 // Allows a loader to be injected for testing. This may only be done once
42 // and must be called before any of the Offliner interface methods are called. 39 // and must be called before any of the Offliner interface methods are called.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // ApplicationStatusListener to monitor if the Chrome moves to the foreground. 86 // ApplicationStatusListener to monitor if the Chrome moves to the foreground.
90 std::unique_ptr<base::android::ApplicationStatusListener> app_listener_; 87 std::unique_ptr<base::android::ApplicationStatusListener> app_listener_;
91 base::WeakPtrFactory<PrerenderingOffliner> weak_ptr_factory_; 88 base::WeakPtrFactory<PrerenderingOffliner> weak_ptr_factory_;
92 89
93 DISALLOW_COPY_AND_ASSIGN(PrerenderingOffliner); 90 DISALLOW_COPY_AND_ASSIGN(PrerenderingOffliner);
94 }; 91 };
95 92
96 } // namespace offline_pages 93 } // namespace offline_pages
97 94
98 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_OFFLINER_H_ 95 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_OFFLINER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698