Chromium Code Reviews

Unified Diff: chromeos/arc/bridge/arc_bridge_service_factory.cc

Issue 1412863004: arc-bridge: Add the ARC Bridge Service (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: chromeos/arc/bridge/arc_bridge_service_factory.cc
diff --git a/chromeos/arc/bridge/arc_bridge_service_factory.cc b/chromeos/arc/bridge/arc_bridge_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..272b2661ba8215d1f9243a6235c9173c8bf60b91
--- /dev/null
+++ b/chromeos/arc/bridge/arc_bridge_service_factory.cc
@@ -0,0 +1,39 @@
+// Copyright (c) 2015 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 "chromeos/arc/bridge/arc_bridge_service_factory.h"
+
+#include "chrome/browser/profiles/profile.h"
+#include "chromeos/arc/bridge/arc_bridge_service.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+
+namespace arc {
+
+// static
+ArcBridgeService* ArcBridgeServiceFactory::GetForProfile(Profile* profile) {
+ return static_cast<ArcBridgeService*>(
+ GetInstance()->GetServiceForBrowserContext(profile, true));
+}
+
+ArcBridgeServiceFactory* ArcBridgeServiceFactory::GetInstance() {
+ return base::Singleton<ArcBridgeServiceFactory>::get();
+}
+
+ArcBridgeServiceFactory::ArcBridgeServiceFactory()
+ : BrowserContextKeyedServiceFactory(
+ "ArcBridgeService",
+ BrowserContextDependencyManager::GetInstance()) {}
+
+ArcBridgeServiceFactory::~ArcBridgeServiceFactory() {}
+
+KeyedService* ArcBridgeServiceFactory::BuildServiceInstanceFor(
+ content::BrowserContext* profile) const {
+ return new ArcBridgeService(static_cast<Profile*>(profile));
+}
+
+bool ArcBridgeServiceFactory::ServiceIsCreatedWithBrowserContext() const {
+ return true;
+}
+
+} // namespace arc

Powered by Google App Engine