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

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

Issue 7453014: [Sync] Refactor sync datatype error handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add operator= Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <stddef.h> 7 #include <stddef.h>
8 #include <map> 8 #include <map>
9 #include <ostream> 9 #include <ostream>
10 #include <set> 10 #include <set>
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 void ProfileSyncService::Observe(int type, 1247 void ProfileSyncService::Observe(int type,
1248 const NotificationSource& source, 1248 const NotificationSource& source,
1249 const NotificationDetails& details) { 1249 const NotificationDetails& details) {
1250 switch (type) { 1250 switch (type) {
1251 case chrome::NOTIFICATION_SYNC_CONFIGURE_START: { 1251 case chrome::NOTIFICATION_SYNC_CONFIGURE_START: {
1252 NotifyObservers(); 1252 NotifyObservers();
1253 // TODO(sync): Maybe toast? 1253 // TODO(sync): Maybe toast?
1254 break; 1254 break;
1255 } 1255 }
1256 case chrome::NOTIFICATION_SYNC_CONFIGURE_DONE: { 1256 case chrome::NOTIFICATION_SYNC_CONFIGURE_DONE: {
1257 DataTypeManager::ConfigureResultWithErrorLocation* result_with_location = 1257 DataTypeManager::ConfigureResult* result =
1258 Details<DataTypeManager::ConfigureResultWithErrorLocation>( 1258 Details<DataTypeManager::ConfigureResult>(details).ptr();
1259 details).ptr();
1260 1259
1261 DataTypeManager::ConfigureResult result = result_with_location->result; 1260 DataTypeManager::ConfigureStatus status = result->status;
1262 VLOG(1) << "PSS SYNC_CONFIGURE_DONE called with result: " << result; 1261 VLOG(1) << "PSS SYNC_CONFIGURE_DONE called with status: " << status;
1263 if (result == DataTypeManager::ABORTED && 1262 if (status == DataTypeManager::ABORTED &&
1264 expect_sync_configuration_aborted_) { 1263 expect_sync_configuration_aborted_) {
1265 VLOG(0) << "ProfileSyncService::Observe Sync Configure aborted"; 1264 VLOG(0) << "ProfileSyncService::Observe Sync Configure aborted";
1266 expect_sync_configuration_aborted_ = false; 1265 expect_sync_configuration_aborted_ = false;
1267 return; 1266 return;
1268 } 1267 }
1269 // Clear out the gaia password if it is already there. 1268 // Clear out the gaia password if it is already there.
1270 gaia_password_ = std::string(); 1269 gaia_password_ = std::string();
1271 if (result != DataTypeManager::OK) { 1270 if (status != DataTypeManager::OK) {
1272 VLOG(0) << "ProfileSyncService::Observe: Unrecoverable error detected"; 1271 VLOG(0) << "ProfileSyncService::Observe: Unrecoverable error detected";
1273 std::string message = StringPrintf("Sync Configuration failed with %d", 1272 std::string message =
1274 result); 1273 StringPrintf(
1275 OnUnrecoverableError(*(result_with_location->location), message); 1274 "Sync Configuration failed while configuring %s with result %d",
1275 syncable::ModelTypeSetToString(result->failed_types).c_str(),
1276 status);
1277 OnUnrecoverableError(result->location, message);
1276 cached_passphrase_ = CachedPassphrase(); 1278 cached_passphrase_ = CachedPassphrase();
1277 return; 1279 return;
1278 } 1280 }
1279 1281
1280 // If the user had entered a custom passphrase use it now. 1282 // If the user had entered a custom passphrase use it now.
1281 if (!cached_passphrase_.value.empty()) { 1283 if (!cached_passphrase_.value.empty()) {
1282 // Don't hold on to the passphrase in raw form longer than needed. 1284 // Don't hold on to the passphrase in raw form longer than needed.
1283 SetPassphrase(cached_passphrase_.value, 1285 SetPassphrase(cached_passphrase_.value,
1284 cached_passphrase_.is_explicit, 1286 cached_passphrase_.is_explicit,
1285 cached_passphrase_.is_creation); 1287 cached_passphrase_.is_creation);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 // is initialized, all enabled data types are consistent with one 1406 // is initialized, all enabled data types are consistent with one
1405 // another, and no unrecoverable error has transpired. 1407 // another, and no unrecoverable error has transpired.
1406 if (unrecoverable_error_detected_) 1408 if (unrecoverable_error_detected_)
1407 return false; 1409 return false;
1408 1410
1409 if (!data_type_manager_.get()) 1411 if (!data_type_manager_.get())
1410 return false; 1412 return false;
1411 1413
1412 return data_type_manager_->state() == DataTypeManager::CONFIGURED; 1414 return data_type_manager_->state() == DataTypeManager::CONFIGURED;
1413 } 1415 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698