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

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

Issue 2777063008: Connect BackgroundFetch to the OfflineItemCollection
Patch Set: 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
13 // static
14 BackgroundFetchClientImpl* BackgroundFetchClientFactory::GetForProfile(
15 Profile* profile) {
16 return static_cast<BackgroundFetchClientImpl*>(
17 GetInstance()->GetServiceForBrowserContext(profile, true));
Peter Beverloo 2017/03/29 14:32:12 nit: true /* create */
harkness 2017/03/30 12:42:34 Done.
18 }
19
20 // static
21 BackgroundFetchClientFactory* BackgroundFetchClientFactory::GetInstance() {
22 return base::Singleton<BackgroundFetchClientFactory>::get();
23 }
24
25 BackgroundFetchClientFactory::BackgroundFetchClientFactory()
26 : BrowserContextKeyedServiceFactory(
27 "BackgroundFetchService",
28 BrowserContextDependencyManager::GetInstance()) {
29 DependsOn(
30 offline_items_collection::OfflineContentAggregatorFactory::GetInstance());
31 }
32
33 BackgroundFetchClientFactory::~BackgroundFetchClientFactory() {}
34
35 KeyedService* BackgroundFetchClientFactory::BuildServiceInstanceFor(
36 content::BrowserContext* context) const {
37 return new BackgroundFetchClientImpl(Profile::FromBrowserContext(context));
38 }
39
40 content::BrowserContext* BackgroundFetchClientFactory::GetBrowserContextToUse(
41 content::BrowserContext* context) const {
42 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
Peter Beverloo 2017/03/29 14:32:12 Why do we want a separate instance of the service
harkness 2017/03/30 12:42:34 Let's discuss this in person.
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698