| 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/cancellation_signal.h" |
| 15 | 16 |
| 16 namespace syncer { | 17 namespace syncer { |
| 17 | 18 |
| 19 class ConnectionDisconnectHandle; |
| 18 class HttpPostProviderFactory; | 20 class HttpPostProviderFactory; |
| 19 class HttpPostProviderInterface; | 21 class HttpPostProviderInterface; |
| 20 | 22 |
| 21 // This provides HTTP Post functionality through the interface provided | 23 // This provides HTTP Post functionality through the interface provided |
| 22 // to the sync API by the application hosting the syncer backend. | 24 // to the sync API by the application hosting the syncer backend. |
| 23 class SyncAPIBridgedConnection : public ServerConnectionManager::Connection { | 25 class SyncAPIBridgedConnection : public ServerConnectionManager::Connection { |
| 24 public: | 26 public: |
| 25 SyncAPIBridgedConnection(ServerConnectionManager* scm, | 27 SyncAPIBridgedConnection(ServerConnectionManager* scm, |
| 26 HttpPostProviderFactory* factory); | 28 HttpPostProviderFactory* factory); |
| 27 | 29 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 48 // subclass so that we can override MakePost() to generate a POST object using | 50 // subclass so that we can override MakePost() to generate a POST object using |
| 49 // an instance of the HttpPostProviderFactory class. | 51 // an instance of the HttpPostProviderFactory class. |
| 50 class SYNC_EXPORT_PRIVATE SyncAPIServerConnectionManager | 52 class SYNC_EXPORT_PRIVATE SyncAPIServerConnectionManager |
| 51 : public ServerConnectionManager { | 53 : public ServerConnectionManager { |
| 52 public: | 54 public: |
| 53 // Takes ownership of factory. | 55 // Takes ownership of factory. |
| 54 SyncAPIServerConnectionManager(const std::string& server, | 56 SyncAPIServerConnectionManager(const std::string& server, |
| 55 int port, | 57 int port, |
| 56 bool use_ssl, | 58 bool use_ssl, |
| 57 bool use_oauth2_token, | 59 bool use_oauth2_token, |
| 58 HttpPostProviderFactory* factory); | 60 HttpPostProviderFactory* factory, |
| 61 CancellationSignal* cancellation_signal); |
| 59 virtual ~SyncAPIServerConnectionManager(); | 62 virtual ~SyncAPIServerConnectionManager(); |
| 60 | 63 |
| 61 // ServerConnectionManager overrides. | 64 // ServerConnectionManager overrides. |
| 62 virtual Connection* MakeConnection() OVERRIDE; | 65 virtual Connection* MakeConnection() OVERRIDE; |
| 63 | 66 |
| 64 private: | 67 private: |
| 68 FRIEND_TEST_ALL_PREFIXES( |
| 69 SyncAPIServerConnectionManagerTest, VeryEarlyAbortPost); |
| 65 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, EarlyAbortPost); | 70 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, EarlyAbortPost); |
| 66 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, AbortPost); | 71 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, AbortPost); |
| 67 | 72 |
| 68 // A factory creating concrete HttpPostProviders for use whenever we need to | 73 // A factory creating concrete HttpPostProviders for use whenever we need to |
| 69 // issue a POST to sync servers. | 74 // issue a POST to sync servers. |
| 70 scoped_ptr<HttpPostProviderFactory> post_provider_factory_; | 75 scoped_ptr<HttpPostProviderFactory> post_provider_factory_; |
| 71 | 76 |
| 72 DISALLOW_COPY_AND_ASSIGN(SyncAPIServerConnectionManager); | 77 DISALLOW_COPY_AND_ASSIGN(SyncAPIServerConnectionManager); |
| 73 }; | 78 }; |
| 74 | 79 |
| 75 } // namespace syncer | 80 } // namespace syncer |
| 76 | 81 |
| 77 #endif // SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ | 82 #endif // SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ |
| OLD | NEW |