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

Unified Diff: components/reporting/content/browser/reporting_service_factory.cc

Issue 2249213002: [OBSOLETE] Reporting: Initial implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ProfileImplIOData Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698