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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 sync_prefs_.SetKeepEverythingSynced(true); | 272 sync_prefs_.SetKeepEverythingSynced(true); |
273 syncer::ModelTypeSet registered_types = GetRegisteredDataTypes(); | 273 syncer::ModelTypeSet registered_types = GetRegisteredDataTypes(); |
274 sync_prefs_.SetPreferredDataTypes(registered_types, | 274 sync_prefs_.SetPreferredDataTypes(registered_types, |
275 registered_types); | 275 registered_types); |
276 } | 276 } |
277 | 277 |
278 void ProfileSyncService::TryStart() { | 278 void ProfileSyncService::TryStart() { |
279 if (!IsSyncEnabledAndLoggedIn()) | 279 if (!IsSyncEnabledAndLoggedIn()) |
280 return; | 280 return; |
281 | 281 |
282 // On auto_start platforms (like ChromeOS) we don't start sync until tokens | 282 // Don't start sync until tokens are loaded, because the user can be |
283 // are loaded, because the user can be "signed in" on those platforms long | 283 // "signed in" long before the tokens get loaded, and we don't want to |
284 // before the tokens get loaded, and we don't want to generate spurious | 284 // generate spurious auth errors. |
285 // auth errors. | 285 if (!IsOAuthRefreshTokenAvailable()) |
Roger Tawa OOO till Jul 10th
2013/11/13 20:23:10
I modified this condition as we discussed over ema
| |
286 if (!IsOAuthRefreshTokenAvailable() && !(!auto_start_enabled_)) { | |
287 return; | 286 return; |
288 } | |
289 | 287 |
290 // If we got here then tokens are loaded and user logged in and sync is | 288 // If we got here then tokens are loaded and user logged in and sync is |
291 // enabled. If OAuth refresh token is not available then something is wrong. | 289 // enabled. If OAuth refresh token is not available then something is wrong. |
292 // When PSS requests access token, OAuth2TokenService will return error and | 290 // When PSS requests access token, OAuth2TokenService will return error and |
293 // PSS will show error to user asking to reauthenticate. | 291 // PSS will show error to user asking to reauthenticate. |
294 UMA_HISTOGRAM_BOOLEAN("Sync.RefreshTokenAvailable", | 292 UMA_HISTOGRAM_BOOLEAN("Sync.RefreshTokenAvailable", |
295 IsOAuthRefreshTokenAvailable()); | 293 IsOAuthRefreshTokenAvailable()); |
296 | 294 |
297 // If sync setup has completed we always start the backend. If the user is in | 295 // If sync setup has completed we always start the backend. If the user is in |
298 // the process of setting up now, we should start the backend to download | 296 // the process of setting up now, we should start the backend to download |
(...skipping 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2209 SyncTokenStatus status; | 2207 SyncTokenStatus status; |
2210 status.connection_status_update_time = connection_status_update_time_; | 2208 status.connection_status_update_time = connection_status_update_time_; |
2211 status.connection_status = connection_status_; | 2209 status.connection_status = connection_status_; |
2212 status.token_request_time = token_request_time_; | 2210 status.token_request_time = token_request_time_; |
2213 status.token_receive_time = token_receive_time_; | 2211 status.token_receive_time = token_receive_time_; |
2214 status.last_get_token_error = last_get_token_error_; | 2212 status.last_get_token_error = last_get_token_error_; |
2215 if (request_access_token_retry_timer_.IsRunning()) | 2213 if (request_access_token_retry_timer_.IsRunning()) |
2216 status.next_token_request_time = next_token_request_time_; | 2214 status.next_token_request_time = next_token_request_time_; |
2217 return status; | 2215 return status; |
2218 } | 2216 } |
OLD | NEW |