Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / sync / test / engine / injectable_sync_context_proxy.h
blobb0ff6f6985e9353605c06d99021d66985721683f
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.
5 #ifndef SYNC_TEST_ENGINE_INJECTABLE_SYNC_CONTEXT_PROXY_H_
6 #define SYNC_TEST_ENGINE_INJECTABLE_SYNC_CONTEXT_PROXY_H_
8 #include "sync/internal_api/public/base/model_type.h"
9 #include "sync/internal_api/public/non_blocking_sync_common.h"
10 #include "sync/internal_api/public/sync_context_proxy.h"
12 namespace syncer_v2 {
14 class ModelTypeSyncProxyImpl;
15 class ModelTypeSyncWorker;
17 // A SyncContextProxy implementation that, when a connection request is made,
18 // initalizes a connection to a previously injected ModelTypeSyncProxyImpl.
19 class InjectableSyncContextProxy : public SyncContextProxy {
20 public:
21 explicit InjectableSyncContextProxy(ModelTypeSyncWorker* worker);
22 ~InjectableSyncContextProxy() override;
24 void ConnectTypeToSync(
25 syncer::ModelType type,
26 const DataTypeState& data_type_state,
27 const UpdateResponseDataList& pending_updates,
28 const base::WeakPtr<ModelTypeSyncProxyImpl>& type_sync_proxy) override;
29 void Disconnect(syncer::ModelType type) override;
30 scoped_ptr<SyncContextProxy> Clone() const override;
32 ModelTypeSyncWorker* GetWorker();
34 private:
35 // A flag to ensure ConnectTypeToSync is called at most once.
36 bool is_worker_connected_;
38 // The ModelTypeSyncProxy's contract expects that it gets to own this object,
39 // so we can retain only a non-owned pointer to it.
41 // This is very unsafe, but we can get away with it since these tests are not
42 // exercising the proxy <-> worker connection code.
43 ModelTypeSyncWorker* worker_;
46 } // namespace syncer
48 #endif // SYNC_TEST_ENGINE_INJECTABLE_SYNC_CONTEXT_PROXY_H_