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

Side by Side Diff: chrome/browser/sync/engine/net/syncapi_server_connection_manager.h

Issue 3814013: FBTF: Monster ctor patch after changing heuristics in clang plugin. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: More add file fail Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 CHROME_BROWSER_SYNC_ENGINE_NET_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ 5 #ifndef CHROME_BROWSER_SYNC_ENGINE_NET_SYNCAPI_SERVER_CONNECTION_MANAGER_H_
6 #define CHROME_BROWSER_SYNC_ENGINE_NET_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ 6 #define CHROME_BROWSER_SYNC_ENGINE_NET_SYNCAPI_SERVER_CONNECTION_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/scoped_ptr.h" 11 #include "base/scoped_ptr.h"
12 #include "chrome/browser/sync/engine/net/server_connection_manager.h" 12 #include "chrome/browser/sync/engine/net/server_connection_manager.h"
13 13
14 namespace sync_api { 14 namespace sync_api {
15 15
16 class HttpPostProviderFactory; 16 class HttpPostProviderFactory;
17 17
18 // This provides HTTP Post functionality through the interface provided 18 // This provides HTTP Post functionality through the interface provided
19 // to the sync API by the application hosting the syncer backend. 19 // to the sync API by the application hosting the syncer backend.
20 class SyncAPIBridgedPost 20 class SyncAPIBridgedPost
21 : public browser_sync::ServerConnectionManager::Post { 21 : public browser_sync::ServerConnectionManager::Post {
22 public: 22 public:
23 SyncAPIBridgedPost(browser_sync::ServerConnectionManager* scm, 23 SyncAPIBridgedPost(browser_sync::ServerConnectionManager* scm,
24 HttpPostProviderFactory* factory) 24 HttpPostProviderFactory* factory);
25 : Post(scm), factory_(factory) {
26 }
27 25
28 virtual ~SyncAPIBridgedPost() { } 26 virtual ~SyncAPIBridgedPost();
29 27
30 virtual bool Init(const char* path, 28 virtual bool Init(const char* path,
31 const std::string& auth_token, 29 const std::string& auth_token,
32 const std::string& payload, 30 const std::string& payload,
33 browser_sync::HttpResponse* response); 31 browser_sync::HttpResponse* response);
34 32
35 private: 33 private:
36 // Pointer to the factory we use for creating HttpPostProviders. We do not 34 // Pointer to the factory we use for creating HttpPostProviders. We do not
37 // own |factory_|. 35 // own |factory_|.
38 HttpPostProviderFactory* factory_; 36 HttpPostProviderFactory* factory_;
39 37
40 DISALLOW_COPY_AND_ASSIGN(SyncAPIBridgedPost); 38 DISALLOW_COPY_AND_ASSIGN(SyncAPIBridgedPost);
41 }; 39 };
42 40
43 // A ServerConnectionManager subclass used by the syncapi layer. We use a 41 // A ServerConnectionManager subclass used by the syncapi layer. We use a
44 // subclass so that we can override MakePost() to generate a POST object using 42 // subclass so that we can override MakePost() to generate a POST object using
45 // an instance of the HttpPostProviderFactory class. 43 // an instance of the HttpPostProviderFactory class.
46 class SyncAPIServerConnectionManager 44 class SyncAPIServerConnectionManager
47 : public browser_sync::ServerConnectionManager { 45 : public browser_sync::ServerConnectionManager {
48 public: 46 public:
49 // Takes ownership of factory. 47 // Takes ownership of factory.
50 SyncAPIServerConnectionManager(const std::string& server, 48 SyncAPIServerConnectionManager(const std::string& server,
51 int port, 49 int port,
52 bool use_ssl, 50 bool use_ssl,
53 const std::string& client_version, 51 const std::string& client_version,
54 HttpPostProviderFactory* factory) 52 HttpPostProviderFactory* factory);
55 : ServerConnectionManager(server, port, use_ssl, client_version), 53 virtual ~SyncAPIServerConnectionManager();
56 post_provider_factory_(factory) {
57 DCHECK(post_provider_factory_.get());
58 }
59 54
60 virtual ~SyncAPIServerConnectionManager();
61 protected: 55 protected:
62 virtual Post* MakePost() { 56 virtual Post* MakePost();
63 return new SyncAPIBridgedPost(this, post_provider_factory_.get()); 57
64 }
65 private: 58 private:
66 // A factory creating concrete HttpPostProviders for use whenever we need to 59 // A factory creating concrete HttpPostProviders for use whenever we need to
67 // issue a POST to sync servers. 60 // issue a POST to sync servers.
68 scoped_ptr<HttpPostProviderFactory> post_provider_factory_; 61 scoped_ptr<HttpPostProviderFactory> post_provider_factory_;
69 62
70 DISALLOW_COPY_AND_ASSIGN(SyncAPIServerConnectionManager); 63 DISALLOW_COPY_AND_ASSIGN(SyncAPIServerConnectionManager);
71 }; 64 };
72 65
73 } // namespace sync_api 66 } // namespace sync_api
74 67
75 #endif // CHROME_BROWSER_SYNC_ENGINE_NET_SYNCAPI_SERVER_CONNECTION_MANAGER_H_ 68 #endif // CHROME_BROWSER_SYNC_ENGINE_NET_SYNCAPI_SERVER_CONNECTION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698