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

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: Fix unit test 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 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 void ProfileSyncService::Observe(int type, 1231 void ProfileSyncService::Observe(int type,
1232 const NotificationSource& source, 1232 const NotificationSource& source,
1233 const NotificationDetails& details) { 1233 const NotificationDetails& details) {
1234 switch (type) { 1234 switch (type) {
1235 case chrome::NOTIFICATION_SYNC_CONFIGURE_START: { 1235 case chrome::NOTIFICATION_SYNC_CONFIGURE_START: {
1236 NotifyObservers(); 1236 NotifyObservers();
1237 // TODO(sync): Maybe toast? 1237 // TODO(sync): Maybe toast?
1238 break; 1238 break;
1239 } 1239 }
1240 case chrome::NOTIFICATION_SYNC_CONFIGURE_DONE: { 1240 case chrome::NOTIFICATION_SYNC_CONFIGURE_DONE: {
1241 DataTypeManager::ConfigureResultWithErrorLocation* result_with_location = 1241 DataTypeManager::ConfigureResult* result =
1242 Details<DataTypeManager::ConfigureResultWithErrorLocation>( 1242 Details<DataTypeManager::ConfigureResult>(details).ptr();
1243 details).ptr();
1244 1243
1245 DataTypeManager::ConfigureResult result = result_with_location->result; 1244 DataTypeManager::ConfigureStatus status = result->status;
1246 VLOG(1) << "PSS SYNC_CONFIGURE_DONE called with result: " << result; 1245 VLOG(1) << "PSS SYNC_CONFIGURE_DONE called with status: " << status;
1247 if (result == DataTypeManager::ABORTED && 1246 if (status == DataTypeManager::ABORTED &&
1248 expect_sync_configuration_aborted_) { 1247 expect_sync_configuration_aborted_) {
1249 VLOG(0) << "ProfileSyncService::Observe Sync Configure aborted"; 1248 VLOG(0) << "ProfileSyncService::Observe Sync Configure aborted";
1250 expect_sync_configuration_aborted_ = false; 1249 expect_sync_configuration_aborted_ = false;
1251 return; 1250 return;
1252 } 1251 }
1253 // Clear out the gaia password if it is already there. 1252 // Clear out the gaia password if it is already there.
1254 gaia_password_ = std::string(); 1253 gaia_password_ = std::string();
1255 if (result != DataTypeManager::OK) { 1254 if (status != DataTypeManager::OK) {
1256 VLOG(0) << "ProfileSyncService::Observe: Unrecoverable error detected"; 1255 VLOG(0) << "ProfileSyncService::Observe: Unrecoverable error detected";
1257 std::string message = StringPrintf("Sync Configuration failed with %d", 1256 std::string message =
1258 result); 1257 StringPrintf(
1259 OnUnrecoverableError(*(result_with_location->location), message); 1258 "Sync Configuration failed while configuring %s with result %d",
1259 syncable::ModelTypeSetToString(result->failed_types).c_str(),
1260 status);
1261 OnUnrecoverableError(result->location, message);
1260 cached_passphrase_ = CachedPassphrase(); 1262 cached_passphrase_ = CachedPassphrase();
1261 return; 1263 return;
1262 } 1264 }
1263 1265
1264 // If the user had entered a custom passphrase use it now. 1266 // If the user had entered a custom passphrase use it now.
1265 if (!cached_passphrase_.value.empty()) { 1267 if (!cached_passphrase_.value.empty()) {
1266 // Don't hold on to the passphrase in raw form longer than needed. 1268 // Don't hold on to the passphrase in raw form longer than needed.
1267 SetPassphrase(cached_passphrase_.value, 1269 SetPassphrase(cached_passphrase_.value,
1268 cached_passphrase_.is_explicit, 1270 cached_passphrase_.is_explicit,
1269 cached_passphrase_.is_creation); 1271 cached_passphrase_.is_creation);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 // is initialized, all enabled data types are consistent with one 1390 // is initialized, all enabled data types are consistent with one
1389 // another, and no unrecoverable error has transpired. 1391 // another, and no unrecoverable error has transpired.
1390 if (unrecoverable_error_detected_) 1392 if (unrecoverable_error_detected_)
1391 return false; 1393 return false;
1392 1394
1393 if (!data_type_manager_.get()) 1395 if (!data_type_manager_.get())
1394 return false; 1396 return false;
1395 1397
1396 return data_type_manager_->state() == DataTypeManager::CONFIGURED; 1398 return data_type_manager_->state() == DataTypeManager::CONFIGURED;
1397 } 1399 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698