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

Unified Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 10645004: [Sync] Move HttpBridge to sync/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to head Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/sync_backend_host.cc
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc
index 37824cddbdce643201bd18bf9a9a22a70b11e7b9..5bf4489f31c1e1561c7d2c023af58fec2049da9f 100644
--- a/chrome/browser/sync/glue/sync_backend_host.cc
+++ b/chrome/browser/sync/glue/sync_backend_host.cc
@@ -26,7 +26,6 @@
#include "chrome/browser/sync/glue/bridged_sync_notifier.h"
#include "chrome/browser/sync/glue/change_processor.h"
#include "chrome/browser/sync/glue/chrome_encryptor.h"
-#include "chrome/browser/sync/glue/http_bridge.h"
#include "chrome/browser/sync/glue/sync_backend_registrar.h"
#include "chrome/browser/sync/invalidations/invalidator_storage.h"
#include "chrome/browser/sync/sync_prefs.h"
@@ -43,6 +42,7 @@
#include "net/url_request/url_request_context_getter.h"
#include "sync/internal_api/public/base_transaction.h"
#include "sync/internal_api/public/engine/model_safe_worker.h"
+#include "sync/internal_api/public/http_bridge.h"
#include "sync/internal_api/public/read_transaction.h"
#include "sync/internal_api/public/util/experiments.h"
#include "sync/notifier/sync_notifier.h"
@@ -323,9 +323,41 @@ SyncBackendHost::~SyncBackendHost() {
namespace {
+// Helper to construct a user agent string (ASCII) suitable for use by
+// the syncapi for any HTTP communication. This string is used by the sync
+// backend for classifying client types when calculating statistics.
+std::string MakeUserAgentForSyncApi() {
+ std::string user_agent;
+ user_agent = "Chrome ";
+#if defined(OS_WIN)
+ user_agent += "WIN ";
+#elif defined(OS_CHROMEOS)
+ user_agent += "CROS ";
+#elif defined(OS_LINUX)
+ user_agent += "LINUX ";
+#elif defined(OS_FREEBSD)
+ user_agent += "FREEBSD ";
+#elif defined(OS_OPENBSD)
+ user_agent += "OPENBSD ";
+#elif defined(OS_MACOSX)
+ user_agent += "MAC ";
+#endif
+ chrome::VersionInfo version_info;
+ if (!version_info.is_valid()) {
+ DLOG(ERROR) << "Unable to create chrome::VersionInfo object";
+ return user_agent;
+ }
+
+ user_agent += version_info.Version();
+ user_agent += " (" + version_info.LastChange() + ")";
+ if (!version_info.IsOfficialBuild())
+ user_agent += "-devel";
+ return user_agent;
+}
+
csync::HttpPostProviderFactory* MakeHttpBridgeFactory(
const scoped_refptr<net::URLRequestContextGetter>& getter) {
- return new HttpBridgeFactory(getter);
+ return new HttpBridgeFactory(getter, MakeUserAgentForSyncApi());
}
} // namespace
@@ -1012,38 +1044,6 @@ void SyncBackendHost::Core::OnActionableError(
sync_error);
}
-// Helper to construct a user agent string (ASCII) suitable for use by
-// the syncapi for any HTTP communication. This string is used by the sync
-// backend for classifying client types when calculating statistics.
-std::string MakeUserAgentForSyncApi() {
- std::string user_agent;
- user_agent = "Chrome ";
-#if defined(OS_WIN)
- user_agent += "WIN ";
-#elif defined(OS_CHROMEOS)
- user_agent += "CROS ";
-#elif defined(OS_LINUX)
- user_agent += "LINUX ";
-#elif defined(OS_FREEBSD)
- user_agent += "FREEBSD ";
-#elif defined(OS_OPENBSD)
- user_agent += "OPENBSD ";
-#elif defined(OS_MACOSX)
- user_agent += "MAC ";
-#endif
- chrome::VersionInfo version_info;
- if (!version_info.is_valid()) {
- DLOG(ERROR) << "Unable to create chrome::VersionInfo object";
- return user_agent;
- }
-
- user_agent += version_info.Version();
- user_agent += " (" + version_info.LastChange() + ")";
- if (!version_info.IsOfficialBuild())
- user_agent += "-devel";
- return user_agent;
-}
-
void SyncBackendHost::Core::DoInitialize(const DoInitializeOptions& options) {
DCHECK(!sync_loop_);
sync_loop_ = options.sync_loop;
@@ -1078,7 +1078,6 @@ void SyncBackendHost::Core::DoInitialize(const DoInitializeOptions& options) {
options.workers,
options.extensions_activity_monitor,
options.registrar /* as SyncManager::ChangeDelegate */,
- MakeUserAgentForSyncApi(),
options.credentials,
new BridgedSyncNotifier(
options.chrome_sync_notification_bridge,
« no previous file with comments | « chrome/browser/sync/glue/http_bridge_unittest.cc ('k') | chrome/browser/sync/test/test_http_bridge_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698