OLD | NEW |
---|---|
(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 | |
OLD | NEW |