Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: sync/internal_api/syncapi_server_connection_manager.h

Issue 642023004: Standardize usage of virtual/override/final in sync/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 15
16 namespace syncer { 16 namespace syncer {
17 17
18 class HttpPostProviderFactory; 18 class HttpPostProviderFactory;
19 class HttpPostProviderInterface; 19 class HttpPostProviderInterface;
20 20
21 // This provides HTTP Post functionality through the interface provided 21 // This provides HTTP Post functionality through the interface provided
22 // to the sync API by the application hosting the syncer backend. 22 // to the sync API by the application hosting the syncer backend.
23 class SyncAPIBridgedConnection : public ServerConnectionManager::Connection { 23 class SyncAPIBridgedConnection : public ServerConnectionManager::Connection {
24 public: 24 public:
25 SyncAPIBridgedConnection(ServerConnectionManager* scm, 25 SyncAPIBridgedConnection(ServerConnectionManager* scm,
26 HttpPostProviderFactory* factory); 26 HttpPostProviderFactory* factory);
27 27
28 virtual ~SyncAPIBridgedConnection(); 28 ~SyncAPIBridgedConnection() override;
29 29
30 virtual bool Init(const char* path, 30 bool Init(const char* path,
31 const std::string& auth_token, 31 const std::string& auth_token,
32 const std::string& payload, 32 const std::string& payload,
33 HttpResponse* response) override; 33 HttpResponse* response) override;
34 34
35 virtual void Abort() override; 35 void Abort() override;
36 36
37 private: 37 private:
38 // Pointer to the factory we use for creating HttpPostProviders. We do not 38 // Pointer to the factory we use for creating HttpPostProviders. We do not
39 // own |factory_|. 39 // own |factory_|.
40 HttpPostProviderFactory* factory_; 40 HttpPostProviderFactory* factory_;
41 41
42 HttpPostProviderInterface* post_provider_; 42 HttpPostProviderInterface* post_provider_;
43 43
44 DISALLOW_COPY_AND_ASSIGN(SyncAPIBridgedConnection); 44 DISALLOW_COPY_AND_ASSIGN(SyncAPIBridgedConnection);
45 }; 45 };
46 46
47 // A ServerConnectionManager subclass used by the syncapi layer. We use a 47 // A ServerConnectionManager subclass used by the syncapi layer. We use a
48 // 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
49 // an instance of the HttpPostProviderFactory class. 49 // an instance of the HttpPostProviderFactory class.
50 class SYNC_EXPORT_PRIVATE SyncAPIServerConnectionManager 50 class SYNC_EXPORT_PRIVATE SyncAPIServerConnectionManager
51 : public ServerConnectionManager { 51 : public ServerConnectionManager {
52 public: 52 public:
53 // Takes ownership of factory. 53 // Takes ownership of factory.
54 SyncAPIServerConnectionManager(const std::string& server, 54 SyncAPIServerConnectionManager(const std::string& server,
55 int port, 55 int port,
56 bool use_ssl, 56 bool use_ssl,
57 HttpPostProviderFactory* factory, 57 HttpPostProviderFactory* factory,
58 CancelationSignal* cancelation_signal); 58 CancelationSignal* cancelation_signal);
59 virtual ~SyncAPIServerConnectionManager(); 59 ~SyncAPIServerConnectionManager() override;
60 60
61 // ServerConnectionManager overrides. 61 // ServerConnectionManager overrides.
62 virtual Connection* MakeConnection() override; 62 Connection* MakeConnection() override;
63 63
64 private: 64 private:
65 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, 65 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest,
66 VeryEarlyAbortPost); 66 VeryEarlyAbortPost);
67 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, EarlyAbortPost); 67 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, EarlyAbortPost);
68 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, AbortPost); 68 FRIEND_TEST_ALL_PREFIXES(SyncAPIServerConnectionManagerTest, AbortPost);
69 69
70 // A factory creating concrete HttpPostProviders for use whenever we need to 70 // A factory creating concrete HttpPostProviders for use whenever we need to
71 // issue a POST to sync servers. 71 // issue a POST to sync servers.
72 scoped_ptr<HttpPostProviderFactory> post_provider_factory_; 72 scoped_ptr<HttpPostProviderFactory> post_provider_factory_;
73 73
74 DISALLOW_COPY_AND_ASSIGN(SyncAPIServerConnectionManager); 74 DISALLOW_COPY_AND_ASSIGN(SyncAPIServerConnectionManager);
75 }; 75 };
76 76
77 } // namespace syncer 77 } // namespace syncer
78 78
79 #endif // SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ 79 #endif // SYNC_INTERNAL_API_SYNCAPI_SERVER_CONNECTION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698