Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: chrome/browser/sync/profile_sync_service_factory.cc

Issue 12077030: Allow signin to continue even if sync is disabled by policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows sync integration test failure Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/sync/profile_sync_service_factory.h" 5 #include "chrome/browser/sync/profile_sync_service_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "chrome/browser/autofill/personal_data_manager_factory.h" 9 #include "chrome/browser/autofill/personal_data_manager_factory.h"
10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
11 #include "chrome/browser/defaults.h" 11 #include "chrome/browser/defaults.h"
12 #include "chrome/browser/extensions/extension_system_factory.h" 12 #include "chrome/browser/extensions/extension_system_factory.h"
13 #include "chrome/browser/history/history_service_factory.h" 13 #include "chrome/browser/history/history_service_factory.h"
14 #include "chrome/browser/password_manager/password_store_factory.h" 14 #include "chrome/browser/password_manager/password_store_factory.h"
15 #include "chrome/browser/prefs/pref_service.h" 15 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/profiles/profile_dependency_manager.h" 17 #include "chrome/browser/profiles/profile_dependency_manager.h"
18 #include "chrome/browser/search_engines/template_url_service_factory.h" 18 #include "chrome/browser/search_engines/template_url_service_factory.h"
19 #include "chrome/browser/sessions/tab_restore_service_factory.h" 19 #include "chrome/browser/sessions/tab_restore_service_factory.h"
20 #include "chrome/browser/signin/about_signin_internals_factory.h"
20 #include "chrome/browser/signin/signin_manager.h" 21 #include "chrome/browser/signin/signin_manager.h"
21 #include "chrome/browser/signin/signin_manager_factory.h" 22 #include "chrome/browser/signin/signin_manager_factory.h"
22 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" 23 #include "chrome/browser/sync/profile_sync_components_factory_impl.h"
23 #include "chrome/browser/sync/profile_sync_service.h" 24 #include "chrome/browser/sync/profile_sync_service.h"
24 #include "chrome/browser/themes/theme_service_factory.h" 25 #include "chrome/browser/themes/theme_service_factory.h"
25 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 26 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
26 #include "chrome/browser/webdata/web_data_service_factory.h" 27 #include "chrome/browser/webdata/web_data_service_factory.h"
27 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
28 29
29 // static 30 // static
(...skipping 30 matching lines...) Expand all
60 #if defined(ENABLE_THEMES) 61 #if defined(ENABLE_THEMES)
61 DependsOn(ThemeServiceFactory::GetInstance()); 62 DependsOn(ThemeServiceFactory::GetInstance());
62 #endif 63 #endif
63 DependsOn(GlobalErrorServiceFactory::GetInstance()); 64 DependsOn(GlobalErrorServiceFactory::GetInstance());
64 DependsOn(SigninManagerFactory::GetInstance()); 65 DependsOn(SigninManagerFactory::GetInstance());
65 DependsOn(PasswordStoreFactory::GetInstance()); 66 DependsOn(PasswordStoreFactory::GetInstance());
66 DependsOn(extensions::ExtensionSystemFactory::GetInstance()); 67 DependsOn(extensions::ExtensionSystemFactory::GetInstance());
67 DependsOn(WebDataServiceFactory::GetInstance()); 68 DependsOn(WebDataServiceFactory::GetInstance());
68 DependsOn(HistoryServiceFactory::GetInstance()); 69 DependsOn(HistoryServiceFactory::GetInstance());
69 DependsOn(BookmarkModelFactory::GetInstance()); 70 DependsOn(BookmarkModelFactory::GetInstance());
71 DependsOn(AboutSigninInternalsFactory::GetInstance());
70 72
71 // The following have not been converted to ProfileKeyedServices yet, and for 73 // The following have not been converted to ProfileKeyedServices yet, and for
72 // now they are explicitly destroyed after the ProfileDependencyManager is 74 // now they are explicitly destroyed after the ProfileDependencyManager is
73 // told to DestroyProfileServices, so they will be around when the 75 // told to DestroyProfileServices, so they will be around when the
74 // ProfileSyncService is destroyed. 76 // ProfileSyncService is destroyed.
75 77
76 // DependsOn(FaviconServiceFactory::GetInstance()); 78 // DependsOn(FaviconServiceFactory::GetInstance());
77 } 79 }
78 80
79 ProfileSyncServiceFactory::~ProfileSyncServiceFactory() { 81 ProfileSyncServiceFactory::~ProfileSyncServiceFactory() {
80 } 82 }
81 83
82 ProfileKeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor( 84 ProfileKeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor(
83 Profile* profile) const { 85 Profile* profile) const {
84 ProfileSyncService::StartBehavior behavior = 86 ProfileSyncService::StartBehavior behavior =
85 browser_defaults::kSyncAutoStarts ? ProfileSyncService::AUTO_START 87 browser_defaults::kSyncAutoStarts ? ProfileSyncService::AUTO_START
86 : ProfileSyncService::MANUAL_START; 88 : ProfileSyncService::MANUAL_START;
87 89
88 SigninManager* signin = SigninManagerFactory::GetForProfile(profile); 90 SigninManager* signin = SigninManagerFactory::GetForProfile(profile);
89 91
92 // TODO(atwilson): Change AboutSigninInternalsFactory to load on startup
93 // once http://crbug.com/171406 has been fixed.
94 AboutSigninInternalsFactory::GetForProfile(profile);
95
90 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync 96 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync
91 // is set up and *not* a browser restart for a manual-start platform (where 97 // is set up and *not* a browser restart for a manual-start platform (where
92 // sync has already been set up, and should be able to start without user 98 // sync has already been set up, and should be able to start without user
93 // intervention). We can get rid of the browser_default eventually, but 99 // intervention). We can get rid of the browser_default eventually, but
94 // need to take care that ProfileSyncService doesn't get tripped up between 100 // need to take care that ProfileSyncService doesn't get tripped up between
95 // those two cases. Bug 88109. 101 // those two cases. Bug 88109.
96 ProfileSyncService* pss = new ProfileSyncService( 102 ProfileSyncService* pss = new ProfileSyncService(
97 new ProfileSyncComponentsFactoryImpl(profile, 103 new ProfileSyncComponentsFactoryImpl(profile,
98 CommandLine::ForCurrentProcess()), 104 CommandLine::ForCurrentProcess()),
99 profile, 105 profile,
100 signin, 106 signin,
101 behavior); 107 behavior);
102 108
103 pss->factory()->RegisterDataTypes(pss); 109 pss->factory()->RegisterDataTypes(pss);
104 pss->Initialize(); 110 pss->Initialize();
105 return pss; 111 return pss;
106 } 112 }
107 113
108 // static 114 // static
109 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { 115 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) {
110 return GetInstance()->GetServiceForProfile(profile, false) != NULL; 116 return GetInstance()->GetServiceForProfile(profile, false) != NULL;
111 } 117 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | chrome/browser/sync/profile_sync_service_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698