| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_HISTORY_TOP_SITES_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_TOP_SITES_FACTORY_H_ |
| 6 #define CHROME_BROWSER_HISTORY_TOP_SITES_FACTORY_H_ | 6 #define CHROME_BROWSER_HISTORY_TOP_SITES_FACTORY_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "components/keyed_service/content/refcounted_browser_context_keyed_serv
ice_factory.h" | 12 #include "components/keyed_service/content/refcounted_browser_context_keyed_serv
ice_factory.h" |
| 13 | 13 |
| 14 class Profile; | 14 class Profile; |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 template <typename T> | 17 template <typename T> |
| 18 struct DefaultSingletonTraits; | 18 struct DefaultSingletonTraits; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace history { | 21 namespace history { |
| 22 struct PrepopulatedPage; | 22 struct PrepopulatedPage; |
| 23 class TopSites; | 23 class TopSites; |
| 24 } | 24 } |
| 25 | 25 |
| 26 class Profile; | 26 class Profile; |
| 27 | 27 |
| 28 // Used for creating and fetching a per-profile instance of the | 28 // Used for creating and fetching a per-profile instance of the TopSites. |
| 29 // TopSites. | |
| 30 class TopSitesFactory : public RefcountedBrowserContextKeyedServiceFactory { | 29 class TopSitesFactory : public RefcountedBrowserContextKeyedServiceFactory { |
| 31 public: | 30 public: |
| 32 // Get the TopSites service for |profile|, creating one if needed. | 31 // Get the TopSites service for |profile|, creating one if needed. |
| 33 static scoped_refptr<history::TopSites> GetForProfile(Profile* profile); | 32 static scoped_refptr<history::TopSites> GetForProfile(Profile* profile); |
| 34 | 33 |
| 35 // Get the singleton instance of the factory. | 34 // Get the singleton instance of the factory. |
| 36 static TopSitesFactory* GetInstance(); | 35 static TopSitesFactory* GetInstance(); |
| 37 | 36 |
| 38 // Creates a TopSites service for |context| with |prepopulated_page_list|. | 37 // Creates a TopSites service for |context| with |prepopulated_page_list|. |
| 39 // Public for testing. | 38 // Public for testing. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 51 scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( | 50 scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( |
| 52 content::BrowserContext* context) const override; | 51 content::BrowserContext* context) const override; |
| 53 void RegisterProfilePrefs( | 52 void RegisterProfilePrefs( |
| 54 user_prefs::PrefRegistrySyncable* registry) override; | 53 user_prefs::PrefRegistrySyncable* registry) override; |
| 55 bool ServiceIsNULLWhileTesting() const override; | 54 bool ServiceIsNULLWhileTesting() const override; |
| 56 | 55 |
| 57 DISALLOW_COPY_AND_ASSIGN(TopSitesFactory); | 56 DISALLOW_COPY_AND_ASSIGN(TopSitesFactory); |
| 58 }; | 57 }; |
| 59 | 58 |
| 60 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_FACTORY_H_ | 59 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_FACTORY_H_ |
| OLD | NEW |