OLD | NEW |
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 "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 ProfileSyncServiceFactory::~ProfileSyncServiceFactory() { | 79 ProfileSyncServiceFactory::~ProfileSyncServiceFactory() { |
80 } | 80 } |
81 | 81 |
82 ProfileKeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor( | 82 ProfileKeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor( |
83 Profile* profile) const { | 83 Profile* profile) const { |
84 ProfileSyncService::StartBehavior behavior = | 84 ProfileSyncService::StartBehavior behavior = |
85 browser_defaults::kSyncAutoStarts ? ProfileSyncService::AUTO_START | 85 browser_defaults::kSyncAutoStarts ? ProfileSyncService::AUTO_START |
86 : ProfileSyncService::MANUAL_START; | 86 : ProfileSyncService::MANUAL_START; |
87 | 87 |
88 SigninManager* signin = SigninManagerFactory::GetForProfile(profile); | 88 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile); |
89 | 89 |
90 // TODO(atwilson): Change AboutSigninInternalsFactory to load on startup | 90 // TODO(atwilson): Change AboutSigninInternalsFactory to load on startup |
91 // once http://crbug.com/171406 has been fixed. | 91 // once http://crbug.com/171406 has been fixed. |
92 AboutSigninInternalsFactory::GetForProfile(profile); | 92 AboutSigninInternalsFactory::GetForProfile(profile); |
93 | 93 |
94 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync | 94 // TODO(tim): Currently, AUTO/MANUAL settings refer to the *first* time sync |
95 // is set up and *not* a browser restart for a manual-start platform (where | 95 // is set up and *not* a browser restart for a manual-start platform (where |
96 // sync has already been set up, and should be able to start without user | 96 // sync has already been set up, and should be able to start without user |
97 // intervention). We can get rid of the browser_default eventually, but | 97 // intervention). We can get rid of the browser_default eventually, but |
98 // need to take care that ProfileSyncService doesn't get tripped up between | 98 // need to take care that ProfileSyncService doesn't get tripped up between |
99 // those two cases. Bug 88109. | 99 // those two cases. Bug 88109. |
100 ProfileSyncService* pss = new ProfileSyncService( | 100 ProfileSyncService* pss = new ProfileSyncService( |
101 new ProfileSyncComponentsFactoryImpl(profile, | 101 new ProfileSyncComponentsFactoryImpl(profile, |
102 CommandLine::ForCurrentProcess()), | 102 CommandLine::ForCurrentProcess()), |
103 profile, | 103 profile, |
104 signin, | 104 signin, |
105 behavior); | 105 behavior); |
106 | 106 |
107 pss->factory()->RegisterDataTypes(pss); | 107 pss->factory()->RegisterDataTypes(pss); |
108 pss->Initialize(); | 108 pss->Initialize(); |
109 return pss; | 109 return pss; |
110 } | 110 } |
111 | 111 |
112 // static | 112 // static |
113 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { | 113 bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) { |
114 return GetInstance()->GetServiceForProfile(profile, false) != NULL; | 114 return GetInstance()->GetServiceForProfile(profile, false) != NULL; |
115 } | 115 } |
OLD | NEW |