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 #include "chrome/browser/android/offline_pages/prerendering_offliner_factory.h" | 5 #include "chrome/browser/android/offline_pages/prerendering_offliner_factory.h" |
6 | 6 |
7 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" | 7 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
8 #include "chrome/browser/android/offline_pages/prerendering_offliner.h" | 8 #include "chrome/browser/android/offline_pages/prerendering_offliner.h" |
9 | 9 |
10 namespace offline_pages { | 10 namespace offline_pages { |
(...skipping 16 matching lines...) Expand all Loading... |
27 // TODO(petewil): Think about whether there might be any threading | 27 // TODO(petewil): Think about whether there might be any threading |
28 // issues. This should always happen on the same thread, but make sure. | 28 // issues. This should always happen on the same thread, but make sure. |
29 | 29 |
30 // Build a prerendering offliner if we don't already have one cached. | 30 // Build a prerendering offliner if we don't already have one cached. |
31 if (offliner_ == nullptr) { | 31 if (offliner_ == nullptr) { |
32 // TODO(petewil): Create a PrerenderManager, use for 2nd arg below. | 32 // TODO(petewil): Create a PrerenderManager, use for 2nd arg below. |
33 | 33 |
34 // Get a pointer to the (unowned) offline page model. | 34 // Get a pointer to the (unowned) offline page model. |
35 OfflinePageModel* model = | 35 OfflinePageModel* model = |
36 OfflinePageModelFactory::GetInstance()->GetForBrowserContext(context_); | 36 OfflinePageModelFactory::GetInstance()->GetForBrowserContext(context_); |
37 | 37 // Ensure we do have a model for saving a page if we prerender it. |
| 38 DCHECK(model) << "No OfflinePageModel for offliner"; |
38 offliner_ = new PrerenderingOffliner(context_, policy, model); | 39 offliner_ = new PrerenderingOffliner(context_, policy, model); |
39 } | 40 } |
40 | 41 |
41 return offliner_; | 42 return offliner_; |
42 } | 43 } |
43 | 44 |
44 } // namespace offline_pages | 45 } // namespace offline_pages |
OLD | NEW |