Index: chrome/browser/tether/tether_service_factory.cc |
diff --git a/chrome/browser/tether/tether_service_factory.cc b/chrome/browser/tether/tether_service_factory.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fa8c182b1f2235577a6e79f036641f57abed4f82 |
--- /dev/null |
+++ b/chrome/browser/tether/tether_service_factory.cc |
@@ -0,0 +1,46 @@ |
+// 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/tether/tether_service_factory.h" |
+ |
+#include "base/command_line.h" |
Lei Zhang
2017/04/19 19:13:17
Not used.
Ryan Hansberry
2017/04/20 17:22:32
Done.
|
+#include "base/memory/singleton.h" |
+#include "build/build_config.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); |
+} |