OLD | NEW |
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_BACKGROUND_LOADER_OFFLINER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ |
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ | 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_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 "components/offline_pages/content/background_loader/background_loader_c
ontents.h" | 12 #include "components/offline_pages/content/background_loader/background_loader_c
ontents.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_types.h" | 14 #include "components/offline_pages/core/offline_page_types.h" |
15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class BrowserContext; | 18 class BrowserContext; |
19 } // namespace content | 19 } // namespace content |
20 | 20 |
21 namespace offline_pages { | 21 namespace offline_pages { |
22 | 22 |
| 23 class OfflinerPolicy; |
23 class OfflinePageModel; | 24 class OfflinePageModel; |
24 | 25 |
25 // An Offliner implementation that attempts client-side rendering and saving | 26 // An Offliner implementation that attempts client-side rendering and saving |
26 // of an offline page. It uses the BackgroundLoader to load the page and the | 27 // of an offline page. It uses the BackgroundLoader to load the page and the |
27 // OfflinePageModel to save it. Only one request may be active at a time. | 28 // OfflinePageModel to save it. Only one request may be active at a time. |
28 class BackgroundLoaderOffliner : public Offliner, | 29 class BackgroundLoaderOffliner : public Offliner, |
29 public content::WebContentsObserver { | 30 public content::WebContentsObserver { |
30 public: | 31 public: |
31 BackgroundLoaderOffliner(content::BrowserContext* browser_context, | 32 BackgroundLoaderOffliner(content::BrowserContext* browser_context, |
| 33 const OfflinerPolicy* policy, |
32 OfflinePageModel* offline_page_model); | 34 OfflinePageModel* offline_page_model); |
33 ~BackgroundLoaderOffliner() override; | 35 ~BackgroundLoaderOffliner() override; |
34 | 36 |
35 // Offliner implementation. | 37 // Offliner implementation. |
36 bool LoadAndSave(const SavePageRequest& request, | 38 bool LoadAndSave(const SavePageRequest& request, |
37 const CompletionCallback& callback) override; | 39 const CompletionCallback& callback) override; |
38 void Cancel() override; | 40 void Cancel() override; |
39 | 41 |
40 // WebContentsObserver implementation. | 42 // WebContentsObserver implementation. |
41 void DidStopLoading() override; | 43 void DidStopLoading() override; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 bool is_low_end_device_; | 75 bool is_low_end_device_; |
74 // Save state. | 76 // Save state. |
75 SaveState save_state_; | 77 SaveState save_state_; |
76 | 78 |
77 base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_; | 79 base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_; |
78 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner); | 80 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner); |
79 }; | 81 }; |
80 | 82 |
81 } // namespace offline_pages | 83 } // namespace offline_pages |
82 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ | 84 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ |
OLD | NEW |