Chromium Code Reviews| Index: chrome/browser/android/offline_pages/prerendering_offliner_factory.cc |
| diff --git a/chrome/browser/android/offline_pages/prerendering_offliner_factory.cc b/chrome/browser/android/offline_pages/prerendering_offliner_factory.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2e5d5c373357e3ec219ae7057a15d39e7bdbaed4 |
| --- /dev/null |
| +++ b/chrome/browser/android/offline_pages/prerendering_offliner_factory.cc |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/android/offline_pages/prerendering_offliner_factory.h" |
| + |
| +#include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
| +#include "chrome/browser/android/offline_pages/prerendering_offliner.h" |
| + |
| +namespace offline_pages { |
| + |
| +class OfflinerPolicy; |
| + |
| +PrerenderingOfflinerFactory::PrerenderingOfflinerFactory( |
| + content::BrowserContext* context) { |
| + offliner_ = nullptr; |
| + context_ = context; |
| +} |
| + |
| +PrerenderingOfflinerFactory::~PrerenderingOfflinerFactory() { |
| + delete offliner_; |
| +} |
| + |
| +// static |
| +PrerenderingOffliner* PrerenderingOfflinerFactory::GetOffliner( |
| + const OfflinerPolicy* policy) { |
| + // TODO(petewil): Think about whether there might be any threading |
| + // issues. This should always happen on the same thread, but make sure. |
| + |
| + // Build a prerendering offliner if we don't already have one cached. |
| + if (offliner_ == nullptr) { |
| + // 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.
|
| + |
| + // Get a pointer to the (unowned) offline page model. |
| + OfflinePageModel* model = |
| + OfflinePageModelFactory::GetInstance()->GetForBrowserContext(context_); |
| + |
| + offliner_ = new PrerenderingOffliner(policy, nullptr, model); |
| + } |
| + return offliner_; |
| +} |
| + |
| +} // namespace offline_pages |