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

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 submitting. 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 if (encryption_pending()) 363 if (encryption_pending())
364 return true; 364 return true;
365 const syncable::ModelTypeSet preferred_types = GetPreferredDataTypes(); 365 const syncable::ModelTypeSet preferred_types = GetPreferredDataTypes();
366 const syncable::ModelTypeSet encrypted_types = GetEncryptedDataTypes(); 366 const syncable::ModelTypeSet encrypted_types = GetEncryptedDataTypes();
367 DCHECK(encrypted_types.Has(syncable::PASSWORDS)); 367 DCHECK(encrypted_types.Has(syncable::PASSWORDS));
368 return !Intersection(preferred_types, encrypted_types).Empty(); 368 return !Intersection(preferred_types, encrypted_types).Empty();
369 } 369 }
370 370
371 void ProfileSyncService::OnSyncConfigureDone( 371 void ProfileSyncService::OnSyncConfigureDone(
372 DataTypeManager::ConfigureResult result) { 372 DataTypeManager::ConfigureResult result) {
373 if (failed_datatypes_handler_.UpdateFailedDatatypes(result.errors, 373 if (failed_datatypes_handler_.UpdateFailedDatatypes(result.failed_data_types,
374 FailedDatatypesHandler::STARTUP)) { 374 FailedDatatypesHandler::STARTUP)) {
375 ReconfigureDatatypeManager(); 375 ReconfigureDatatypeManager();
376 } 376 }
377 } 377 }
378 378
379 void ProfileSyncService::OnSyncConfigureRetry() { 379 void ProfileSyncService::OnSyncConfigureRetry() {
380 // In platforms with auto start we would just wait for the 380 // In platforms with auto start we would just wait for the
381 // configure to finish. In other platforms we would throw 381 // configure to finish. In other platforms we would throw
382 // an unrecoverable error. The reason we do this is so that 382 // an unrecoverable error. The reason we do this is so that
383 // the login dialog would show an error and the user would have 383 // the login dialog would show an error and the user would have
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 if (configure_status_ == DataTypeManager::RETRY) { 1441 if (configure_status_ == DataTypeManager::RETRY) {
1442 OnSyncConfigureRetry(); 1442 OnSyncConfigureRetry();
1443 return; 1443 return;
1444 } 1444 }
1445 1445
1446 // Handle unrecoverable error. 1446 // Handle unrecoverable error.
1447 if (configure_status_ != DataTypeManager::OK && 1447 if (configure_status_ != DataTypeManager::OK &&
1448 configure_status_ != DataTypeManager::PARTIAL_SUCCESS) { 1448 configure_status_ != DataTypeManager::PARTIAL_SUCCESS) {
1449 // Something catastrophic had happened. We should only have one 1449 // Something catastrophic had happened. We should only have one
1450 // error representing it. 1450 // error representing it.
1451 DCHECK(result->errors.size() == 1); 1451 DCHECK_EQ(result->failed_data_types.size(),
1452 SyncError error = result->errors.front(); 1452 static_cast<unsigned int>(1));
1453 SyncError error = result->failed_data_types.front();
1453 DCHECK(error.IsSet()); 1454 DCHECK(error.IsSet());
1454 std::string message = 1455 std::string message =
1455 "Sync configuration failed with status " + 1456 "Sync configuration failed with status " +
1456 DataTypeManager::ConfigureStatusToString(configure_status_) + 1457 DataTypeManager::ConfigureStatusToString(configure_status_) +
1457 " during " + syncable::ModelTypeToString(error.type()) + 1458 " during " + syncable::ModelTypeToString(error.type()) +
1458 ": " + error.message(); 1459 ": " + error.message();
1459 LOG(ERROR) << "ProfileSyncService error: " 1460 LOG(ERROR) << "ProfileSyncService error: "
1460 << message; 1461 << message;
1461 OnUnrecoverableError(error.location(), message); 1462 OnUnrecoverableError(error.location(), message);
1462 return; 1463 return;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. 1665 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru.
1665 ProfileSyncService* old_this = this; 1666 ProfileSyncService* old_this = this;
1666 this->~ProfileSyncService(); 1667 this->~ProfileSyncService();
1667 new(old_this) ProfileSyncService( 1668 new(old_this) ProfileSyncService(
1668 new ProfileSyncComponentsFactoryImpl(profile, 1669 new ProfileSyncComponentsFactoryImpl(profile,
1669 CommandLine::ForCurrentProcess()), 1670 CommandLine::ForCurrentProcess()),
1670 profile, 1671 profile,
1671 signin, 1672 signin,
1672 behavior); 1673 behavior);
1673 } 1674 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698