OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/android/offline_pages/prerendering_offliner_factory.h" | |
6 | |
7 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" | |
8 #include "chrome/browser/android/offline_pages/prerendering_offliner.h" | |
9 | |
10 namespace offline_pages { | |
11 | |
12 class OfflinerPolicy; | |
13 | |
14 PrerenderingOfflinerFactory::PrerenderingOfflinerFactory( | |
15 content::BrowserContext* context) { | |
16 offliner_ = nullptr; | |
17 context_ = context; | |
18 } | |
19 | |
20 PrerenderingOfflinerFactory::~PrerenderingOfflinerFactory() { | |
21 delete offliner_; | |
22 } | |
23 | |
24 // static | |
25 PrerenderingOffliner* PrerenderingOfflinerFactory::GetOffliner( | |
26 const OfflinerPolicy* policy) { | |
27 // TODO(petewil): Think about whether there might be any threading | |
28 // issues. This should always happen on the same thread, but make sure. | |
29 | |
30 // Build a prerendering offliner if we don't already have one cached. | |
31 if (offliner_ == nullptr) { | |
32 // TODO(petewil): Create a PrerenderMaanger, use for 2nd arg below | |
dougarnett
2016/05/03 18:32:40
will be replacing PrerenderManager ctor arg with B
Pete Williamson
2016/05/03 21:34:42
Acknowledged.
| |
33 | |
34 // Get a pointer to the (unowned) offline page model. | |
35 OfflinePageModel* model = | |
36 OfflinePageModelFactory::GetInstance()->GetForBrowserContext(context_); | |
37 | |
38 offliner_ = new PrerenderingOffliner(policy, nullptr, model); | |
39 } | |
40 return offliner_; | |
41 } | |
42 | |
43 } // namespace offline_pages | |
OLD | NEW |