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

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

Issue 15701022: [Sync] Add support for sync Persistence Errors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move bookmark change into separate patch Created 7 years, 5 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.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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 853
854 // TODO(zea): Move this logic into the DataTypeController/DataTypeManager. 854 // TODO(zea): Move this logic into the DataTypeController/DataTypeManager.
855 void ProfileSyncService::DisableBrokenDatatype( 855 void ProfileSyncService::DisableBrokenDatatype(
856 syncer::ModelType type, 856 syncer::ModelType type,
857 const tracked_objects::Location& from_here, 857 const tracked_objects::Location& from_here,
858 std::string message) { 858 std::string message) {
859 // First deactivate the type so that no further server changes are 859 // First deactivate the type so that no further server changes are
860 // passed onto the change processor. 860 // passed onto the change processor.
861 DeactivateDataType(type); 861 DeactivateDataType(type);
862 862
863 syncer::SyncError error(from_here, message, type); 863 syncer::SyncError error(from_here,
864 syncer::SyncError::DATATYPE_ERROR,
865 message,
866 type);
864 867
865 std::map<syncer::ModelType, syncer::SyncError> errors; 868 std::map<syncer::ModelType, syncer::SyncError> errors;
866 errors[type] = error; 869 errors[type] = error;
867 870
868 // Update this before posting a task. So if a configure happens before 871 // Update this before posting a task. So if a configure happens before
869 // the task that we are going to post, this type would still be disabled. 872 // the task that we are going to post, this type would still be disabled.
870 failed_data_types_handler_.UpdateFailedDataTypes( 873 failed_data_types_handler_.UpdateFailedDataTypes(errors);
871 errors,
872 FailedDataTypesHandler::RUNTIME);
873 874
874 base::MessageLoop::current()->PostTask(FROM_HERE, 875 base::MessageLoop::current()->PostTask(FROM_HERE,
875 base::Bind(&ProfileSyncService::ReconfigureDatatypeManager, 876 base::Bind(&ProfileSyncService::ReconfigureDatatypeManager,
876 weak_factory_.GetWeakPtr())); 877 weak_factory_.GetWeakPtr()));
877 } 878 }
878 879
879 void ProfileSyncService::OnBackendInitialized( 880 void ProfileSyncService::OnBackendInitialized(
880 const syncer::WeakHandle<syncer::JsBackend>& js_backend, 881 const syncer::WeakHandle<syncer::JsBackend>& js_backend,
881 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& 882 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
882 debug_info_listener, 883 debug_info_listener,
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 configure_status_ != DataTypeManager::PARTIAL_SUCCESS) { 1271 configure_status_ != DataTypeManager::PARTIAL_SUCCESS) {
1271 // Something catastrophic had happened. We should only have one 1272 // Something catastrophic had happened. We should only have one
1272 // error representing it. 1273 // error representing it.
1273 DCHECK_EQ(result.failed_data_types.size(), 1274 DCHECK_EQ(result.failed_data_types.size(),
1274 static_cast<unsigned int>(1)); 1275 static_cast<unsigned int>(1));
1275 syncer::SyncError error = result.failed_data_types.begin()->second; 1276 syncer::SyncError error = result.failed_data_types.begin()->second;
1276 DCHECK(error.IsSet()); 1277 DCHECK(error.IsSet());
1277 std::string message = 1278 std::string message =
1278 "Sync configuration failed with status " + 1279 "Sync configuration failed with status " +
1279 DataTypeManager::ConfigureStatusToString(configure_status_) + 1280 DataTypeManager::ConfigureStatusToString(configure_status_) +
1280 " during " + syncer::ModelTypeToString(error.type()) + 1281 " during " + syncer::ModelTypeToString(error.model_type()) +
1281 ": " + error.message(); 1282 ": " + error.message();
1282 LOG(ERROR) << "ProfileSyncService error: " << message; 1283 LOG(ERROR) << "ProfileSyncService error: " << message;
1283 OnInternalUnrecoverableError(error.location(), 1284 OnInternalUnrecoverableError(error.location(),
1284 message, 1285 message,
1285 true, 1286 true,
1286 ERROR_REASON_CONFIGURATION_FAILURE); 1287 ERROR_REASON_CONFIGURATION_FAILURE);
1287 return; 1288 return;
1288 } 1289 }
1289 1290
1290 // We should never get in a state where we have no encrypted datatypes 1291 // We should never get in a state where we have no encrypted datatypes
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
2098 std::string ProfileSyncService::GetEffectiveUsername() { 2099 std::string ProfileSyncService::GetEffectiveUsername() {
2099 #if defined(ENABLE_MANAGED_USERS) 2100 #if defined(ENABLE_MANAGED_USERS)
2100 if (ManagedUserService::ProfileIsManaged(profile_)) { 2101 if (ManagedUserService::ProfileIsManaged(profile_)) {
2101 DCHECK_EQ(std::string(), signin_->GetAuthenticatedUsername()); 2102 DCHECK_EQ(std::string(), signin_->GetAuthenticatedUsername());
2102 return ManagedUserService::GetManagedUserPseudoEmail(); 2103 return ManagedUserService::GetManagedUserPseudoEmail();
2103 } 2104 }
2104 #endif 2105 #endif
2105 2106
2106 return signin_->GetAuthenticatedUsername(); 2107 return signin_->GetAuthenticatedUsername();
2107 } 2108 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698