diff options
Diffstat (limited to 'sync/internal_api/public')
-rw-r--r-- | sync/internal_api/public/http_bridge.h | 11 | ||||
-rw-r--r-- | sync/internal_api/public/http_bridge_network_resources.h | 35 | ||||
-rw-r--r-- | sync/internal_api/public/network_resources.h | 33 | ||||
-rw-r--r-- | sync/internal_api/public/network_time_update_callback.h | 28 |
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_ |