| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_SYNC_API_DATA_TYPE_ERROR_HANDLER_H__ | 5 #ifndef COMPONENTS_SYNC_API_DATA_TYPE_ERROR_HANDLER_H__ |
| 6 #define COMPONENTS_SYNC_API_DATA_TYPE_ERROR_HANDLER_H__ | 6 #define COMPONENTS_SYNC_API_DATA_TYPE_ERROR_HANDLER_H__ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "components/sync/api/sync_error.h" | 13 #include "components/sync/api/sync_error.h" |
| 14 #include "components/sync/base/model_type.h" | 14 #include "components/sync/base/model_type.h" |
| 15 | 15 |
| 16 namespace syncer { | 16 namespace syncer { |
| 17 | 17 |
| 18 class DataTypeErrorHandler { | 18 class DataTypeErrorHandler { |
| 19 public: | 19 public: |
| 20 typedef base::Callback<void(const syncer::SyncError&)> ErrorCallback; | 20 typedef base::Callback<void(const SyncError&)> ErrorCallback; |
| 21 | 21 |
| 22 virtual ~DataTypeErrorHandler() {} | 22 virtual ~DataTypeErrorHandler() {} |
| 23 | 23 |
| 24 // Call this to disable a datatype while it is running. This is usually | 24 // Call this to disable a datatype while it is running. This is usually |
| 25 // called for a runtime failure that is specific to a datatype. | 25 // called for a runtime failure that is specific to a datatype. |
| 26 virtual void OnUnrecoverableError(const SyncError& error) = 0; | 26 virtual void OnUnrecoverableError(const SyncError& error) = 0; |
| 27 | 27 |
| 28 // This will create a SyncError object. This will also upload a breakpad call | 28 // This will create a SyncError object. This will also upload a breakpad call |
| 29 // stack to crash server. A sync error usually means that sync has to be | 29 // stack to crash server. A sync error usually means that sync has to be |
| 30 // disabled either for that type or completely. | 30 // disabled either for that type or completely. |
| 31 virtual SyncError CreateAndUploadError( | 31 virtual SyncError CreateAndUploadError( |
| 32 const tracked_objects::Location& location, | 32 const tracked_objects::Location& location, |
| 33 const std::string& message, | 33 const std::string& message, |
| 34 ModelType type) = 0; | 34 ModelType type) = 0; |
| 35 | 35 |
| 36 // Create a copy of this error handler. | 36 // Create a copy of this error handler. |
| 37 virtual std::unique_ptr<DataTypeErrorHandler> Copy() const = 0; | 37 virtual std::unique_ptr<DataTypeErrorHandler> Copy() const = 0; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 } // namespace syncer | 40 } // namespace syncer |
| 41 | 41 |
| 42 #endif // COMPONENTS_SYNC_API_DATA_TYPE_ERROR_HANDLER_H__ | 42 #endif // COMPONENTS_SYNC_API_DATA_TYPE_ERROR_HANDLER_H__ |
| OLD | NEW |