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

Unified Diff: chrome/browser/chromeos/tether/tether_service_factory.cc

Issue 2819713002: Create TetherService, a TetherAllowed pref, and use DependencyManager for RegisterProfilePrefs call… (Closed)
Patch Set: Create an IsEnabled method on TetherService. Created 3 years, 8 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/chromeos/tether/tether_service_factory.cc
diff --git a/chrome/browser/chromeos/tether/tether_service_factory.cc b/chrome/browser/chromeos/tether/tether_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d07ab579f744ff33b35fdc2bd36db08248410a33
--- /dev/null
+++ b/chrome/browser/chromeos/tether/tether_service_factory.cc
@@ -0,0 +1,44 @@
+// 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/chromeos/tether/tether_service_factory.h"
+
+#include "base/memory/singleton.h"
+#include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/pref_names.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "components/pref_registry/pref_registry_syncable.h"
+
+// static
+TetherServiceFactory* TetherServiceFactory::GetInstance() {
+ return base::Singleton<TetherServiceFactory>::get();
+}
+
+// static
+TetherService* TetherServiceFactory::GetForBrowserContext(
+ content::BrowserContext* browser_context) {
+ return static_cast<TetherService*>(
+ TetherServiceFactory::GetInstance()->GetServiceForBrowserContext(
+ browser_context, true));
+}
+
+TetherServiceFactory::TetherServiceFactory()
+ : BrowserContextKeyedServiceFactory(
+ "TetherService",
+ BrowserContextDependencyManager::GetInstance()) {
+ DependsOn(ChromeCryptAuthServiceFactory::GetInstance());
+}
+
+TetherServiceFactory::~TetherServiceFactory() {}
+
+KeyedService* TetherServiceFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ return new TetherService(Profile::FromBrowserContext(context));
+}
+
+void TetherServiceFactory::RegisterProfilePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
+ TetherService::RegisterProfilePrefs(registry);
+}
« no previous file with comments | « chrome/browser/chromeos/tether/tether_service_factory.h ('k') | chrome/browser/cryptauth/chrome_cryptauth_service_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698