summaryrefslogtreecommitdiffstats
path: root/sync/internal_api/public
diff options
context:
space:
mode:
authorpvalenzuela@chromium.org <pvalenzuela@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 01:47:46 +0000
committerpvalenzuela@chromium.org <pvalenzuela@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 01:47:46 +0000
commit2479317a4bbdf9a9d6691e4adfec01c979af6c5b (patch)
tree78862f1a679b6040f78c33f2f454eb2e614c8171 /sync/internal_api/public
parent8ff3cddc8a9b817ae7c9ccba743cab0d25eccd33 (diff)
downloadchromium_src-2479317a4bbdf9a9d6691e4adfec01c979af6c5b.zip
chromium_src-2479317a4bbdf9a9d6691e4adfec01c979af6c5b.tar.gz
chromium_src-2479317a4bbdf9a9d6691e4adfec01c979af6c5b.tar.bz2
Allow customization of HttpPostProviderFactory via ProfileSyncService
This change is being made so that Sync integration tests can eventually use an in-process, C++ fake server. BUG=323265 Review URL: https://codereview.chromium.org/73723006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239636 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api/public')
-rw-r--r--sync/internal_api/public/http_bridge.h11
-rw-r--r--sync/internal_api/public/http_bridge_network_resources.h35
-rw-r--r--sync/internal_api/public/network_resources.h33
-rw-r--r--sync/internal_api/public/network_time_update_callback.h28
4 files changed, 97 insertions, 10 deletions
diff --git a/sync/internal_api/public/http_bridge.h b/sync/internal_api/public/http_bridge.h
index be49aa7..74c7005 100644
--- a/sync/internal_api/public/http_bridge.h
+++ b/sync/internal_api/public/http_bridge.h
@@ -8,7 +8,6 @@
#include <string>
#include "base/basictypes.h"
-#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
@@ -22,6 +21,7 @@
#include "sync/internal_api/public/base/cancelation_observer.h"
#include "sync/internal_api/public/http_post_provider_factory.h"
#include "sync/internal_api/public/http_post_provider_interface.h"
+#include "sync/internal_api/public/network_time_update_callback.h"
#include "url/gurl.h"
class HttpBridgeTest;
@@ -40,15 +40,6 @@ namespace syncer {
class CancelationSignal;
-// Callback for updating the network time.
-// Params:
-// const base::Time& network_time - the new network time.
-// const base::TimeDelta& resolution - how precise the reading is.
-// const base::TimeDelta& latency - the http request's latency.
-typedef base::Callback<void(const base::Time&,
- const base::TimeDelta&,
- const base::TimeDelta&)> NetworkTimeUpdateCallback;
-
// A bridge between the syncer and Chromium HTTP layers.
// Provides a way for the sync backend to use Chromium directly for HTTP
// requests rather than depending on a third party provider (e.g libcurl).
diff --git a/sync/internal_api/public/http_bridge_network_resources.h b/sync/internal_api/public/http_bridge_network_resources.h
new file mode 100644
index 0000000..06d8284
--- /dev/null
+++ b/sync/internal_api/public/http_bridge_network_resources.h
@@ -0,0 +1,35 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_NETWORK_RESOURCES_H_
+#define SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_NETWORK_RESOURCES_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "sync/base/sync_export.h"
+#include "sync/internal_api/public/network_resources.h"
+#include "sync/internal_api/public/network_time_update_callback.h"
+
+namespace net {
+class URLRequestContextGetter;
+} // namespace net
+
+namespace syncer {
+
+class CancelationSignal;
+class HttpPostProviderFactory;
+
+class SYNC_EXPORT HttpBridgeNetworkResources : public NetworkResources {
+ public:
+ virtual ~HttpBridgeNetworkResources();
+
+ // NetworkResources
+ virtual scoped_ptr<HttpPostProviderFactory> GetHttpPostProviderFactory(
+ net::URLRequestContextGetter* baseline_context_getter,
+ const NetworkTimeUpdateCallback& network_time_update_callback,
+ CancelationSignal* cancelation_signal) OVERRIDE;
+};
+
+} // namespace syncer
+
+#endif // SYNC_INTERNAL_API_PUBLIC_HTTP_BRIDGE_NETWORK_RESOURCES_H_
diff --git a/sync/internal_api/public/network_resources.h b/sync/internal_api/public/network_resources.h
new file mode 100644
index 0000000..448188c
--- /dev/null
+++ b/sync/internal_api/public/network_resources.h
@@ -0,0 +1,33 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_INTERNAL_API_PUBLIC_NETWORK_RESOURCES_H_
+#define SYNC_INTERNAL_API_PUBLIC_NETWORK_RESOURCES_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "sync/base/sync_export.h"
+#include "sync/internal_api/public/network_time_update_callback.h"
+
+namespace net {
+class URLRequestContextGetter;
+} // namespace net
+
+namespace syncer {
+
+class CancelationSignal;
+class HttpPostProviderFactory;
+
+class SYNC_EXPORT NetworkResources {
+ public:
+ virtual ~NetworkResources() {}
+
+ virtual scoped_ptr<HttpPostProviderFactory> GetHttpPostProviderFactory(
+ net::URLRequestContextGetter* baseline_context_getter,
+ const NetworkTimeUpdateCallback& network_time_update_callback,
+ CancelationSignal* cancelation_signal) = 0;
+};
+
+} // namespace syncer
+
+#endif // SYNC_INTERNAL_API_PUBLIC_NETWORK_RESOURCES_H_
diff --git a/sync/internal_api/public/network_time_update_callback.h b/sync/internal_api/public/network_time_update_callback.h
new file mode 100644
index 0000000..1efa241
--- /dev/null
+++ b/sync/internal_api/public/network_time_update_callback.h
@@ -0,0 +1,28 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_INTERNAL_API_PUBLIC_NETWORK_TIME_UPDATE_CALLBACK_H_
+#define SYNC_INTERNAL_API_PUBLIC_NETWORK_TIME_UPDATE_CALLBACK_H_
+
+#include "base/callback.h"
+#include "base/time/time.h"
+
+namespace syncer {
+
+// TODO(pvalenzuela): Avoid duplication of this typedef by defining it in a
+// common location. This is duplicated here because its original definition in
+// NetworkTimeTracker cannot be depended on.
+//
+// Callback for updating the network time.
+// Params:
+// const base::Time& network_time - the new network time.
+// const base::TimeDelta& resolution - how precise the reading is.
+// const base::TimeDelta& latency - the http request's latency.
+typedef base::Callback<void(const base::Time&,
+ const base::TimeDelta&,
+ const base::TimeDelta&)> NetworkTimeUpdateCallback;
+
+} // namespace syncer
+
+#endif // SYNC_INTERNAL_API_PUBLIC_NETWORK_TIME_UPDATE_CALLBACK_H_