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.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 ProfileSyncService::ProfileSyncService( | 152 ProfileSyncService::ProfileSyncService( |
153 ProfileSyncComponentsFactory* factory, | 153 ProfileSyncComponentsFactory* factory, |
154 Profile* profile, | 154 Profile* profile, |
155 SigninManagerBase* signin_manager, | 155 SigninManagerBase* signin_manager, |
156 ProfileOAuth2TokenService* oauth2_token_service, | 156 ProfileOAuth2TokenService* oauth2_token_service, |
157 StartBehavior start_behavior) | 157 StartBehavior start_behavior) |
158 : last_auth_error_(AuthError::AuthErrorNone()), | 158 : last_auth_error_(AuthError::AuthErrorNone()), |
159 passphrase_required_reason_(syncer::REASON_PASSPHRASE_NOT_REQUIRED), | 159 passphrase_required_reason_(syncer::REASON_PASSPHRASE_NOT_REQUIRED), |
160 factory_(factory), | 160 factory_(factory), |
161 profile_(profile), | 161 profile_(profile), |
162 // |profile| may be NULL in unit tests. | 162 sync_prefs_(profile_->GetPrefs()), |
163 sync_prefs_(profile_ ? profile_->GetPrefs() : NULL), | |
164 sync_service_url_(kDevServerUrl), | 163 sync_service_url_(kDevServerUrl), |
165 data_type_requested_sync_startup_(false), | 164 data_type_requested_sync_startup_(false), |
166 is_first_time_sync_configure_(false), | 165 is_first_time_sync_configure_(false), |
167 backend_initialized_(false), | 166 backend_initialized_(false), |
168 sync_disabled_by_admin_(false), | 167 sync_disabled_by_admin_(false), |
169 is_auth_in_progress_(false), | 168 is_auth_in_progress_(false), |
170 signin_(signin_manager), | 169 signin_(signin_manager), |
171 unrecoverable_error_reason_(ERROR_REASON_UNSET), | 170 unrecoverable_error_reason_(ERROR_REASON_UNSET), |
172 expect_sync_configuration_aborted_(false), | 171 expect_sync_configuration_aborted_(false), |
173 encrypted_types_(syncer::SyncEncryptionHandler::SensitiveTypes()), | 172 encrypted_types_(syncer::SyncEncryptionHandler::SensitiveTypes()), |
174 encrypt_everything_(false), | 173 encrypt_everything_(false), |
175 encryption_pending_(false), | 174 encryption_pending_(false), |
176 auto_start_enabled_(start_behavior == AUTO_START), | 175 auto_start_enabled_(start_behavior == AUTO_START), |
177 configure_status_(DataTypeManager::UNKNOWN), | 176 configure_status_(DataTypeManager::UNKNOWN), |
178 setup_in_progress_(false), | 177 setup_in_progress_(false), |
179 oauth2_token_service_(oauth2_token_service), | 178 oauth2_token_service_(oauth2_token_service), |
180 request_access_token_backoff_(&kRequestAccessTokenBackoffPolicy), | 179 request_access_token_backoff_(&kRequestAccessTokenBackoffPolicy), |
181 weak_factory_(this), | 180 weak_factory_(this), |
182 connection_status_(syncer::CONNECTION_NOT_ATTEMPTED), | 181 connection_status_(syncer::CONNECTION_NOT_ATTEMPTED), |
183 last_get_token_error_(GoogleServiceAuthError::AuthErrorNone()) { | 182 last_get_token_error_(GoogleServiceAuthError::AuthErrorNone()) { |
| 183 DCHECK(profile); |
184 // By default, dev, canary, and unbranded Chromium users will go to the | 184 // By default, dev, canary, and unbranded Chromium users will go to the |
185 // development servers. Development servers have more features than standard | 185 // development servers. Development servers have more features than standard |
186 // sync servers. Users with officially-branded Chrome stable and beta builds | 186 // sync servers. Users with officially-branded Chrome stable and beta builds |
187 // will go to the standard sync servers. | 187 // will go to the standard sync servers. |
188 // | 188 // |
189 // GetChannel hits the registry on Windows. See http://crbug.com/70380. | 189 // GetChannel hits the registry on Windows. See http://crbug.com/70380. |
190 base::ThreadRestrictions::ScopedAllowIO allow_io; | 190 base::ThreadRestrictions::ScopedAllowIO allow_io; |
191 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 191 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
192 if (channel == chrome::VersionInfo::CHANNEL_STABLE || | 192 if (channel == chrome::VersionInfo::CHANNEL_STABLE || |
193 channel == chrome::VersionInfo::CHANNEL_BETA) { | 193 channel == chrome::VersionInfo::CHANNEL_BETA) { |
(...skipping 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2216 SyncTokenStatus status; | 2216 SyncTokenStatus status; |
2217 status.connection_status_update_time = connection_status_update_time_; | 2217 status.connection_status_update_time = connection_status_update_time_; |
2218 status.connection_status = connection_status_; | 2218 status.connection_status = connection_status_; |
2219 status.token_request_time = token_request_time_; | 2219 status.token_request_time = token_request_time_; |
2220 status.token_receive_time = token_receive_time_; | 2220 status.token_receive_time = token_receive_time_; |
2221 status.last_get_token_error = last_get_token_error_; | 2221 status.last_get_token_error = last_get_token_error_; |
2222 if (request_access_token_retry_timer_.IsRunning()) | 2222 if (request_access_token_retry_timer_.IsRunning()) |
2223 status.next_token_request_time = next_token_request_time_; | 2223 status.next_token_request_time = next_token_request_time_; |
2224 return status; | 2224 return status; |
2225 } | 2225 } |
OLD | NEW |