Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_ANDROID_OFFLINE_PAGES_REQUEST_COORDINATOR_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_REQUEST_COORDINATOR_FACTORY_H_ |
| 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_REQUEST_COORDINATOR_FACTORY_H_ | 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_REQUEST_COORDINATOR_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" | 9 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" |
| 10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 template <typename T> | 13 template <typename T> |
| 14 struct DefaultSingletonTraits; | 14 struct DefaultSingletonTraits; |
| 15 } // namespace base | 15 } // namespace base |
| 16 | 16 |
| 17 namespace offline_pages { | 17 namespace offline_pages { |
| 18 | 18 |
| 19 class RequestCoordinator; | 19 class RequestCoordinator; |
| 20 | 20 |
| 21 // A factory to create one unique RequestCoordinator. | 21 // A factory to create one unique RequestCoordinator. |
| 22 class RequestCoordinatorFactory : public BrowserContextKeyedServiceFactory { | 22 class RequestCoordinatorFactory : public BrowserContextKeyedServiceFactory { |
| 23 public: | 23 public: |
| 24 static RequestCoordinatorFactory* GetInstance(); | 24 static RequestCoordinatorFactory* GetInstance(); |
| 25 static RequestCoordinator* GetForBrowserContext( | 25 static RequestCoordinator* GetForBrowserContext( |
| 26 content::BrowserContext* context); | 26 content::BrowserContext* context); |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 friend struct base::DefaultSingletonTraits<RequestCoordinatorFactory>; | 29 friend struct base::DefaultSingletonTraits<RequestCoordinatorFactory>; |
| 30 friend class RecentTabHelperTest; | |
| 30 | 31 |
| 31 RequestCoordinatorFactory(); | 32 RequestCoordinatorFactory(); |
| 32 ~RequestCoordinatorFactory() override {} | 33 ~RequestCoordinatorFactory() override {} |
| 33 | 34 |
| 34 KeyedService* BuildServiceInstanceFor( | 35 KeyedService* BuildServiceInstanceFor( |
| 35 content::BrowserContext* context) const override; | 36 content::BrowserContext* context) const override; |
| 36 | 37 |
| 38 // Used to always return nullptr instances while running tests. | |
| 39 void ReturnNullptrForTesting(bool enabled) { always_nullptr_ = enabled; } | |
|
fgorski
2016/12/13 17:17:38
I don't think changing anything about request coor
carlosk
2016/12/13 20:04:20
Done. Thanks for pointing it out. I did not know a
| |
| 40 | |
| 41 bool always_nullptr_ = false; | |
| 42 | |
| 37 DISALLOW_COPY_AND_ASSIGN(RequestCoordinatorFactory); | 43 DISALLOW_COPY_AND_ASSIGN(RequestCoordinatorFactory); |
| 38 }; | 44 }; |
| 39 | 45 |
| 40 } // namespace offline_pages | 46 } // namespace offline_pages |
| 41 | 47 |
| 42 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_REQUEST_COORDINATOR_FACTORY_H_ | 48 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_REQUEST_COORDINATOR_FACTORY_H_ |
| OLD | NEW |