| Index: chrome/browser/media/media_engagement_service_factory.cc
|
| diff --git a/chrome/browser/media/media_engagement_service_factory.cc b/chrome/browser/media/media_engagement_service_factory.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8bab790822669fb058f5a703c342541c053e9bab
|
| --- /dev/null
|
| +++ b/chrome/browser/media/media_engagement_service_factory.cc
|
| @@ -0,0 +1,39 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/media/media_engagement_service_factory.h"
|
| +
|
| +#include "chrome/browser/media/media_engagement_service.h"
|
| +#include "chrome/browser/profiles/incognito_helpers.h"
|
| +#include "chrome/browser/profiles/profile.h"
|
| +#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
| +
|
| +// static
|
| +MediaEngagementService* MediaEngagementServiceFactory::GetForProfile(
|
| + Profile* profile) {
|
| + return static_cast<MediaEngagementService*>(
|
| + GetInstance()->GetServiceForBrowserContext(profile, true));
|
| +}
|
| +
|
| +// static
|
| +MediaEngagementServiceFactory* MediaEngagementServiceFactory::GetInstance() {
|
| + return base::Singleton<MediaEngagementServiceFactory>::get();
|
| +}
|
| +
|
| +MediaEngagementServiceFactory::MediaEngagementServiceFactory()
|
| + : BrowserContextKeyedServiceFactory(
|
| + "MediaEngagementServiceFactory",
|
| + BrowserContextDependencyManager::GetInstance()) {}
|
| +
|
| +MediaEngagementServiceFactory::~MediaEngagementServiceFactory() {}
|
| +
|
| +KeyedService* MediaEngagementServiceFactory::BuildServiceInstanceFor(
|
| + content::BrowserContext* context) const {
|
| + return new MediaEngagementService(Profile::FromBrowserContext(context));
|
| +}
|
| +
|
| +content::BrowserContext* MediaEngagementServiceFactory::GetBrowserContextToUse(
|
| + content::BrowserContext* context) const {
|
| + return chrome::GetBrowserContextOwnInstanceInIncognito(context);
|
| +}
|
|
|