OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 | |
5 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" | |
6 | |
7 #include "base/memory/singleton.h" | |
8 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" | |
9 #include "chrome/browser/profiles/incognito_helpers.h" | |
10 #include "chrome/browser/profiles/profile.h" | |
11 #include "components/keyed_service/content/browser_context_dependency_manager.h" | |
12 | |
13 // static | |
14 ChromeBookmarkClient* ChromeBookmarkClientFactory::GetForProfile( | |
15 Profile* profile) { | |
16 return static_cast<ChromeBookmarkClient*>( | |
17 GetInstance()->GetServiceForBrowserContext(profile, true)); | |
18 } | |
19 | |
20 // static | |
21 ChromeBookmarkClientFactory* ChromeBookmarkClientFactory::GetInstance() { | |
22 return Singleton<ChromeBookmarkClientFactory>::get(); | |
23 } | |
24 | |
25 ChromeBookmarkClientFactory::ChromeBookmarkClientFactory() | |
26 : BrowserContextKeyedServiceFactory( | |
27 "ChromeBookmarkClient", | |
28 BrowserContextDependencyManager::GetInstance()) { | |
29 } | |
30 | |
31 ChromeBookmarkClientFactory::~ChromeBookmarkClientFactory() { | |
32 } | |
33 | |
34 KeyedService* ChromeBookmarkClientFactory::BuildServiceInstanceFor( | |
35 content::BrowserContext* context) const { | |
36 return new ChromeBookmarkClient(static_cast<Profile*>(context)); | |
37 } | |
38 | |
39 content::BrowserContext* ChromeBookmarkClientFactory::GetBrowserContextToUse( | |
40 content::BrowserContext* context) const { | |
41 return chrome::GetBrowserContextRedirectedInIncognito(context); | |
42 } | |
43 | |
44 bool ChromeBookmarkClientFactory::ServiceIsNULLWhileTesting() const { | |
45 return true; | |
46 } | |
OLD | NEW |