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 #include "components/offline_items_collection/content/offline_content_aggregator _factory.h" | |
6 | |
7 #include "base/memory/singleton.h" | |
8 #include "components/keyed_service/content/browser_context_dependency_manager.h" | |
9 #include "components/offline_items_collection/core/offline_content_aggregator.h" | |
10 #include "content/public/browser/browser_context.h" | |
11 | |
12 namespace offline_items_collection { | |
13 | |
14 // static | |
15 OfflineContentAggregatorFactory* | |
16 OfflineContentAggregatorFactory::GetInstance() { | |
17 return base::Singleton<OfflineContentAggregatorFactory>::get(); | |
18 } | |
19 | |
20 // static | |
21 OfflineContentAggregator* OfflineContentAggregatorFactory::GetForBrowserContext( | |
22 content::BrowserContext* context) { | |
23 DCHECK(!context->IsOffTheRecord()); | |
Dmitry Titov
2017/03/08 00:46:00
It is unclear if you want the service to be create
David Trainor- moved to gerrit
2017/03/09 18:44:40
Ah nice catch sorry! I was messing around with th
| |
24 return static_cast<offline_items_collection::OfflineContentAggregator*>( | |
25 GetInstance()->GetServiceForBrowserContext(context, true)); | |
26 } | |
27 | |
28 OfflineContentAggregatorFactory::OfflineContentAggregatorFactory() | |
29 : BrowserContextKeyedServiceFactory( | |
30 "offline_items_collection::OfflineContentAggregator", | |
31 BrowserContextDependencyManager::GetInstance()) {} | |
32 | |
33 OfflineContentAggregatorFactory::~OfflineContentAggregatorFactory() = default; | |
34 | |
35 KeyedService* OfflineContentAggregatorFactory::BuildServiceInstanceFor( | |
36 content::BrowserContext* context) const { | |
37 return new offline_items_collection::OfflineContentAggregator(); | |
38 } | |
39 | |
40 content::BrowserContext* | |
41 OfflineContentAggregatorFactory::GetBrowserContextToUse( | |
42 content::BrowserContext* context) const { | |
43 return context; | |
44 } | |
45 | |
46 } // namespace offline_items_collection | |
OLD | NEW |