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) { | |
169 // If this fails, and we're disabling types, a type may or may not be | 168 // If this fails, and we're disabling types, a type may or may not be |
170 // disabled until the user restarts the browser. If this wasn't an abort, | 169 // disabled until the user restarts the browser. If this wasn't an abort, |
171 // any failure will be reported as an unrecoverable error to the UI. If it | 170 // any failure will be reported as an unrecoverable error to the UI. If it |
172 // was an abort, then typically things are shutting down anyway. There isn't | 171 // was an abort, then typically things are shutting down anyway. There isn't |
173 // much we can do in any case besides wait until a restart to try again. | 172 // much we can do in any case besides wait until a restart to try again. |
174 // The server will send down MIGRATION_DONE again for types needing | 173 // The server will send down MIGRATION_DONE again for types needing |
175 // migration as the type will still be enabled on restart. | 174 // migration as the type will still be enabled on restart. |
176 SLOG(WARNING) << "Unable to migrate, configuration failed!"; | 175 SLOG(WARNING) << "Unable to migrate, configuration failed!"; |
177 ChangeState(IDLE); | 176 ChangeState(IDLE); |
178 to_migrate_.Clear(); | 177 to_migrate_.Clear(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 216 |
218 syncer::ModelTypeSet BackendMigrator::GetPendingMigrationTypesForTest() const { | 217 syncer::ModelTypeSet BackendMigrator::GetPendingMigrationTypesForTest() const { |
219 return to_migrate_; | 218 return to_migrate_; |
220 } | 219 } |
221 | 220 |
222 #undef SDVLOG | 221 #undef SDVLOG |
223 | 222 |
224 #undef SLOG | 223 #undef SLOG |
225 | 224 |
226 }; // namespace browser_sync | 225 }; // namespace browser_sync |
OLD | NEW |