1 // Copyright 2016 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_ENGINE_IMPL_LOOPBACK_SERVER_LOOPBACK_CONNECTION_MANAGER_H_ 6 #define COMPONENTS_SYNC_ENGINE_IMPL_LOOPBACK_SERVER_LOOPBACK_CONNECTION_MANAGER_H_ 7 8 #include <string> 9 10 #include "components/sync/engine_impl/loopback_server/loopback_server.h" 11 #include "components/sync/engine_impl/net/server_connection_manager.h" 12 13 namespace syncer { 14 15 // This class implements the ServerConnectionManager interface for a local 16 // in-memory virtual connection to the LoopbackServer. Since there is no network 17 // connection to be established we only have to handle POSTs and they will 18 // always succeed. 19 class LoopbackConnectionManager : public ServerConnectionManager { 20 public: 21 explicit LoopbackConnectionManager(const base::FilePath& persistent_file); 22 ~LoopbackConnectionManager() override; 23 24 private: 25 // Overridden ServerConnectionManager functions. 26 HttpResponse PostBuffer(const std::string& buffer_in, 27 const std::string& access_token, 28 std::string* buffer_out) override; 29 30 // The loopback server that will handle the requests locally. 31 LoopbackServer loopback_server_; 32 33 DISALLOW_COPY_AND_ASSIGN(LoopbackConnectionManager); 34 }; 35 36 } // namespace syncer 37 38 #endif // COMPONENTS_SYNC_ENGINE_IMPL_LOOPBACK_SERVER_LOOPBACK_CONNECTION_MANAGER_H_ 39