| Index: components/reporting/content/browser/reporting_service_factory.cc
|
| diff --git a/components/reporting/content/browser/reporting_service_factory.cc b/components/reporting/content/browser/reporting_service_factory.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..282f637dcb09f4e90dfee819e1fb8bae8db7c2ec
|
| --- /dev/null
|
| +++ b/components/reporting/content/browser/reporting_service_factory.cc
|
| @@ -0,0 +1,45 @@
|
| +// Copyright 2016 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 "components/reporting/content/browser/reporting_service_factory.h"
|
| +
|
| +#include "base/bind.h"
|
| +#include "components/reporting/core/browser/reporting_service.h"
|
| +#include "content/public/browser/browser_context.h"
|
| +#include "content/public/browser/storage_partition.h"
|
| +#include "content/public/common/origin_util.h"
|
| +
|
| +namespace reporting {
|
| +
|
| +// static
|
| +ReportingService* ReportingServiceFactory::GetForBrowserContext(
|
| + content::BrowserContext* context,
|
| + bool create) {
|
| + return static_cast<ReportingService*>(
|
| + GetInstance()->GetServiceForBrowserContext(context, create));
|
| +}
|
| +
|
| +// static
|
| +ReportingServiceFactory* ReportingServiceFactory::GetInstance() {
|
| + return base::Singleton<ReportingServiceFactory>::get();
|
| +}
|
| +
|
| +ReportingServiceFactory::ReportingServiceFactory()
|
| + : BrowserContextKeyedServiceFactory(
|
| + "ReportingService",
|
| + BrowserContextDependencyManager::GetInstance()) {}
|
| +
|
| +ReportingServiceFactory::~ReportingServiceFactory() {}
|
| +
|
| +KeyedService* ReportingServiceFactory::BuildServiceInstanceFor(
|
| + content::BrowserContext* browser_context) const {
|
| + scoped_refptr<net::URLRequestContextGetter> request_context =
|
| + content::BrowserContext::GetDefaultStoragePartition(browser_context)
|
| + ->GetURLRequestContext();
|
| + std::unique_ptr<ReportingService> service(ReportingService::Create(
|
| + request_context, base::Bind(&content::IsOriginSecure)));
|
| + return service.release();
|
| +}
|
| +
|
| +} // namespace reporting
|
|
|