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

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

Issue 2544533003: [OfflinePages] Hook the background loader offliner to the request coordinator based on finch flag s… (Closed)
Patch Set: sort includes Created 4 years 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/background_loader_offliner_factory.cc
diff --git a/chrome/browser/android/offline_pages/background_loader_offliner_factory.cc b/chrome/browser/android/offline_pages/background_loader_offliner_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..839aaa7ef9d23fc4483fa5ba9fba07a6ed7d7511
--- /dev/null
+++ b/chrome/browser/android/offline_pages/background_loader_offliner_factory.cc
@@ -0,0 +1,36 @@
+// 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/background_loader_offliner_factory.h"
+
+#include "chrome/browser/android/offline_pages/background_loader_offliner.h"
+#include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
+
+namespace offline_pages {
+
+class OfflinerPolicy;
+
+BackgroundLoaderOfflinerFactory::BackgroundLoaderOfflinerFactory(
+ content::BrowserContext* context) {
+ offliner_ = nullptr;
+ context_ = context;
+}
+
+BackgroundLoaderOfflinerFactory::~BackgroundLoaderOfflinerFactory() {
+ delete offliner_;
+}
+
+Offliner* BackgroundLoaderOfflinerFactory::GetOffliner(
Pete Williamson 2016/12/17 01:26:26 A test for this method would be good. (It's OK to
chili 2016/12/21 18:01:48 Per discussion, I may be removing the factory alto
+ const OfflinerPolicy* policy) {
+ if (offliner_ == nullptr) {
+ OfflinePageModel* model =
+ OfflinePageModelFactory::GetInstance()->GetForBrowserContext(context_);
+
+ offliner_ = new BackgroundLoaderOffliner(context_, policy, model);
+ }
+
+ return offliner_;
+}
+
+} // namespace offline_pages

Powered by Google App Engine
This is Rietveld 408576698