OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/app_list/app_list_prefs_factory.h" | 5 #include "chrome/browser/ui/app_list/app_list_prefs_factory.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/app_list/app_list_prefs.h" | 10 #include "chrome/browser/ui/app_list/app_list_prefs.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 GetInstance()->GetServiceForBrowserContext(context, true)); | 22 GetInstance()->GetServiceForBrowserContext(context, true)); |
23 } | 23 } |
24 | 24 |
25 // static | 25 // static |
26 AppListPrefsFactory* AppListPrefsFactory::GetInstance() { | 26 AppListPrefsFactory* AppListPrefsFactory::GetInstance() { |
27 return base::Singleton<AppListPrefsFactory>::get(); | 27 return base::Singleton<AppListPrefsFactory>::get(); |
28 } | 28 } |
29 | 29 |
30 void AppListPrefsFactory::SetInstanceForTesting( | 30 void AppListPrefsFactory::SetInstanceForTesting( |
31 content::BrowserContext* context, | 31 content::BrowserContext* context, |
32 scoped_ptr<AppListPrefs> prefs) { | 32 std::unique_ptr<AppListPrefs> prefs) { |
33 Associate(context, std::move(prefs)); | 33 Associate(context, std::move(prefs)); |
34 } | 34 } |
35 | 35 |
36 AppListPrefsFactory::AppListPrefsFactory() | 36 AppListPrefsFactory::AppListPrefsFactory() |
37 : BrowserContextKeyedServiceFactory( | 37 : BrowserContextKeyedServiceFactory( |
38 "AppListPrefs", | 38 "AppListPrefs", |
39 BrowserContextDependencyManager::GetInstance()) { | 39 BrowserContextDependencyManager::GetInstance()) { |
40 } | 40 } |
41 | 41 |
42 AppListPrefsFactory::~AppListPrefsFactory() { | 42 AppListPrefsFactory::~AppListPrefsFactory() { |
43 } | 43 } |
44 | 44 |
45 KeyedService* AppListPrefsFactory::BuildServiceInstanceFor( | 45 KeyedService* AppListPrefsFactory::BuildServiceInstanceFor( |
46 content::BrowserContext* context) const { | 46 content::BrowserContext* context) const { |
47 return AppListPrefs::Create(Profile::FromBrowserContext(context)->GetPrefs()); | 47 return AppListPrefs::Create(Profile::FromBrowserContext(context)->GetPrefs()); |
48 } | 48 } |
49 | 49 |
50 content::BrowserContext* AppListPrefsFactory::GetBrowserContextToUse( | 50 content::BrowserContext* AppListPrefsFactory::GetBrowserContextToUse( |
51 content::BrowserContext* context) const { | 51 content::BrowserContext* context) const { |
52 return extensions::ExtensionsBrowserClient::Get()->GetOriginalContext( | 52 return extensions::ExtensionsBrowserClient::Get()->GetOriginalContext( |
53 context); | 53 context); |
54 } | 54 } |
55 | 55 |
56 } // namespace app_list | 56 } // namespace app_list |
OLD | NEW |