| OLD | NEW |
| 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/backend_migrator.h" | 5 #include "chrome/browser/sync/backend_migrator.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/tracked_objects.h" | 9 #include "base/tracked_objects.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 const ModelTypeSet intersection = | 157 const ModelTypeSet intersection = |
| 158 Intersection(result.requested_types, to_migrate_); | 158 Intersection(result.requested_types, to_migrate_); |
| 159 // This intersection check is to determine if our disable request | 159 // This intersection check is to determine if our disable request |
| 160 // was interrupted by a user changing preferred types. | 160 // was interrupted by a user changing preferred types. |
| 161 if (state_ == DISABLING_TYPES && !intersection.Empty()) { | 161 if (state_ == DISABLING_TYPES && !intersection.Empty()) { |
| 162 SDVLOG(1) << "Disable request interrupted by user changing types"; | 162 SDVLOG(1) << "Disable request interrupted by user changing types"; |
| 163 RestartMigration(); | 163 RestartMigration(); |
| 164 return; | 164 return; |
| 165 } | 165 } |
| 166 | 166 |
| 167 if (result.status != sync_driver::DataTypeManager::OK) { | 167 if (result.status != sync_driver::DataTypeManager::OK && |
| 168 result.status != sync_driver::DataTypeManager::PARTIAL_SUCCESS) { |
| 168 // If this fails, and we're disabling types, a type may or may not be | 169 // If this fails, and we're disabling types, a type may or may not be |
| 169 // disabled until the user restarts the browser. If this wasn't an abort, | 170 // disabled until the user restarts the browser. If this wasn't an abort, |
| 170 // any failure will be reported as an unrecoverable error to the UI. If it | 171 // any failure will be reported as an unrecoverable error to the UI. If it |
| 171 // was an abort, then typically things are shutting down anyway. There isn't | 172 // was an abort, then typically things are shutting down anyway. There isn't |
| 172 // much we can do in any case besides wait until a restart to try again. | 173 // much we can do in any case besides wait until a restart to try again. |
| 173 // The server will send down MIGRATION_DONE again for types needing | 174 // The server will send down MIGRATION_DONE again for types needing |
| 174 // migration as the type will still be enabled on restart. | 175 // migration as the type will still be enabled on restart. |
| 175 SLOG(WARNING) << "Unable to migrate, configuration failed!"; | 176 SLOG(WARNING) << "Unable to migrate, configuration failed!"; |
| 176 ChangeState(IDLE); | 177 ChangeState(IDLE); |
| 177 to_migrate_.Clear(); | 178 to_migrate_.Clear(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 217 |
| 217 syncer::ModelTypeSet BackendMigrator::GetPendingMigrationTypesForTest() const { | 218 syncer::ModelTypeSet BackendMigrator::GetPendingMigrationTypesForTest() const { |
| 218 return to_migrate_; | 219 return to_migrate_; |
| 219 } | 220 } |
| 220 | 221 |
| 221 #undef SDVLOG | 222 #undef SDVLOG |
| 222 | 223 |
| 223 #undef SLOG | 224 #undef SLOG |
| 224 | 225 |
| 225 }; // namespace browser_sync | 226 }; // namespace browser_sync |
| OLD | NEW |