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

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

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.h
diff --git a/chrome/browser/previews/previews_service_factory.h b/chrome/browser/previews/previews_service_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..7a9d2ee37784c662c6ad060f87807c908b8fbd99
--- /dev/null
+++ b/chrome/browser/previews/previews_service_factory.h
@@ -0,0 +1,40 @@
+// 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.
+
+#ifndef CHROME_BROWSER_PREVIEWS_PREVIEWS_SERVICE_FACTORY_H_
+#define CHROME_BROWSER_PREVIEWS_PREVIEWS_SERVICE_FACTORY_H_
+
+#include "base/memory/singleton.h"
Lei Zhang 2016/09/08 19:06:23 Please read the top of singleton.h. Can you use a
RyanSturm 2016/09/08 20:19:09 Done.
Lei Zhang 2016/09/08 21:31:56 Thanks. I realize someone implemented the first on
+#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
+
+class Profile;
Lei Zhang 2016/09/08 19:06:23 Group this with the PreviewService fwrd decl.
RyanSturm 2016/09/08 20:19:09 Done.
+
+namespace content {
+class BrowserContext;
+}
+
+class PreviewsService;
+
+// Singleton that owns all PreviewsServices and associates them with
+// Profiles.
+class PreviewsServiceFactory : public BrowserContextKeyedServiceFactory {
+ public:
+ // Gets the PreviewsService instance for |profile|.
+ static PreviewsService* GetForProfile(Profile* profile);
+
+ // Gets the Singleton that owns all all PreviewsServices.
+ static PreviewsServiceFactory* GetInstance();
+
+ private:
+ friend struct base::DefaultSingletonTraits<PreviewsServiceFactory>;
+
+ PreviewsServiceFactory();
+ ~PreviewsServiceFactory() override;
+
+ // BrowserContextKeyedServiceFactory:
+ KeyedService* BuildServiceInstanceFor(
+ content::BrowserContext* context) const override;
+};
+
+#endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_SERVICE_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698