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

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: comments 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 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 void ProfileSyncService::Observe(int type, 1256 void ProfileSyncService::Observe(int type,
1257 const NotificationSource& source, 1257 const NotificationSource& source,
1258 const NotificationDetails& details) { 1258 const NotificationDetails& details) {
1259 switch (type) { 1259 switch (type) {
1260 case chrome::NOTIFICATION_SYNC_CONFIGURE_START: { 1260 case chrome::NOTIFICATION_SYNC_CONFIGURE_START: {
1261 NotifyObservers(); 1261 NotifyObservers();
1262 // TODO(sync): Maybe toast? 1262 // TODO(sync): Maybe toast?
1263 break; 1263 break;
1264 } 1264 }
1265 case chrome::NOTIFICATION_SYNC_CONFIGURE_DONE: { 1265 case chrome::NOTIFICATION_SYNC_CONFIGURE_DONE: {
1266 DataTypeManager::ConfigureResultWithErrorLocation* result_with_location = 1266 DataTypeManager::ConfigureResult* result =
1267 Details<DataTypeManager::ConfigureResultWithErrorLocation>( 1267 Details<DataTypeManager::ConfigureResult>(details).ptr();
1268 details).ptr();
1269 1268
1270 DataTypeManager::ConfigureResult result = result_with_location->result; 1269 DataTypeManager::ConfigureStatus status = result->status;
1271 VLOG(1) << "PSS SYNC_CONFIGURE_DONE called with result: " << result; 1270 VLOG(1) << "PSS SYNC_CONFIGURE_DONE called with status: " << status;
1272 if (result == DataTypeManager::ABORTED && 1271 if (status == DataTypeManager::ABORTED &&
1273 expect_sync_configuration_aborted_) { 1272 expect_sync_configuration_aborted_) {
1274 VLOG(0) << "ProfileSyncService::Observe Sync Configure aborted"; 1273 VLOG(0) << "ProfileSyncService::Observe Sync Configure aborted";
1275 expect_sync_configuration_aborted_ = false; 1274 expect_sync_configuration_aborted_ = false;
1276 return; 1275 return;
1277 } 1276 }
1278 // Clear out the gaia password if it is already there. 1277 // Clear out the gaia password if it is already there.
1279 gaia_password_ = std::string(); 1278 gaia_password_ = std::string();
1280 if (result != DataTypeManager::OK) { 1279 if (status != DataTypeManager::OK) {
1281 VLOG(0) << "ProfileSyncService::Observe: Unrecoverable error detected"; 1280 VLOG(0) << "ProfileSyncService::Observe: Unrecoverable error detected";
1282 std::string message = StringPrintf("Sync Configuration failed with %d", 1281 std::string message =
akalin 2011/07/25 23:49:32 I get nervous with type-unsafe APIs like Stringpri
Nicolas Zea 2011/07/26 00:23:46 Style guide discourages streams when not used dire
1283 result); 1282 StringPrintf(
1284 OnUnrecoverableError(*(result_with_location->location), message); 1283 "Sync Configuration failed while configuring %s with result %d",
1284 syncable::ModelTypeSetToString(result->failed_types).c_str(),
1285 status);
1286 OnUnrecoverableError(result->location, message);
1285 cached_passphrase_ = CachedPassphrase(); 1287 cached_passphrase_ = CachedPassphrase();
1286 return; 1288 return;
1287 } 1289 }
1288 1290
1289 // If the user had entered a custom passphrase use it now. 1291 // If the user had entered a custom passphrase use it now.
1290 if (!cached_passphrase_.value.empty()) { 1292 if (!cached_passphrase_.value.empty()) {
1291 // Don't hold on to the passphrase in raw form longer than needed. 1293 // Don't hold on to the passphrase in raw form longer than needed.
1292 SetPassphrase(cached_passphrase_.value, 1294 SetPassphrase(cached_passphrase_.value,
1293 cached_passphrase_.is_explicit, 1295 cached_passphrase_.is_explicit,
1294 cached_passphrase_.is_creation); 1296 cached_passphrase_.is_creation);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 // is initialized, all enabled data types are consistent with one 1421 // is initialized, all enabled data types are consistent with one
1420 // another, and no unrecoverable error has transpired. 1422 // another, and no unrecoverable error has transpired.
1421 if (unrecoverable_error_detected_) 1423 if (unrecoverable_error_detected_)
1422 return false; 1424 return false;
1423 1425
1424 if (!data_type_manager_.get()) 1426 if (!data_type_manager_.get())
1425 return false; 1427 return false;
1426 1428
1427 return data_type_manager_->state() == DataTypeManager::CONFIGURED; 1429 return data_type_manager_->state() == DataTypeManager::CONFIGURED;
1428 } 1430 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/typed_url_model_associator.cc ('k') | chrome/browser/sync/profile_sync_service_bookmark_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698