| 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_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/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // Offliner implementation. | 34 // Offliner implementation. |
| 35 bool LoadAndSave(const SavePageRequest& request, | 35 bool LoadAndSave(const SavePageRequest& request, |
| 36 const CompletionCallback& callback) override; | 36 const CompletionCallback& callback) override; |
| 37 void Cancel() override; | 37 void Cancel() override; |
| 38 | 38 |
| 39 // Allows a loader to be injected for testing. This may only be done once | 39 // Allows a loader to be injected for testing. This may only be done once |
| 40 // and must be called before any of the Offliner interface methods are called. | 40 // and must be called before any of the Offliner interface methods are called. |
| 41 void SetLoaderForTesting(std::unique_ptr<PrerenderingLoader> loader); | 41 void SetLoaderForTesting(std::unique_ptr<PrerenderingLoader> loader); |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 void OnLoadPageDone(const Offliner::CompletionStatus load_status, | 44 void OnLoadPageDone(const Offliner::RequestStatus load_status, |
| 45 content::WebContents* contents); | 45 content::WebContents* contents); |
| 46 | 46 |
| 47 PrerenderingLoader* GetOrCreateLoader(); | 47 PrerenderingLoader* GetOrCreateLoader(); |
| 48 | 48 |
| 49 // Not owned. | 49 // Not owned. |
| 50 content::BrowserContext* browser_context_; | 50 content::BrowserContext* browser_context_; |
| 51 // Not owned. | 51 // Not owned. |
| 52 OfflinePageModel* offline_page_model_; | 52 OfflinePageModel* offline_page_model_; |
| 53 // Lazily created. | 53 // Lazily created. |
| 54 std::unique_ptr<PrerenderingLoader> loader_; | 54 std::unique_ptr<PrerenderingLoader> loader_; |
| 55 base::WeakPtrFactory<PrerenderingOffliner> weak_ptr_factory_; | 55 base::WeakPtrFactory<PrerenderingOffliner> weak_ptr_factory_; |
| 56 | 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(PrerenderingOffliner); | 57 DISALLOW_COPY_AND_ASSIGN(PrerenderingOffliner); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 } // namespace offline_pages | 60 } // namespace offline_pages |
| 61 | 61 |
| 62 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_OFFLINER_H_ | 62 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_OFFLINER_H_ |
| OLD | NEW |