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

Unified Diff: chrome/browser/net/nqe/ui_network_quality_estimator_service_factory.cc

Issue 2103323007: Exposing NQE on the Browser UI thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke comments Created 4 years, 5 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: chrome/browser/net/nqe/ui_network_quality_estimator_service_factory.cc
diff --git a/chrome/browser/net/nqe/ui_network_quality_estimator_service_factory.cc b/chrome/browser/net/nqe/ui_network_quality_estimator_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9e8c45d4742e737f39bcbe7814991996e80adba9
--- /dev/null
+++ b/chrome/browser/net/nqe/ui_network_quality_estimator_service_factory.cc
@@ -0,0 +1,39 @@
+// 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 "chrome/browser/net/nqe/ui_network_quality_estimator_service_factory.h"
+
+#include "chrome/browser/net/nqe/ui_network_quality_estimator_service.h"
+#include "chrome/browser/profiles/profile.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "content/public/browser/browser_context.h"
+
+// static
+UINetworkQualityEstimatorService*
+UINetworkQualityEstimatorServiceFactory::GetForProfile(Profile* profile) {
+ DCHECK_NE(profile->GetProfileType(), Profile::INCOGNITO_PROFILE);
+ return static_cast<UINetworkQualityEstimatorService*>(
+ GetInstance()->GetServiceForBrowserContext(profile, true));
+}
+
+// static
+UINetworkQualityEstimatorServiceFactory*
+UINetworkQualityEstimatorServiceFactory::GetInstance() {
+ return base::Singleton<UINetworkQualityEstimatorServiceFactory>::get();
+}
+
+UINetworkQualityEstimatorServiceFactory::
+ UINetworkQualityEstimatorServiceFactory()
+ : BrowserContextKeyedServiceFactory(
+ "UINetworkQualityEstimatorService",
+ BrowserContextDependencyManager::GetInstance()) {}
+
+UINetworkQualityEstimatorServiceFactory::
+ ~UINetworkQualityEstimatorServiceFactory() {}
+
+KeyedService* UINetworkQualityEstimatorServiceFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ Profile* profile = Profile::FromBrowserContext(context);
+ return new UINetworkQualityEstimatorService(profile);
+}

Powered by Google App Engine
This is Rietveld 408576698