Update broken references to image assets
[chromium-blink-merge.git] / chrome / browser / enhanced_bookmarks / bookmark_server_cluster_service_factory.cc
blobe6c5ff213e913e45981a9db1194c8cd3e234f8ff
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.
5 #include "chrome/browser/enhanced_bookmarks/bookmark_server_cluster_service_factory.h"
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/enhanced_bookmark_model_factory.h"
11 #include "chrome/browser/profiles/incognito_helpers.h"
12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
14 #include "chrome/browser/signin/signin_manager_factory.h"
15 #include "chrome/browser/sync/profile_sync_service.h"
16 #include "chrome/browser/sync/profile_sync_service_factory.h"
17 #include "components/enhanced_bookmarks/bookmark_server_cluster_service.h"
18 #include "components/keyed_service/content/browser_context_dependency_manager.h"
19 #include "components/signin/core/browser/signin_manager.h"
21 namespace enhanced_bookmarks {
23 BookmarkServerClusterServiceFactory::BookmarkServerClusterServiceFactory()
24 : BrowserContextKeyedServiceFactory(
25 "BookmarkServerClusterService",
26 BrowserContextDependencyManager::GetInstance()) {
27 DependsOn(ProfileSyncServiceFactory::GetInstance());
28 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance());
29 DependsOn(SigninManagerFactory::GetInstance());
30 DependsOn(BookmarkModelFactory::GetInstance());
33 BookmarkServerClusterServiceFactory::~BookmarkServerClusterServiceFactory() {
36 // static
37 BookmarkServerClusterServiceFactory*
38 BookmarkServerClusterServiceFactory::GetInstance() {
39 return Singleton<BookmarkServerClusterServiceFactory>::get();
42 // static
43 BookmarkServerClusterService*
44 BookmarkServerClusterServiceFactory::GetForBrowserContext(
45 content::BrowserContext* context) {
46 DCHECK(!context->IsOffTheRecord());
47 return static_cast<BookmarkServerClusterService*>(
48 GetInstance()->GetServiceForBrowserContext(context, true));
51 KeyedService* BookmarkServerClusterServiceFactory::BuildServiceInstanceFor(
52 content::BrowserContext* browser_context) const {
53 DCHECK(!browser_context->IsOffTheRecord());
54 Profile* profile = Profile::FromBrowserContext(browser_context);
56 return new BookmarkServerClusterService(
57 g_browser_process->GetApplicationLocale(),
58 browser_context->GetRequestContext(),
59 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
60 SigninManagerFactory::GetForProfile(profile),
61 EnhancedBookmarkModelFactory::GetForBrowserContext(profile),
62 ProfileSyncServiceFactory::GetForProfile(profile), profile->GetPrefs());
65 content::BrowserContext*
66 BookmarkServerClusterServiceFactory::GetBrowserContextToUse(
67 content::BrowserContext* context) const {
68 return chrome::GetBrowserContextRedirectedInIncognito(context);
71 } // namespace enhanced_bookmarks