OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_OFFLINE_ITEMS_COLLECTION_OFFLINE_CONTENT_AGGREGATOR_FACTO
RY_H_ |
| 6 #define CHROME_BROWSER_OFFLINE_ITEMS_COLLECTION_OFFLINE_CONTENT_AGGREGATOR_FACTO
RY_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
| 10 |
| 11 namespace base { |
| 12 template <typename T> |
| 13 struct DefaultSingletonTraits; |
| 14 } // namespace base |
| 15 |
| 16 namespace content { |
| 17 class BrowserContext; |
| 18 } // namespace content |
| 19 |
| 20 namespace offline_items_collection { |
| 21 class OfflineContentAggregator; |
| 22 |
| 23 // This class is the main access point for an OfflineContentAggregator. It is |
| 24 // responsible for building the OfflineContentAggregator and associating it with |
| 25 // a particular content::BrowserContext. |
| 26 class OfflineContentAggregatorFactory |
| 27 : public BrowserContextKeyedServiceFactory { |
| 28 public: |
| 29 // Returns a singleton instance of an OfflineContentAggregatorFactory. |
| 30 static OfflineContentAggregatorFactory* GetInstance(); |
| 31 |
| 32 // Returns the OfflineContentAggregator associated with |context| or creates |
| 33 // and associates one if it doesn't exist. |
| 34 static offline_items_collection::OfflineContentAggregator* |
| 35 GetForBrowserContext(content::BrowserContext* context); |
| 36 |
| 37 private: |
| 38 friend struct base::DefaultSingletonTraits<OfflineContentAggregatorFactory>; |
| 39 |
| 40 OfflineContentAggregatorFactory(); |
| 41 ~OfflineContentAggregatorFactory() override; |
| 42 |
| 43 // BrowserContextKeyedServiceFactory implementation. |
| 44 KeyedService* BuildServiceInstanceFor( |
| 45 content::BrowserContext* context) const override; |
| 46 content::BrowserContext* GetBrowserContextToUse( |
| 47 content::BrowserContext* context) const override; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(OfflineContentAggregatorFactory); |
| 50 }; |
| 51 |
| 52 } // namespace offline_items_collection |
| 53 |
| 54 #endif // CHROME_BROWSER_OFFLINE_ITEMS_COLLECTION_OFFLINE_CONTENT_AGGREGATOR_FA
CTORY_H_ |
OLD | NEW |