Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(801)

Unified Diff: chrome/browser/android/offline_pages/prerendering_offliner_factory.cc

Issue 1929223002: Add skeletons for the factories to create the request coordinator and (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: After merge Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698