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

Unified Diff: components/offline_items_collection/content/offline_content_aggregator_factory.cc

Issue 2729983002: Attaches OfflineContentAggregator to Profile (Closed)
Patch Set: Created 3 years, 10 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: components/offline_items_collection/content/offline_content_aggregator_factory.cc
diff --git a/components/offline_items_collection/content/offline_content_aggregator_factory.cc b/components/offline_items_collection/content/offline_content_aggregator_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..601cdc5cc3e39124007a4d50dc7edeb037c5ff96
--- /dev/null
+++ b/components/offline_items_collection/content/offline_content_aggregator_factory.cc
@@ -0,0 +1,46 @@
+// Copyright 2017 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 "components/offline_items_collection/content/offline_content_aggregator_factory.h"
+
+#include "base/memory/singleton.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "components/offline_items_collection/core/offline_content_aggregator.h"
+#include "content/public/browser/browser_context.h"
+
+namespace offline_items_collection {
+
+// static
+OfflineContentAggregatorFactory*
+OfflineContentAggregatorFactory::GetInstance() {
+ return base::Singleton<OfflineContentAggregatorFactory>::get();
+}
+
+// static
+OfflineContentAggregator* OfflineContentAggregatorFactory::GetForBrowserContext(
+ content::BrowserContext* context) {
+ DCHECK(!context->IsOffTheRecord());
Dmitry Titov 2017/03/08 00:46:00 It is unclear if you want the service to be create
David Trainor- moved to gerrit 2017/03/09 18:44:40 Ah nice catch sorry! I was messing around with th
+ return static_cast<offline_items_collection::OfflineContentAggregator*>(
+ GetInstance()->GetServiceForBrowserContext(context, true));
+}
+
+OfflineContentAggregatorFactory::OfflineContentAggregatorFactory()
+ : BrowserContextKeyedServiceFactory(
+ "offline_items_collection::OfflineContentAggregator",
+ BrowserContextDependencyManager::GetInstance()) {}
+
+OfflineContentAggregatorFactory::~OfflineContentAggregatorFactory() = default;
+
+KeyedService* OfflineContentAggregatorFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ return new offline_items_collection::OfflineContentAggregator();
+}
+
+content::BrowserContext*
+OfflineContentAggregatorFactory::GetBrowserContextToUse(
+ content::BrowserContext* context) const {
+ return context;
+}
+
+} // namespace offline_items_collection

Powered by Google App Engine
This is Rietveld 408576698