| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_TABS_PINNED_TAB_SERVICE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_UI_TABS_PINNED_TAB_SERVICE_FACTORY_H_ |
| 6 #define CHROME_BROWSER_UI_TABS_PINNED_TAB_SERVICE_FACTORY_H_ | 6 #define CHROME_BROWSER_UI_TABS_PINNED_TAB_SERVICE_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 10 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
| 11 | 11 |
| 12 class PinnedTabService; | 12 class PinnedTabService; |
| 13 class Profile; | 13 class Profile; |
| 14 | 14 |
| 15 // Singleton that owns all PinnedTabServices and associates them with Profiles. | 15 // Singleton that owns all PinnedTabServices and associates them with Profiles. |
| 16 // Listens for the Profile's destruction notification and cleans up the | 16 // Listens for the Profile's destruction notification and cleans up the |
| 17 // associated PinnedTabService. | 17 // associated PinnedTabService. |
| 18 class PinnedTabServiceFactory : public BrowserContextKeyedServiceFactory { | 18 class PinnedTabServiceFactory : public BrowserContextKeyedServiceFactory { |
| 19 public: | 19 public: |
| 20 // Returns the PinnedTabService that tracks pinning changes for |profile|. | 20 // Returns the PinnedTabService that tracks pinning changes for |profile|. |
| 21 static PinnedTabService* GetForProfile(Profile* profile); | 21 static PinnedTabService* GetForProfile(Profile* profile); |
| 22 | 22 |
| 23 static PinnedTabServiceFactory* GetInstance(); | 23 static PinnedTabServiceFactory* GetInstance(); |
| 24 | 24 |
| 25 private: | 25 private: |
| 26 friend struct DefaultSingletonTraits<PinnedTabServiceFactory>; | 26 friend struct base::DefaultSingletonTraits<PinnedTabServiceFactory>; |
| 27 | 27 |
| 28 PinnedTabServiceFactory(); | 28 PinnedTabServiceFactory(); |
| 29 ~PinnedTabServiceFactory() override; | 29 ~PinnedTabServiceFactory() override; |
| 30 | 30 |
| 31 // BrowserContextKeyedServiceFactory: | 31 // BrowserContextKeyedServiceFactory: |
| 32 KeyedService* BuildServiceInstanceFor( | 32 KeyedService* BuildServiceInstanceFor( |
| 33 content::BrowserContext* profile) const override; | 33 content::BrowserContext* profile) const override; |
| 34 bool ServiceIsCreatedWithBrowserContext() const override; | 34 bool ServiceIsCreatedWithBrowserContext() const override; |
| 35 bool ServiceIsNULLWhileTesting() const override; | 35 bool ServiceIsNULLWhileTesting() const override; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 #endif // CHROME_BROWSER_UI_TABS_PINNED_TAB_SERVICE_FACTORY_H_ | 38 #endif // CHROME_BROWSER_UI_TABS_PINNED_TAB_SERVICE_FACTORY_H_ |
| OLD | NEW |