Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: chrome/browser/background_fetch/background_fetch_client_factory.cc

Issue 2777063008: Connect BackgroundFetch to the OfflineItemCollection
Patch Set: Fixed incognito check and added tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 "chrome/browser/background_fetch/background_fetch_client_factory.h"
6
7 #include "chrome/browser/background_fetch/background_fetch_client_impl.h"
8 #include "chrome/browser/offline_items_collection/offline_content_aggregator_fac tory.h"
9 #include "chrome/browser/profiles/incognito_helpers.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "components/keyed_service/content/browser_context_dependency_manager.h"
12 #include "content/public/browser/browser_thread.h"
13
14 // static
15 BackgroundFetchClientImpl* BackgroundFetchClientFactory::GetForProfile(
16 Profile* profile) {
17 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
18 return static_cast<BackgroundFetchClientImpl*>(
19 GetInstance()->GetServiceForBrowserContext(profile, true /* create */));
20 }
21
22 // static
23 BackgroundFetchClientFactory* BackgroundFetchClientFactory::GetInstance() {
24 return base::Singleton<BackgroundFetchClientFactory>::get();
25 }
26
27 BackgroundFetchClientFactory::BackgroundFetchClientFactory()
28 : BrowserContextKeyedServiceFactory(
29 "BackgroundFetchClient",
30 BrowserContextDependencyManager::GetInstance()) {
31 DependsOn(
32 offline_items_collection::OfflineContentAggregatorFactory::GetInstance());
33 }
34
35 BackgroundFetchClientFactory::~BackgroundFetchClientFactory() {}
36
37 KeyedService* BackgroundFetchClientFactory::BuildServiceInstanceFor(
38 content::BrowserContext* context) const {
39 return new BackgroundFetchClientImpl(Profile::FromBrowserContext(context));
40 }
41
42 content::BrowserContext* BackgroundFetchClientFactory::GetBrowserContextToUse(
43 content::BrowserContext* context) const {
44 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698