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

Unified Diff: chrome/browser/offline_items_collection/offline_content_aggregator_factory.cc

Issue 2729983002: Attaches OfflineContentAggregator to Profile (Closed)
Patch Set: Address nit Created 3 years, 9 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/offline_items_collection/offline_content_aggregator_factory.cc
diff --git a/chrome/browser/offline_items_collection/offline_content_aggregator_factory.cc b/chrome/browser/offline_items_collection/offline_content_aggregator_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..398846e73fa926421e7f5b5416271bdcab085e13
--- /dev/null
+++ b/chrome/browser/offline_items_collection/offline_content_aggregator_factory.cc
@@ -0,0 +1,47 @@
+// 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 "chrome/browser/offline_items_collection/offline_content_aggregator_factory.h"
+
+#include "base/memory/singleton.h"
+#include "chrome/browser/profiles/incognito_helpers.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());
+ 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 chrome::GetBrowserContextRedirectedInIncognito(context);
+}
+
+} // namespace offline_items_collection

Powered by Google App Engine
This is Rietveld 408576698