Home | History | Annotate | Download | only in public
      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_INTERNAL_API_PUBLIC_SYNC_CONTEXT_PROXY_H_
      6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_CONTEXT_PROXY_H_
      7 
      8 #include "base/memory/weak_ptr.h"
      9 #include "sync/internal_api/public/base/model_type.h"
     10 #include "sync/internal_api/public/non_blocking_sync_common.h"
     11 
     12 namespace syncer {
     13 
     14 class ModelTypeSyncProxyImpl;
     15 struct DataTypeState;
     16 
     17 // Interface for the datatype integration logic from non-sync threads.
     18 //
     19 // See SyncContextProxyImpl for an actual implementation.
     20 class SYNC_EXPORT_PRIVATE SyncContextProxy {
     21  public:
     22   SyncContextProxy();
     23   virtual ~SyncContextProxy();
     24 
     25   // Attempts to connect a non-blocking type to the sync context.
     26   //
     27   // Must be called from the thread where the data type lives.
     28   virtual void ConnectTypeToSync(
     29       syncer::ModelType type,
     30       const DataTypeState& data_type_state,
     31       const UpdateResponseDataList& saved_pending_updates,
     32       const base::WeakPtr<ModelTypeSyncProxyImpl>& type_sync_proxy) = 0;
     33 
     34   // Tells the syncer that we're no longer interested in syncing this type.
     35   //
     36   // Once this takes effect, the syncer can assume that it will no longer
     37   // receive commit requests for this type.  It should also stop requesting
     38   // and applying updates for this type, too.
     39   virtual void Disconnect(syncer::ModelType type) = 0;
     40 
     41   // Creates a clone of this SyncContextProxy.
     42   virtual scoped_ptr<SyncContextProxy> Clone() const = 0;
     43 };
     44 
     45 }  // namespace syncer
     46 
     47 #endif  // SYNC_INTERNAL_API_PUBLIC_SYNC_CONTEXT_PROXY_H_
     48