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

Unified Diff: chrome/browser/media/router/media_router_mojo_impl_factory.cc

Issue 1143603004: [Media Router] Add Media Router Mojo impl code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Xiaohan's comments Created 5 years, 7 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/media/router/media_router_mojo_impl_factory.cc
diff --git a/chrome/browser/media/router/media_router_mojo_impl_factory.cc b/chrome/browser/media/router/media_router_mojo_impl_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..45852eb7fa3a1805b4483f96207e0ec1d46cf428
--- /dev/null
+++ b/chrome/browser/media/router/media_router_mojo_impl_factory.cc
@@ -0,0 +1,55 @@
+// Copyright 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 "chrome/browser/media/router/media_router_mojo_impl_factory.h"
+
+#include "chrome/browser/media/router/media_router_mojo_impl.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "extensions/browser/process_manager_factory.h"
+
+using content::BrowserContext;
+
+namespace media_router {
+
+namespace {
+
+base::LazyInstance<MediaRouterMojoImplFactory> service_factory =
+ LAZY_INSTANCE_INITIALIZER;
+
+} // namespace
+
+// static
+MediaRouterMojoImpl* MediaRouterMojoImplFactory::GetApiForBrowserContext(
+ BrowserContext* context) {
+ DCHECK(context);
+
+ return static_cast<MediaRouterMojoImpl*>(
+ service_factory.Get().GetServiceForBrowserContext(context, true));
+}
+
+MediaRouterMojoImplFactory::MediaRouterMojoImplFactory()
+ : BrowserContextKeyedServiceFactory(
+ "MediaRouterMojoImpl",
+ BrowserContextDependencyManager::GetInstance()) {
+ // MediaRouterMojoImpl depends on ProcessManager.
+ DependsOn(extensions::ProcessManagerFactory::GetInstance());
+}
+
+MediaRouterMojoImplFactory::~MediaRouterMojoImplFactory() {
+}
+
+KeyedService* MediaRouterMojoImplFactory::BuildServiceInstanceFor(
+ BrowserContext* context) const {
+ return new MediaRouterMojoImpl();
+}
+
+BrowserContext* MediaRouterMojoImplFactory::GetBrowserContextToUse(
+ BrowserContext* context) const {
+ // Always use the input context. This means that an incognito context will
+ // have its own MediaRouterMojoImpl service, rather than sharing it with its
+ // original non-incognito context.
+ return context;
+}
+
+} // namespace media_router

Powered by Google App Engine
This is Rietveld 408576698