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_DOWNLOAD_DOWNLOAD_SERVICE_FACTORY_H_ |
| 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_FACTORY_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 download { |
| 21 class DownloadService; |
| 22 } // namespace download |
| 23 |
| 24 // DownloadServiceFactory is the main client class for interaction with the |
| 25 // download component. |
| 26 class DownloadServiceFactory : public BrowserContextKeyedServiceFactory { |
| 27 public: |
| 28 // Returns singleton instance of DownloadServiceFactory. |
| 29 static DownloadServiceFactory* GetInstance(); |
| 30 |
| 31 // Returns the DownloadService associated with |context|. |
| 32 static download::DownloadService* GetForBrowserContext( |
| 33 content::BrowserContext* context); |
| 34 |
| 35 private: |
| 36 friend struct base::DefaultSingletonTraits<DownloadServiceFactory>; |
| 37 |
| 38 DownloadServiceFactory(); |
| 39 ~DownloadServiceFactory() override; |
| 40 |
| 41 // BrowserContextKeyedServiceFactory overrides: |
| 42 KeyedService* BuildServiceInstanceFor( |
| 43 content::BrowserContext* context) const override; |
| 44 content::BrowserContext* GetBrowserContextToUse( |
| 45 content::BrowserContext* context) const override; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(DownloadServiceFactory); |
| 48 }; |
| 49 |
| 50 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_FACTORY_H_ |
OLD | NEW |