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