| OLD | NEW | 
|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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/offline_items_collection/offline_content_aggregator_fac
    tory.h" | 5 #include "chrome/browser/offline_items_collection/offline_content_aggregator_fac
    tory.h" | 
| 6 | 6 | 
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" | 
| 8 #include "chrome/browser/profiles/incognito_helpers.h" | 8 #include "chrome/browser/profiles/incognito_helpers.h" | 
| 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 
| 10 #include "components/offline_items_collection/core/offline_content_aggregator.h" | 10 #include "components/offline_items_collection/core/offline_content_aggregator.h" | 
| 11 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" | 
| 12 | 12 | 
| 13 namespace offline_items_collection { | 13 namespace offline_items_collection { | 
| 14 | 14 | 
| 15 // static | 15 // static | 
| 16 OfflineContentAggregatorFactory* | 16 OfflineContentAggregatorFactory* | 
| 17 OfflineContentAggregatorFactory::GetInstance() { | 17 OfflineContentAggregatorFactory::GetInstance() { | 
| 18   return base::Singleton<OfflineContentAggregatorFactory>::get(); | 18   return base::Singleton<OfflineContentAggregatorFactory>::get(); | 
| 19 } | 19 } | 
| 20 | 20 | 
| 21 // static | 21 // static | 
| 22 OfflineContentAggregator* OfflineContentAggregatorFactory::GetForBrowserContext( | 22 OfflineContentAggregator* OfflineContentAggregatorFactory::GetForBrowserContext( | 
| 23     content::BrowserContext* context) { | 23     content::BrowserContext* context) { | 
| 24   DCHECK(!context->IsOffTheRecord()); |  | 
| 25   return static_cast<offline_items_collection::OfflineContentAggregator*>( | 24   return static_cast<offline_items_collection::OfflineContentAggregator*>( | 
| 26       GetInstance()->GetServiceForBrowserContext(context, true)); | 25       GetInstance()->GetServiceForBrowserContext(context, true)); | 
| 27 } | 26 } | 
| 28 | 27 | 
| 29 OfflineContentAggregatorFactory::OfflineContentAggregatorFactory() | 28 OfflineContentAggregatorFactory::OfflineContentAggregatorFactory() | 
| 30     : BrowserContextKeyedServiceFactory( | 29     : BrowserContextKeyedServiceFactory( | 
| 31           "offline_items_collection::OfflineContentAggregator", | 30           "offline_items_collection::OfflineContentAggregator", | 
| 32           BrowserContextDependencyManager::GetInstance()) {} | 31           BrowserContextDependencyManager::GetInstance()) {} | 
| 33 | 32 | 
| 34 OfflineContentAggregatorFactory::~OfflineContentAggregatorFactory() = default; | 33 OfflineContentAggregatorFactory::~OfflineContentAggregatorFactory() = default; | 
| 35 | 34 | 
| 36 KeyedService* OfflineContentAggregatorFactory::BuildServiceInstanceFor( | 35 KeyedService* OfflineContentAggregatorFactory::BuildServiceInstanceFor( | 
| 37     content::BrowserContext* context) const { | 36     content::BrowserContext* context) const { | 
| 38   return new offline_items_collection::OfflineContentAggregator(); | 37   return new offline_items_collection::OfflineContentAggregator(); | 
| 39 } | 38 } | 
| 40 | 39 | 
| 41 content::BrowserContext* | 40 content::BrowserContext* | 
| 42 OfflineContentAggregatorFactory::GetBrowserContextToUse( | 41 OfflineContentAggregatorFactory::GetBrowserContextToUse( | 
| 43     content::BrowserContext* context) const { | 42     content::BrowserContext* context) const { | 
| 44   return chrome::GetBrowserContextRedirectedInIncognito(context); | 43   return chrome::GetBrowserContextRedirectedInIncognito(context); | 
| 45 } | 44 } | 
| 46 | 45 | 
| 47 }  // namespace offline_items_collection | 46 }  // namespace offline_items_collection | 
| OLD | NEW | 
|---|