| 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 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 } | 1214 } |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 const GoogleServiceAuthError auth_error = | 1217 const GoogleServiceAuthError auth_error = |
| 1218 ConnectionStatusToAuthError(status); | 1218 ConnectionStatusToAuthError(status); |
| 1219 DVLOG(1) << "Connection status change: " << auth_error.ToString(); | 1219 DVLOG(1) << "Connection status change: " << auth_error.ToString(); |
| 1220 UpdateAuthErrorState(auth_error); | 1220 UpdateAuthErrorState(auth_error); |
| 1221 } | 1221 } |
| 1222 } | 1222 } |
| 1223 | 1223 |
| 1224 void ProfileSyncService::OnStopSyncingPermanently() { | 1224 void ProfileSyncService::StopSyncingPermanently() { |
| 1225 sync_prefs_.SetStartSuppressed(true); | 1225 sync_prefs_.SetStartSuppressed(true); |
| 1226 DisableForUser(); | 1226 DisableForUser(); |
| 1227 } | 1227 } |
| 1228 | 1228 |
| 1229 void ProfileSyncService::OnPassphraseRequired( | 1229 void ProfileSyncService::OnPassphraseRequired( |
| 1230 syncer::PassphraseRequiredReason reason, | 1230 syncer::PassphraseRequiredReason reason, |
| 1231 const sync_pb::EncryptedData& pending_keys) { | 1231 const sync_pb::EncryptedData& pending_keys) { |
| 1232 DCHECK(backend_.get()); | 1232 DCHECK(backend_.get()); |
| 1233 DCHECK(backend_->IsNigoriEnabled()); | 1233 DCHECK(backend_->IsNigoriEnabled()); |
| 1234 | 1234 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 syncer::UNKNOWN_ACTION); | 1328 syncer::UNKNOWN_ACTION); |
| 1329 switch (error.action) { | 1329 switch (error.action) { |
| 1330 case syncer::UPGRADE_CLIENT: | 1330 case syncer::UPGRADE_CLIENT: |
| 1331 case syncer::CLEAR_USER_DATA_AND_RESYNC: | 1331 case syncer::CLEAR_USER_DATA_AND_RESYNC: |
| 1332 case syncer::ENABLE_SYNC_ON_ACCOUNT: | 1332 case syncer::ENABLE_SYNC_ON_ACCOUNT: |
| 1333 case syncer::STOP_AND_RESTART_SYNC: | 1333 case syncer::STOP_AND_RESTART_SYNC: |
| 1334 // TODO(lipalani) : if setup in progress we want to display these | 1334 // TODO(lipalani) : if setup in progress we want to display these |
| 1335 // actions in the popup. The current experience might not be optimal for | 1335 // actions in the popup. The current experience might not be optimal for |
| 1336 // the user. We just dismiss the dialog. | 1336 // the user. We just dismiss the dialog. |
| 1337 if (setup_in_progress_) { | 1337 if (setup_in_progress_) { |
| 1338 OnStopSyncingPermanently(); | 1338 StopSyncingPermanently(); |
| 1339 expect_sync_configuration_aborted_ = true; | 1339 expect_sync_configuration_aborted_ = true; |
| 1340 } | 1340 } |
| 1341 // Trigger an unrecoverable error to stop syncing. | 1341 // Trigger an unrecoverable error to stop syncing. |
| 1342 OnInternalUnrecoverableError(FROM_HERE, | 1342 OnInternalUnrecoverableError(FROM_HERE, |
| 1343 last_actionable_error_.error_description, | 1343 last_actionable_error_.error_description, |
| 1344 true, | 1344 true, |
| 1345 ERROR_REASON_ACTIONABLE_ERROR); | 1345 ERROR_REASON_ACTIONABLE_ERROR); |
| 1346 break; | 1346 break; |
| 1347 case syncer::DISABLE_SYNC_ON_CLIENT: | 1347 case syncer::DISABLE_SYNC_ON_CLIENT: |
| 1348 OnStopSyncingPermanently(); | 1348 StopSyncingPermanently(); |
| 1349 #if !defined(OS_CHROMEOS) | 1349 #if !defined(OS_CHROMEOS) |
| 1350 // On desktop Chrome, sign out the user after a dashboard clear. | 1350 // On desktop Chrome, sign out the user after a dashboard clear. |
| 1351 // TODO(rsimha): Revisit this for M30. See http://crbug.com/252049. | 1351 // TODO(rsimha): Revisit this for M30. See http://crbug.com/252049. |
| 1352 if (!auto_start_enabled_) // Skip sign out on ChromeOS/Android. | 1352 if (!auto_start_enabled_) // Skip sign out on ChromeOS/Android. |
| 1353 SigninManagerFactory::GetForProfile(profile_)->SignOut(); | 1353 SigninManagerFactory::GetForProfile(profile_)->SignOut(); |
| 1354 #endif | 1354 #endif |
| 1355 break; | 1355 break; |
| 1356 case syncer::STOP_SYNC_FOR_DISABLED_ACCOUNT: | 1356 case syncer::STOP_SYNC_FOR_DISABLED_ACCOUNT: |
| 1357 // Sync disabled by domain admin. we should stop syncing until next | 1357 // Sync disabled by domain admin. we should stop syncing until next |
| 1358 // restart. | 1358 // restart. |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2256 status.last_get_token_error = last_get_token_error_; | 2256 status.last_get_token_error = last_get_token_error_; |
| 2257 if (request_access_token_retry_timer_.IsRunning()) | 2257 if (request_access_token_retry_timer_.IsRunning()) |
| 2258 status.next_token_request_time = next_token_request_time_; | 2258 status.next_token_request_time = next_token_request_time_; |
| 2259 return status; | 2259 return status; |
| 2260 } | 2260 } |
| 2261 | 2261 |
| 2262 void ProfileSyncService::OverrideNetworkResourcesForTest( | 2262 void ProfileSyncService::OverrideNetworkResourcesForTest( |
| 2263 scoped_ptr<syncer::NetworkResources> network_resources) { | 2263 scoped_ptr<syncer::NetworkResources> network_resources) { |
| 2264 network_resources_ = network_resources.Pass(); | 2264 network_resources_ = network_resources.Pass(); |
| 2265 } | 2265 } |
| OLD | NEW |