| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ | 5 #ifndef SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ |
| 6 #define SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ | 6 #define SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "sync/base/sync_export.h" | 13 #include "sync/base/sync_export.h" |
| 14 #include "sync/engine/net/server_connection_manager.h" | 14 #include "sync/engine/net/server_connection_manager.h" |
| 15 #include "sync/internal_api/public/base/cancelation_signal.h" | |
| 16 | 15 |
| 17 namespace syncer { | 16 namespace syncer { |
| 18 | 17 |
| 19 class ConnectionDisconnectHandle; | |
| 20 class HttpPostProviderFactory; | 18 class HttpPostProviderFactory; |
| 21 class HttpPostProviderInterface; | 19 class HttpPostProviderInterface; |
| 22 | 20 |
| 23 // This provides HTTP Post functionality through the interface provided | 21 // This provides HTTP Post functionality through the interface provided |
| 24 // to the sync API by the application hosting the syncer backend. | 22 // to the sync API by the application hosting the syncer backend. |
| 25 class SyncAPIBridgedConnection : public ServerConnectionManager::Connection { | 23 class SyncAPIBridgedConnection : public ServerConnectionManager::Connection { |
| 26 public: | 24 public: |
| 27 SyncAPIBridgedConnection(ServerConnectionManager* scm, | 25 SyncAPIBridgedConnection(ServerConnectionManager* scm, |
| 28 HttpPostProviderFactory* factory); | 26 HttpPostProviderFactory* factory); |
| 29 | 27 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 50 // subclass so that we can override MakePost() to generate a POST object using | 48 // subclass so that we can override MakePost() to generate a POST object using |
| 51 // an instance of the HttpPostProviderFactory class. | 49 // an instance of the HttpPostProviderFactory class. |
| 52 class SYNC_EXPORT_PRIVATE SyncAPIServerConnectionManager | 50 class SYNC_EXPORT_PRIVATE SyncAPIServerConnectionManager |
| 53 : public ServerConnectionManager { | 51 : public ServerConnectionManager { |
| 54 public: | 52 public: |
| 55 // Takes ownership of factory. | 53 // Takes ownership of factory. |
| 56 SyncAPIServerConnectionManager(const std::string& server, | 54 SyncAPIServerConnectionManager(const std::string& server, |
| 57 int port, | 55 int port, |
| 58 bool use_ssl, | 56 bool use_ssl, |
| 59 bool use_oauth2_token, | 57 bool use_oauth2_token, |
| 60 HttpPostProviderFactory* factory, | 58 HttpPostProviderFactory* factory); |
| 61 CancelationSignal* cancelation_signal); | |
| 62 virtual ~SyncAPIServerConnectionManager(); | 59 virtual ~SyncAPIServerConnectionManager(); |
| 63 | 60 |
| 64 // ServerConnectionManager overrides. | 61 // ServerConnectionManager overrides. |
| 65 virtual scoped_ptr<Connection> MakeConnection() OVERRIDE; | 62 virtual Connection* MakeConnection() OVERRIDE; |
| 66 | 63 |
| 67 private: | 64 private: |
| 68 FRIEND_TEST_ALL_PREFIXES( | |
| 69 SyncAPIServerConnectionManagerTest, VeryEarlyAbortPost); | |
| 70 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, EarlyAbortPost); | 65 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, EarlyAbortPost); |
| 71 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, AbortPost); | 66 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, AbortPost); |
| 72 | 67 |
| 73 // A factory creating concrete HttpPostProviders for use whenever we need to | 68 // A factory creating concrete HttpPostProviders for use whenever we need to |
| 74 // issue a POST to sync servers. | 69 // issue a POST to sync servers. |
| 75 scoped_ptr<HttpPostProviderFactory> post_provider_factory_; | 70 scoped_ptr<HttpPostProviderFactory> post_provider_factory_; |
| 76 | 71 |
| 77 DISALLOW_COPY_AND_ASSIGN(SyncAPIServerConnectionManager); | 72 DISALLOW_COPY_AND_ASSIGN(SyncAPIServerConnectionManager); |
| 78 }; | 73 }; |
| 79 | 74 |
| 80 } // namespace syncer | 75 } // namespace syncer |
| 81 | 76 |
| 82 #endif // SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ | 77 #endif // SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ |
| OLD | NEW |