OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SIGNIN_GAIA_COOKIE_MANAGER_SERVICE_FACTORY_H_ | 5 #ifndef IOS_CHROME_BROWSER_SIGNIN_GAIA_COOKIE_MANAGER_SERVICE_FACTORY_H_ |
6 #define CHROME_BROWSER_SIGNIN_GAIA_COOKIE_MANAGER_SERVICE_FACTORY_H_ | 6 #define IOS_CHROME_BROWSER_SIGNIN_GAIA_COOKIE_MANAGER_SERVICE_FACTORY_H_ |
7 | 7 |
8 #include "base/memory/singleton.h" | 8 #include "base/macros.h" |
9 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" |
10 | 11 |
| 12 template <typename T> |
| 13 struct DefaultSingletonTraits; |
11 class GaiaCookieManagerService; | 14 class GaiaCookieManagerService; |
12 class Profile; | 15 |
| 16 namespace ios { |
| 17 |
| 18 class ChromeBrowserState; |
13 | 19 |
14 // Singleton that owns the GaiaCookieManagerService(s) and associates them with | 20 // Singleton that owns the GaiaCookieManagerService(s) and associates them with |
15 // Profiles. Listens for the Profile's destruction notification and cleans up. | 21 // Profiles. Listens for the Profile's destruction notification and cleans up. |
16 class GaiaCookieManagerServiceFactory : | 22 class GaiaCookieManagerServiceFactory : public BrowserStateKeyedServiceFactory { |
17 public BrowserContextKeyedServiceFactory { | |
18 public: | 23 public: |
19 // Returns the instance of GaiaCookieManagerService associated with this | 24 // Returns the instance of GaiaCookieManagerService associated with this |
20 // profile (creating one if none exists). Returns NULL if this profile cannot | 25 // profile (creating one if none exists). Returns NULL if this profile cannot |
21 // have an GaiaCookieManagerService (for example, if |profile| is incognito). | 26 // have an GaiaCookieManagerService (for example, if |profile| is incognito). |
22 static GaiaCookieManagerService* GetForProfile(Profile* profile); | 27 static GaiaCookieManagerService* GetForBrowserState( |
| 28 ios::ChromeBrowserState* browser_state); |
23 | 29 |
24 // Returns an instance of the factory singleton. | 30 // Returns an instance of the factory singleton. |
25 static GaiaCookieManagerServiceFactory* GetInstance(); | 31 static GaiaCookieManagerServiceFactory* GetInstance(); |
26 | 32 |
27 private: | 33 private: |
28 friend struct DefaultSingletonTraits<GaiaCookieManagerServiceFactory>; | 34 friend struct DefaultSingletonTraits<GaiaCookieManagerServiceFactory>; |
29 | 35 |
30 GaiaCookieManagerServiceFactory(); | 36 GaiaCookieManagerServiceFactory(); |
31 ~GaiaCookieManagerServiceFactory() override; | 37 ~GaiaCookieManagerServiceFactory() override; |
32 | 38 |
33 // BrowserContextKeyedServiceFactory: | 39 // BrowserStateKeyedServiceFactory: |
34 KeyedService* BuildServiceInstanceFor( | 40 scoped_ptr<KeyedService> BuildServiceInstanceFor( |
35 content::BrowserContext* profile) const override; | 41 web::BrowserState* context) const override; |
36 void RegisterProfilePrefs( | 42 |
37 user_prefs::PrefRegistrySyncable* registry) override; | 43 DISALLOW_COPY_AND_ASSIGN(GaiaCookieManagerServiceFactory); |
38 }; | 44 }; |
39 | 45 |
40 #endif // CHROME_BROWSER_SIGNIN_GAIA_COOKIE_MANAGER_SERVICE_FACTORY_H_ | 46 } // namespace ios |
| 47 |
| 48 #endif // IOS_CHROME_BROWSER_SIGNIN_GAIA_COOKIE_MANAGER_SERVICE_FACTORY_H_ |
OLD | NEW |