Home | History | Annotate | Download | only in sync_driver
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef COMPONENTS_SYNC_DRIVER_DATA_TYPE_ERROR_HANDLER_H__
      6 #define COMPONENTS_SYNC_DRIVER_DATA_TYPE_ERROR_HANDLER_H__
      7 
      8 #include <string>
      9 #include "base/location.h"
     10 
     11 #include "sync/api/sync_error.h"
     12 #include "sync/internal_api/public/base/model_type.h"
     13 #include "sync/internal_api/public/util/unrecoverable_error_handler.h"
     14 
     15 namespace sync_driver {
     16 
     17 class DataTypeErrorHandler {
     18  public:
     19   // Call this to disable a datatype while it is running. This is usually
     20   // called for a runtime failure that is specific to a datatype.
     21   virtual void OnSingleDataTypeUnrecoverableError(
     22       const syncer::SyncError& error) = 0;
     23 
     24   // This will create a syncer::SyncError object. This will also upload
     25   // a breakpad call stack to crash server. A sync error usually means
     26   // that sync has to be disabled either for that type or completely.
     27   virtual syncer::SyncError CreateAndUploadError(
     28       const tracked_objects::Location& location,
     29       const std::string& message,
     30       syncer::ModelType type) = 0;
     31 
     32  protected:
     33   virtual ~DataTypeErrorHandler() { }
     34 };
     35 
     36 }  // namespace sync_driver
     37 
     38 #endif  // COMPONENTS_SYNC_DRIVER_DATA_TYPE_ERROR_HANDLER_H__
     39