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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_ERROR_HANDLER_H__
6#define CHROME_BROWSER_SYNC_GLUE_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
15namespace browser_sync {
16
17class 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 tracked_objects::Location& from_here,
23      const std::string& message) = 0;
24
25  // This will create a syncer::SyncError object. This will also upload
26  // a breakpad call stack to crash server. A sync error usually means
27  // that sync has to be disabled either for that type or completely.
28  virtual syncer::SyncError CreateAndUploadError(
29      const tracked_objects::Location& location,
30      const std::string& message,
31      syncer::ModelType type) = 0;
32
33 protected:
34  virtual ~DataTypeErrorHandler() { }
35};
36
37}  // namespace browser_sync
38#endif  // CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_ERROR_HANDLER_H__
39