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

Unified Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_util.h

Issue 2025443002: Refactoring data reduction proxy some methods to common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing nits Created 4 years, 7 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: components/data_reduction_proxy/core/common/data_reduction_proxy_util.h
diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_util.h b/components/data_reduction_proxy/core/common/data_reduction_proxy_util.h
index c3ed69658625e1d4db540f46250966e4e858ccac..a7a5c4744747fe9cdc3fe5b58de5a157ec2ad3d2 100644
--- a/components/data_reduction_proxy/core/common/data_reduction_proxy_util.h
+++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_util.h
@@ -1,16 +1,61 @@
// Copyright 2016 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 COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_UTIL_H_
#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_UTIL_H_
+#include <memory>
#include <string>
+#include "components/data_reduction_proxy/proto/client_config.pb.h"
+#include "net/proxy/proxy_server.h"
+#include "url/gurl.h"
+
+namespace base {
+class Time;
+class TimeDelta;
+}
+
namespace data_reduction_proxy {
// Returns true if the request method is idempotent.
bool IsMethodIdempotent(const std::string& method);
+GURL AddApiKeyToUrl(const GURL& url);
+
+namespace protobuf_parser {
+
+// Returns the |net::ProxyServer::Scheme| for a ProxyServer_ProxyScheme.
+net::ProxyServer::Scheme SchemeFromProxyScheme(
+ ProxyServer_ProxyScheme proxy_scheme);
+
+// Returns the ProxyServer_ProxyScheme for a |net::ProxyServer::Scheme|.
+ProxyServer_ProxyScheme ProxySchemeFromScheme(net::ProxyServer::Scheme scheme);
+
+// Returns the |Duration| representation of |time_delta|.
+void TimeDeltaToDuration(const base::TimeDelta& time_delta, Duration* duration);
+
+// Returns the |base::TimeDelta| representation of |duration|. This is accurate
+// to the microsecond.
+base::TimeDelta DurationToTimeDelta(const Duration& duration);
+
+// Returns the |Timestamp| representation of |time|.
+void TimeToTimestamp(const base::Time& time, Timestamp* timestamp);
+
+// Returns the |Time| representation of |timestamp|. This is accurate to the
+// microsecond.
+base::Time TimestampToTime(const Timestamp& timestamp);
+
+// Returns an allocated |Duration| unique pointer.
+std::unique_ptr<Duration> CreateDurationFromTimeDelta(
+ const base::TimeDelta& time_delta);
+
+// Returns an allocated |Timestamp| unique pointer.
+std::unique_ptr<Timestamp> CreateTimestampFromTime(const base::Time& time);
+
+} // namespace protobuf_parser
+
} // namespace data_reduction_proxy
+
#endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_UTIL_H_

Powered by Google App Engine
This is Rietveld 408576698