OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_syncable_service_factory.h" | 5 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
| 9 #include "base/memory/ptr_util.h" |
9 #include "build/build_config.h" | 10 #include "build/build_config.h" |
10 #include "chrome/browser/apps/drive/drive_app_provider.h" | 11 #include "chrome/browser/apps/drive/drive_app_provider.h" |
11 #include "chrome/browser/profiles/incognito_helpers.h" | 12 #include "chrome/browser/profiles/incognito_helpers.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | 14 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 15 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
15 #include "components/prefs/pref_service.h" | 16 #include "components/prefs/pref_service.h" |
16 #include "extensions/browser/extension_system.h" | 17 #include "extensions/browser/extension_system.h" |
17 #include "extensions/browser/extension_system_provider.h" | 18 #include "extensions/browser/extension_system_provider.h" |
18 #include "extensions/browser/extensions_browser_client.h" | 19 #include "extensions/browser/extensions_browser_client.h" |
(...skipping 11 matching lines...) Expand all Loading... |
30 return static_cast<AppListSyncableService*>( | 31 return static_cast<AppListSyncableService*>( |
31 GetInstance()->GetServiceForBrowserContext(profile, true)); | 32 GetInstance()->GetServiceForBrowserContext(profile, true)); |
32 } | 33 } |
33 | 34 |
34 // static | 35 // static |
35 AppListSyncableServiceFactory* AppListSyncableServiceFactory::GetInstance() { | 36 AppListSyncableServiceFactory* AppListSyncableServiceFactory::GetInstance() { |
36 return base::Singleton<AppListSyncableServiceFactory>::get(); | 37 return base::Singleton<AppListSyncableServiceFactory>::get(); |
37 } | 38 } |
38 | 39 |
39 // static | 40 // static |
40 scoped_ptr<KeyedService> AppListSyncableServiceFactory::BuildInstanceFor( | 41 std::unique_ptr<KeyedService> AppListSyncableServiceFactory::BuildInstanceFor( |
41 content::BrowserContext* browser_context) { | 42 content::BrowserContext* browser_context) { |
42 Profile* profile = static_cast<Profile*>(browser_context); | 43 Profile* profile = static_cast<Profile*>(browser_context); |
43 #if defined(OS_CHROMEOS) | 44 #if defined(OS_CHROMEOS) |
44 if (chromeos::ProfileHelper::IsSigninProfile(profile)) | 45 if (chromeos::ProfileHelper::IsSigninProfile(profile)) |
45 return NULL; | 46 return NULL; |
46 #endif | 47 #endif |
47 VLOG(1) << "BuildInstanceFor: " << profile->GetDebugName() | 48 VLOG(1) << "BuildInstanceFor: " << profile->GetDebugName() |
48 << " (" << profile << ")"; | 49 << " (" << profile << ")"; |
49 return make_scoped_ptr(new AppListSyncableService( | 50 return base::WrapUnique(new AppListSyncableService( |
50 profile, extensions::ExtensionSystem::Get(profile))); | 51 profile, extensions::ExtensionSystem::Get(profile))); |
51 } | 52 } |
52 | 53 |
53 AppListSyncableServiceFactory::AppListSyncableServiceFactory() | 54 AppListSyncableServiceFactory::AppListSyncableServiceFactory() |
54 : BrowserContextKeyedServiceFactory( | 55 : BrowserContextKeyedServiceFactory( |
55 "AppListSyncableService", | 56 "AppListSyncableService", |
56 BrowserContextDependencyManager::GetInstance()) { | 57 BrowserContextDependencyManager::GetInstance()) { |
57 VLOG(1) << "AppListSyncableServiceFactory()"; | 58 VLOG(1) << "AppListSyncableServiceFactory()"; |
58 typedef std::set<BrowserContextKeyedServiceFactory*> FactorySet; | 59 typedef std::set<BrowserContextKeyedServiceFactory*> FactorySet; |
59 FactorySet dependent_factories; | 60 FactorySet dependent_factories; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // Start AppListSyncableService early so that the app list positions are | 94 // Start AppListSyncableService early so that the app list positions are |
94 // available before the app list is opened. | 95 // available before the app list is opened. |
95 return true; | 96 return true; |
96 } | 97 } |
97 | 98 |
98 bool AppListSyncableServiceFactory::ServiceIsNULLWhileTesting() const { | 99 bool AppListSyncableServiceFactory::ServiceIsNULLWhileTesting() const { |
99 return true; | 100 return true; |
100 } | 101 } |
101 | 102 |
102 } // namespace app_list | 103 } // namespace app_list |
OLD | NEW |