Chromium Code Reviews| 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..0fff3acaaccbcfa6becb69a854270f1f293ec524 |
| --- /dev/null |
| +++ b/chrome/browser/net/nqe/ui_network_quality_estimator_service_factory.cc |
| @@ -0,0 +1,38 @@ |
| +// 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) { |
|
tbansal1
2016/07/01 22:22:03
DCHECK that profile is not off-the-record by calli
RyanSturm
2016/07/11 22:00:19
Done.
|
| + 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 = static_cast<Profile*>(context); |
| + return new UINetworkQualityEstimatorService(profile); |
| +} |