Elim cr-checkbox
[chromium-blink-merge.git] / chrome / browser / chromeos / file_system_provider / service_factory.h
blobde5dd330c218346755c7f1fb75f846cfcd56a1cd
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_FACTORY_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_FACTORY_H_
8 #include <map>
9 #include <string>
10 #include <vector>
12 #include "base/memory/singleton.h"
13 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
14 #include "content/public/browser/browser_context.h"
16 namespace chromeos {
17 namespace file_system_provider {
19 class Service;
21 // Creates services per profile.
22 class ServiceFactory : public BrowserContextKeyedServiceFactory {
23 public:
24 // Returns a service instance singleton, after creating it (if necessary).
25 static Service* Get(content::BrowserContext* context);
27 // Returns a service instance for the context if exists. Otherwise, returns
28 // NULL.
29 static Service* FindExisting(content::BrowserContext* context);
31 // Gets a singleton instance of the factory.
32 static ServiceFactory* GetInstance();
34 private:
35 friend struct base::DefaultSingletonTraits<ServiceFactory>;
37 ServiceFactory();
38 ~ServiceFactory() override;
40 // BrowserContextKeyedServiceFactory overrides:
41 KeyedService* BuildServiceInstanceFor(
42 content::BrowserContext* profile) const override;
43 bool ServiceIsCreatedWithBrowserContext() const override;
44 content::BrowserContext* GetBrowserContextToUse(
45 content::BrowserContext* context) const override;
47 DISALLOW_COPY_AND_ASSIGN(ServiceFactory);
50 } // namespace file_system_provider
51 } // namespace chromeos
53 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_SERVICE_FACTORY_H_