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

Unified Diff: chrome/browser/previews/previews_service_factory.cc

Issue 2300213002: Adding an IO Data and keyed service to previews/ (Closed)
Patch Set: adding an owners file Created 4 years, 3 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/previews/previews_service_factory.cc
diff --git a/chrome/browser/previews/previews_service_factory.cc b/chrome/browser/previews/previews_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c0bfa5018f416364971ec4908cea4e71b455ad66
--- /dev/null
+++ b/chrome/browser/previews/previews_service_factory.cc
@@ -0,0 +1,34 @@
+// 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/previews/previews_service_factory.h"
+
+#include "chrome/browser/previews/previews_service.h"
+#include "chrome/browser/profiles/profile.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "content/public/browser/browser_context.h"
+
+// static
+PreviewsService* PreviewsServiceFactory::GetForProfile(Profile* profile) {
+ DCHECK_NE(profile->GetProfileType(), Profile::INCOGNITO_PROFILE);
+ return static_cast<PreviewsService*>(
+ GetInstance()->GetServiceForBrowserContext(profile, true));
+}
+
+// static
+PreviewsServiceFactory* PreviewsServiceFactory::GetInstance() {
+ return base::Singleton<PreviewsServiceFactory>::get();
+}
+
+PreviewsServiceFactory::PreviewsServiceFactory()
+ : BrowserContextKeyedServiceFactory(
+ "PreviewsService",
+ BrowserContextDependencyManager::GetInstance()) {}
+
+PreviewsServiceFactory::~PreviewsServiceFactory() {}
+
+KeyedService* PreviewsServiceFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ return new PreviewsService();
+}

Powered by Google App Engine
This is Rietveld 408576698