Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / sync / engine / sync_engine_event_listener.h
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 SYNC_ENGINE_SYNC_ENGINE_EVENT_LISTENER_H_
6 #define SYNC_ENGINE_SYNC_ENGINE_EVENT_LISTENER_H_
7
8 #include "base/time/time.h"
9 #include "sync/base/sync_export.h"
10 #include "sync/internal_api/public/base/model_type.h"
11
12 namespace syncer {
13
14 struct SyncProtocolError;
15 struct SyncCycleEvent;
16
17 class SYNC_EXPORT_PRIVATE SyncEngineEventListener {
18  public:
19   SyncEngineEventListener();
20
21   // Generated at various points during the sync cycle.
22   virtual void OnSyncCycleEvent(const SyncCycleEvent& event) = 0;
23
24   // This event is sent when we receive an actionable error. It is up to
25   // the listeners to figure out the action to take using the error sent.
26   virtual void OnActionableError(const SyncProtocolError& error) = 0;
27
28   // This event is sent when scheduler decides to wait before next request
29   // either because it gets throttled by server or because it backs off after
30   // request failure. Retry time is passed in retry_time field of event.
31   virtual void OnRetryTimeChanged(base::Time retry_time) = 0;
32
33   // This event is sent when types are throttled or unthrottled.
34   virtual void OnThrottledTypesChanged(ModelTypeSet throttled_types) = 0;
35
36   // This event is sent when the server requests a migration.
37   virtual void OnMigrationRequested(ModelTypeSet migration_types) = 0;
38
39  protected:
40   virtual ~SyncEngineEventListener();
41 };
42
43 }  // namespace syncer
44
45 #endif  // SYNC_ENGINE_SYNC_ENGINE_EVENT_LISTENER_H_