| 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 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" | 5 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 BrowserContextDependencyManager::GetInstance()) {} | 36 BrowserContextDependencyManager::GetInstance()) {} |
| 37 | 37 |
| 38 // static | 38 // static |
| 39 RequestCoordinatorFactory* RequestCoordinatorFactory::GetInstance() { | 39 RequestCoordinatorFactory* RequestCoordinatorFactory::GetInstance() { |
| 40 return base::Singleton<RequestCoordinatorFactory>::get(); | 40 return base::Singleton<RequestCoordinatorFactory>::get(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 // static | 43 // static |
| 44 RequestCoordinator* RequestCoordinatorFactory::GetForBrowserContext( | 44 RequestCoordinator* RequestCoordinatorFactory::GetForBrowserContext( |
| 45 content::BrowserContext* context) { | 45 content::BrowserContext* context) { |
| 46 if (GetInstance()->always_nullptr_) |
| 47 return nullptr; |
| 46 return static_cast<RequestCoordinator*>( | 48 return static_cast<RequestCoordinator*>( |
| 47 GetInstance()->GetServiceForBrowserContext(context, true)); | 49 GetInstance()->GetServiceForBrowserContext(context, true)); |
| 48 } | 50 } |
| 49 | 51 |
| 50 KeyedService* RequestCoordinatorFactory::BuildServiceInstanceFor( | 52 KeyedService* RequestCoordinatorFactory::BuildServiceInstanceFor( |
| 51 content::BrowserContext* context) const { | 53 content::BrowserContext* context) const { |
| 52 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); | 54 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); |
| 53 std::unique_ptr<OfflinerFactory> prerenderer_offliner( | 55 std::unique_ptr<OfflinerFactory> prerenderer_offliner( |
| 54 new PrerenderingOfflinerFactory(context)); | 56 new PrerenderingOfflinerFactory(context)); |
| 55 | 57 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 75 std::move(scheduler), network_quality_estimator); | 77 std::move(scheduler), network_quality_estimator); |
| 76 | 78 |
| 77 DownloadNotifyingObserver::CreateAndStartObserving( | 79 DownloadNotifyingObserver::CreateAndStartObserving( |
| 78 request_coordinator, | 80 request_coordinator, |
| 79 base::MakeUnique<android::OfflinePageNotificationBridge>()); | 81 base::MakeUnique<android::OfflinePageNotificationBridge>()); |
| 80 | 82 |
| 81 return request_coordinator; | 83 return request_coordinator; |
| 82 } | 84 } |
| 83 | 85 |
| 84 } // namespace offline_pages | 86 } // namespace offline_pages |
| OLD | NEW |