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

Unified Diff: chrome/browser/sync/sessions/sync_sessions_web_contents_router_factory.cc

Issue 2753753005: [sync] WebContentsObserver based sessions notifications (Closed)
Patch Set: use base:MakeUnique, alphabetize Created 3 years, 9 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/sync/sessions/sync_sessions_web_contents_router_factory.cc
diff --git a/chrome/browser/sync/sessions/sync_sessions_web_contents_router_factory.cc b/chrome/browser/sync/sessions/sync_sessions_web_contents_router_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e3bd7e65500d3d44288078c978360fc31293678a
--- /dev/null
+++ b/chrome/browser/sync/sessions/sync_sessions_web_contents_router_factory.cc
@@ -0,0 +1,40 @@
+// 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/sync/sessions/sync_sessions_web_contents_router_factory.h"
+
+#include "base/logging.h"
+#include "base/memory/singleton.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/sync/sessions/sync_sessions_web_contents_router.h"
+
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+
+namespace sync_sessions {
+
+// static
+SyncSessionsWebContentsRouter*
+SyncSessionsWebContentsRouterFactory::GetForProfile(Profile* profile) {
+ return static_cast<SyncSessionsWebContentsRouter*>(
+ GetInstance()->GetServiceForBrowserContext(profile, true));
+}
+
+// static
+SyncSessionsWebContentsRouterFactory*
+SyncSessionsWebContentsRouterFactory::GetInstance() {
+ return base::Singleton<SyncSessionsWebContentsRouterFactory>::get();
+}
+
+SyncSessionsWebContentsRouterFactory::SyncSessionsWebContentsRouterFactory()
+ : BrowserContextKeyedServiceFactory(
+ "SyncSessionsWebContentsRouter",
+ BrowserContextDependencyManager::GetInstance()) {}
+
+SyncSessionsWebContentsRouterFactory::~SyncSessionsWebContentsRouterFactory() {}
+
+KeyedService* SyncSessionsWebContentsRouterFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ return new SyncSessionsWebContentsRouter(static_cast<Profile*>(context));
+}
+
+} // namespace sync_sessions

Powered by Google App Engine
This is Rietveld 408576698