1 // Copyright 2013 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_LOGIN_OAUTH2_LOGIN_MANAGER_FACTORY_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH2_LOGIN_MANAGER_FACTORY_H_
8 #include "base/memory/singleton.h"
9 #include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
11 class BrowserContextKeyedService
;
16 class OAuth2LoginManager
;
18 // Singleton that owns all OAuth2LoginManager and associates them with
19 // Profiles. Listens for the Profile's destruction notification and cleans up
20 // the associated OAuth2LoginManager.
21 class OAuth2LoginManagerFactory
22 : public BrowserContextKeyedServiceFactory
{
24 // Returns the instance of OAuth2LoginManager associated with this
25 // |profile| (creates one if none exists).
26 static OAuth2LoginManager
* GetForProfile(Profile
* profile
);
28 // Returns an instance of the OAuth2LoginManagerFactory singleton.
29 static OAuth2LoginManagerFactory
* GetInstance();
32 friend struct DefaultSingletonTraits
<OAuth2LoginManagerFactory
>;
34 OAuth2LoginManagerFactory();
35 virtual ~OAuth2LoginManagerFactory();
37 // BrowserContextKeyedServiceFactory implementation.
38 virtual BrowserContextKeyedService
* BuildServiceInstanceFor(
39 content::BrowserContext
* context
) const OVERRIDE
;
41 DISALLOW_COPY_AND_ASSIGN(OAuth2LoginManagerFactory
);
44 } // namespace chromeos
46 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_OAUTH2_LOGIN_MANAGER_FACTORY_H_