Chromium Code Reviews| 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/enhanced_bookmarks/chrome_bookmark_server_cluster_servi ce_factory.h" | |
| 6 | |
| 7 #include "base/memory/singleton.h" | |
| 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | |
| 9 #include "chrome/browser/browser_process.h" | |
| 10 #include "chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_servi ce.h" | |
| 11 #include "chrome/browser/profiles/profile.h" | |
| 12 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | |
| 13 #include "chrome/browser/signin/signin_manager_factory.h" | |
| 14 #include "chrome/browser/sync/profile_sync_service_factory.h" | |
| 15 #include "components/keyed_service/content/browser_context_dependency_manager.h" | |
| 16 #include "components/signin/core/browser/signin_manager.h" | |
| 17 | |
| 18 namespace enhanced_bookmarks { | |
| 19 | |
| 20 ChromeBookmarkServerClusterServiceFactory* | |
| 21 ChromeBookmarkServerClusterServiceFactory::GetInstance() { | |
|
Yaron
2014/09/05 05:18:00
Any reason you included the factory here but not f
noyau (Ping after 24h)
2014/09/10 08:53:57
Because the other one doesn't keep state, so doesn
| |
| 22 return Singleton<ChromeBookmarkServerClusterServiceFactory>::get(); | |
| 23 } | |
| 24 | |
| 25 // static | |
| 26 ChromeBookmarkServerClusterService* | |
| 27 ChromeBookmarkServerClusterServiceFactory::GetForBrowserContext( | |
| 28 content::BrowserContext* context) { | |
| 29 DCHECK(!context->IsOffTheRecord()); | |
| 30 return static_cast<ChromeBookmarkServerClusterService*>( | |
| 31 GetInstance()->GetServiceForBrowserContext(context, true)); | |
| 32 } | |
| 33 | |
| 34 KeyedService* | |
| 35 ChromeBookmarkServerClusterServiceFactory::BuildServiceInstanceFor( | |
| 36 content::BrowserContext* browser_context) const { | |
| 37 DCHECK(!browser_context->IsOffTheRecord()); | |
| 38 Profile* profile = Profile::FromBrowserContext(browser_context); | |
| 39 | |
| 40 return new ChromeBookmarkServerClusterService( | |
| 41 g_browser_process->GetApplicationLocale(), | |
| 42 browser_context->GetRequestContext(), | |
| 43 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | |
| 44 SigninManagerFactory::GetForProfile(profile), | |
| 45 BookmarkModelFactory::GetForProfile(profile), | |
| 46 profile->GetPrefs(), | |
| 47 ProfileSyncServiceFactory::GetForProfile(profile)); | |
| 48 } | |
| 49 | |
| 50 ChromeBookmarkServerClusterServiceFactory:: | |
| 51 ChromeBookmarkServerClusterServiceFactory() | |
| 52 : BrowserContextKeyedServiceFactory( | |
| 53 "ChromeBookmarkServerClusterService", | |
| 54 BrowserContextDependencyManager::GetInstance()) { | |
| 55 DependsOn(ProfileSyncServiceFactory::GetInstance()); | |
| 56 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); | |
| 57 DependsOn(SigninManagerFactory::GetInstance()); | |
| 58 DependsOn(BookmarkModelFactory::GetInstance()); | |
| 59 } | |
| 60 | |
| 61 ChromeBookmarkServerClusterServiceFactory:: | |
| 62 ~ChromeBookmarkServerClusterServiceFactory() { | |
| 63 } | |
| 64 | |
| 65 content::BrowserContext* | |
| 66 ChromeBookmarkServerClusterServiceFactory::GetBrowserContextToUse( | |
| 67 content::BrowserContext* context) const { | |
| 68 return context; | |
| 69 } | |
| 70 } // namespace enhanced_bookmarks | |
| OLD | NEW |