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

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

Issue 1126923002: Add Media Router Mojo impl code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Redundant forward decl removed. 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..d1ba2d9bbbd2ee81943a94c95be39b39e64aee29
--- /dev/null
+++ b/chrome/browser/media/router/media_router_mojo_impl_factory.cc
@@ -0,0 +1,50 @@
+// 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 {
+
+// static
+MediaRouterMojoImpl* MediaRouterMojoImplFactory::GetApiForBrowserContext(
+ BrowserContext* context) {
+ DCHECK(context);
+
+ return static_cast<MediaRouterMojoImpl*>(
+ GetInstance()->GetServiceForBrowserContext(context, true));
+}
+
+// static
+MediaRouterMojoImplFactory* MediaRouterMojoImplFactory::GetInstance() {
+ return Singleton<MediaRouterMojoImplFactory>::get();
Wez 2015/05/20 23:37:49 I'm not familiar with this pattern; is this the pr
imcheng (use chromium acct) 2015/05/21 19:28:52 Done.
+}
+
+MediaRouterMojoImplFactory::MediaRouterMojoImplFactory()
+ : BrowserContextKeyedServiceFactory(
+ "MediaRouterMojoImpl",
+ BrowserContextDependencyManager::GetInstance()) {
+ DependsOn(extensions::ProcessManagerFactory::GetInstance());
Wez 2015/05/20 23:37:49 nit: Consider documenting why we depend on this, s
imcheng (use chromium acct) 2015/05/21 19:28:52 Done.
+}
+
+MediaRouterMojoImplFactory::~MediaRouterMojoImplFactory() {
+}
+
+KeyedService* MediaRouterMojoImplFactory::BuildServiceInstanceFor(
+ BrowserContext* context) const {
+ return new MediaRouterMojoImpl();
+}
+
+BrowserContext* MediaRouterMojoImplFactory::GetBrowserContextToUse(
+ BrowserContext* context) const {
+ // This means MediaRouterImpl is available in incongnito contexts as well.
Wez 2015/05/20 23:37:50 typo: Incognito This comment doesn't make clear w
imcheng (use chromium acct) 2015/05/21 19:28:52 I tried to clarified the comment. It just means we
+ return context;
+}
+
+} // namespace media_router

Powered by Google App Engine
This is Rietveld 408576698