| 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/enhanced_bookmarks/enhanced_bookmark_model_factory.h" | |
| 12 #include "chrome/browser/profiles/incognito_helpers.h" | |
| 13 #include "chrome/browser/profiles/profile.h" | |
| 14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | |
| 15 #include "chrome/browser/signin/signin_manager_factory.h" | |
| 16 #include "chrome/browser/sync/profile_sync_service_factory.h" | |
| 17 #include "components/keyed_service/content/browser_context_dependency_manager.h" | |
| 18 #include "components/signin/core/browser/signin_manager.h" | |
| 19 | |
| 20 namespace enhanced_bookmarks { | |
| 21 | |
| 22 ChromeBookmarkServerClusterServiceFactory:: | |
| 23 ChromeBookmarkServerClusterServiceFactory() | |
| 24 : BrowserContextKeyedServiceFactory( | |
| 25 "ChromeBookmarkServerClusterService", | |
| 26 BrowserContextDependencyManager::GetInstance()) { | |
| 27 DependsOn(ProfileSyncServiceFactory::GetInstance()); | |
| 28 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); | |
| 29 DependsOn(SigninManagerFactory::GetInstance()); | |
| 30 DependsOn(BookmarkModelFactory::GetInstance()); | |
| 31 } | |
| 32 | |
| 33 // static | |
| 34 ChromeBookmarkServerClusterServiceFactory* | |
| 35 ChromeBookmarkServerClusterServiceFactory::GetInstance() { | |
| 36 return Singleton<ChromeBookmarkServerClusterServiceFactory>::get(); | |
| 37 } | |
| 38 | |
| 39 // static | |
| 40 ChromeBookmarkServerClusterService* | |
| 41 ChromeBookmarkServerClusterServiceFactory::GetForBrowserContext( | |
| 42 content::BrowserContext* context) { | |
| 43 DCHECK(!context->IsOffTheRecord()); | |
| 44 return static_cast<ChromeBookmarkServerClusterService*>( | |
| 45 GetInstance()->GetServiceForBrowserContext(context, true)); | |
| 46 } | |
| 47 | |
| 48 KeyedService* | |
| 49 ChromeBookmarkServerClusterServiceFactory::BuildServiceInstanceFor( | |
| 50 content::BrowserContext* browser_context) const { | |
| 51 DCHECK(!browser_context->IsOffTheRecord()); | |
| 52 Profile* profile = Profile::FromBrowserContext(browser_context); | |
| 53 | |
| 54 return new ChromeBookmarkServerClusterService( | |
| 55 g_browser_process->GetApplicationLocale(), | |
| 56 browser_context->GetRequestContext(), | |
| 57 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | |
| 58 SigninManagerFactory::GetForProfile(profile), | |
| 59 EnhancedBookmarkModelFactory::GetForBrowserContext(profile), | |
| 60 profile->GetPrefs(), | |
| 61 ProfileSyncServiceFactory::GetForProfile(profile)); | |
| 62 } | |
| 63 | |
| 64 content::BrowserContext* | |
| 65 ChromeBookmarkServerClusterServiceFactory::GetBrowserContextToUse( | |
| 66 content::BrowserContext* context) const { | |
| 67 return chrome::GetBrowserContextRedirectedInIncognito(context); | |
| 68 } | |
| 69 | |
| 70 } // namespace enhanced_bookmarks | |
| OLD | NEW |