OLD | NEW |
1 // Copyright (c) 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/engine/net/server_connection_manager.h" | 14 #include "sync/engine/net/server_connection_manager.h" |
14 | 15 |
15 namespace syncer { | 16 namespace syncer { |
16 | 17 |
17 class HttpPostProviderFactory; | 18 class HttpPostProviderFactory; |
18 class HttpPostProviderInterface; | 19 class HttpPostProviderInterface; |
19 | 20 |
20 // This provides HTTP Post functionality through the interface provided | 21 // This provides HTTP Post functionality through the interface provided |
21 // to the sync API by the application hosting the syncer backend. | 22 // to the sync API by the application hosting the syncer backend. |
22 class SyncAPIBridgedConnection : public ServerConnectionManager::Connection { | 23 class SyncAPIBridgedConnection : public ServerConnectionManager::Connection { |
(...skipping 16 matching lines...) Expand all Loading... |
39 HttpPostProviderFactory* factory_; | 40 HttpPostProviderFactory* factory_; |
40 | 41 |
41 HttpPostProviderInterface* post_provider_; | 42 HttpPostProviderInterface* post_provider_; |
42 | 43 |
43 DISALLOW_COPY_AND_ASSIGN(SyncAPIBridgedConnection); | 44 DISALLOW_COPY_AND_ASSIGN(SyncAPIBridgedConnection); |
44 }; | 45 }; |
45 | 46 |
46 // A ServerConnectionManager subclass used by the syncapi layer. We use a | 47 // A ServerConnectionManager subclass used by the syncapi layer. We use a |
47 // 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 |
48 // an instance of the HttpPostProviderFactory class. | 49 // an instance of the HttpPostProviderFactory class. |
49 class SyncAPIServerConnectionManager : public ServerConnectionManager { | 50 class SYNC_EXPORT_PRIVATE SyncAPIServerConnectionManager |
| 51 : public ServerConnectionManager { |
50 public: | 52 public: |
51 // Takes ownership of factory. | 53 // Takes ownership of factory. |
52 SyncAPIServerConnectionManager(const std::string& server, | 54 SyncAPIServerConnectionManager(const std::string& server, |
53 int port, | 55 int port, |
54 bool use_ssl, | 56 bool use_ssl, |
55 HttpPostProviderFactory* factory); | 57 HttpPostProviderFactory* factory); |
56 virtual ~SyncAPIServerConnectionManager(); | 58 virtual ~SyncAPIServerConnectionManager(); |
57 | 59 |
58 // ServerConnectionManager overrides. | 60 // ServerConnectionManager overrides. |
59 virtual Connection* MakeConnection() OVERRIDE; | 61 virtual Connection* MakeConnection() OVERRIDE; |
60 | 62 |
61 private: | 63 private: |
62 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, EarlyAbortPost); | 64 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, EarlyAbortPost); |
63 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, AbortPost); | 65 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, AbortPost); |
64 | 66 |
65 // A factory creating concrete HttpPostProviders for use whenever we need to | 67 // A factory creating concrete HttpPostProviders for use whenever we need to |
66 // issue a POST to sync servers. | 68 // issue a POST to sync servers. |
67 scoped_ptr<HttpPostProviderFactory> post_provider_factory_; | 69 scoped_ptr<HttpPostProviderFactory> post_provider_factory_; |
68 | 70 |
69 DISALLOW_COPY_AND_ASSIGN(SyncAPIServerConnectionManager); | 71 DISALLOW_COPY_AND_ASSIGN(SyncAPIServerConnectionManager); |
70 }; | 72 }; |
71 | 73 |
72 } // namespace syncer | 74 } // namespace syncer |
73 | 75 |
74 #endif // SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ | 76 #endif // SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ |
OLD | NEW |