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

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

Issue 10387144: [Sync] - Implement isolated model association. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review. Created 8 years, 7 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 if (encryption_pending()) 364 if (encryption_pending())
365 return true; 365 return true;
366 const syncable::ModelTypeSet preferred_types = GetPreferredDataTypes(); 366 const syncable::ModelTypeSet preferred_types = GetPreferredDataTypes();
367 const syncable::ModelTypeSet encrypted_types = GetEncryptedDataTypes(); 367 const syncable::ModelTypeSet encrypted_types = GetEncryptedDataTypes();
368 DCHECK(encrypted_types.Has(syncable::PASSWORDS)); 368 DCHECK(encrypted_types.Has(syncable::PASSWORDS));
369 return !Intersection(preferred_types, encrypted_types).Empty(); 369 return !Intersection(preferred_types, encrypted_types).Empty();
370 } 370 }
371 371
372 void ProfileSyncService::OnSyncConfigureDone( 372 void ProfileSyncService::OnSyncConfigureDone(
373 DataTypeManager::ConfigureResult result) { 373 DataTypeManager::ConfigureResult result) {
374 if (failed_datatypes_handler_.UpdateFailedDatatypes(result.errors, 374 if (failed_datatypes_handler_.UpdateFailedDatatypes(result.failed_data_types,
375 FailedDatatypesHandler::STARTUP)) { 375 FailedDatatypesHandler::STARTUP)) {
376 ReconfigureDatatypeManager(); 376 ReconfigureDatatypeManager();
377 } 377 }
378 } 378 }
379 379
380 void ProfileSyncService::OnSyncConfigureRetry() { 380 void ProfileSyncService::OnSyncConfigureRetry() {
381 // In platforms with auto start we would just wait for the 381 // In platforms with auto start we would just wait for the
382 // configure to finish. In other platforms we would throw 382 // configure to finish. In other platforms we would throw
383 // an unrecoverable error. The reason we do this is so that 383 // an unrecoverable error. The reason we do this is so that
384 // the login dialog would show an error and the user would have 384 // the login dialog would show an error and the user would have
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 if (configure_status_ == DataTypeManager::RETRY) { 1430 if (configure_status_ == DataTypeManager::RETRY) {
1431 OnSyncConfigureRetry(); 1431 OnSyncConfigureRetry();
1432 return; 1432 return;
1433 } 1433 }
1434 1434
1435 // Handle unrecoverable error. 1435 // Handle unrecoverable error.
1436 if (configure_status_ != DataTypeManager::OK && 1436 if (configure_status_ != DataTypeManager::OK &&
1437 configure_status_ != DataTypeManager::PARTIAL_SUCCESS) { 1437 configure_status_ != DataTypeManager::PARTIAL_SUCCESS) {
1438 // Something catastrophic had happened. We should only have one 1438 // Something catastrophic had happened. We should only have one
1439 // error representing it. 1439 // error representing it.
1440 DCHECK(result->errors.size() == 1); 1440 DCHECK(result->failed_data_types.size() == 1);
tim (not reviewing) 2012/05/21 23:18:57 DCHECK_EQ
lipalani1 2012/05/22 01:23:58 Done.
1441 SyncError error = result->errors.front(); 1441 SyncError error = result->failed_data_types.front();
1442 DCHECK(error.IsSet()); 1442 DCHECK(error.IsSet());
1443 std::string message = 1443 std::string message =
1444 "Sync configuration failed with status " + 1444 "Sync configuration failed with status " +
1445 DataTypeManager::ConfigureStatusToString(configure_status_) + 1445 DataTypeManager::ConfigureStatusToString(configure_status_) +
1446 " during " + syncable::ModelTypeToString(error.type()) + 1446 " during " + syncable::ModelTypeToString(error.type()) +
1447 ": " + error.message(); 1447 ": " + error.message();
1448 LOG(ERROR) << "ProfileSyncService error: " 1448 LOG(ERROR) << "ProfileSyncService error: "
1449 << message; 1449 << message;
1450 OnUnrecoverableError(error.location(), message); 1450 OnUnrecoverableError(error.location(), message);
1451 return; 1451 return;
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. 1658 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru.
1659 ProfileSyncService* old_this = this; 1659 ProfileSyncService* old_this = this;
1660 this->~ProfileSyncService(); 1660 this->~ProfileSyncService();
1661 new(old_this) ProfileSyncService( 1661 new(old_this) ProfileSyncService(
1662 new ProfileSyncComponentsFactoryImpl(profile, 1662 new ProfileSyncComponentsFactoryImpl(profile,
1663 CommandLine::ForCurrentProcess()), 1663 CommandLine::ForCurrentProcess()),
1664 profile, 1664 profile,
1665 signin, 1665 signin,
1666 behavior); 1666 behavior);
1667 } 1667 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698