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

Side by Side Diff: chrome/browser/sync/sessions/sync_sessions_web_contents_router_factory.cc

Issue 2753753005: [sync] WebContentsObserver based sessions notifications (Closed)
Patch Set: Separate non-android class 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 #include "chrome/browser/sync/sessions/sync_sessions_web_contents_router_factory .h"
5
6 #include "base/logging.h"
7 #include "base/memory/singleton.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sync/sessions/sync_sessions_web_contents_router.h"
10 #if !defined(OS_ANDROID)
11 #include "chrome/browser/sync/sessions/sync_sessions_multi_windowed_web_contents _router.h"
12 #endif // !defined(OS_ANDROID)
13
14 #include "components/keyed_service/content/browser_context_dependency_manager.h"
15
16 namespace sync_sessions {
17
18 // static
19 SyncSessionsWebContentsRouter*
20 SyncSessionsWebContentsRouterFactory::GetForProfile(Profile* profile) {
21 return static_cast<SyncSessionsWebContentsRouter*>(
22 GetInstance()->GetServiceForBrowserContext(profile, true));
23 }
24
25 // static
26 SyncSessionsWebContentsRouterFactory*
27 SyncSessionsWebContentsRouterFactory::GetInstance() {
28 return base::Singleton<SyncSessionsWebContentsRouterFactory>::get();
29 }
30
31 SyncSessionsWebContentsRouterFactory::SyncSessionsWebContentsRouterFactory()
32 : BrowserContextKeyedServiceFactory(
33 "SyncSessionsWebContentsRouter",
34 BrowserContextDependencyManager::GetInstance()) {}
35
36 SyncSessionsWebContentsRouterFactory::~SyncSessionsWebContentsRouterFactory() {}
37
38 KeyedService* SyncSessionsWebContentsRouterFactory::BuildServiceInstanceFor(
39 content::BrowserContext* context) const {
40 #if !defined(OS_ANDROID)
Nicolas Zea 2017/03/20 18:14:50 nit: prefer have the positive version of the condi
Patrick Noland 2017/03/21 22:54:31 With composition, this seemed no longer possible w
41 return new SyncSessionsMultiWindowedWebContentsRouter(
42 static_cast<Profile*>(context));
43 #else
44 return new SyncSessionsWebContentsRouter(static_cast<Profile*>(context));
45 #endif // !defined(OS_ANDROID)
46 }
47
48 } // namespace sync_sessions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698