Chromium Code Reviews| Index: components/data_reduction_proxy/core/common/client_config_parser.h |
| diff --git a/components/data_reduction_proxy/core/common/client_config_parser.h b/components/data_reduction_proxy/core/common/client_config_parser.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..308762c21ba093a064394c66e3cd4de68077676d |
| --- /dev/null |
| +++ b/components/data_reduction_proxy/core/common/client_config_parser.h |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2015 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_CLIENT_CONFIG_RESPONSE_PARSER_H_ |
| +#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_CLIENT_CONFIG_RESPONSE_PARSER_H_ |
| + |
| +#include <string> |
| + |
| +#include "components/data_reduction_proxy/proto/client_config.pb.h" |
| +#include "net/proxy/proxy_server.h" |
| + |
| +namespace base { |
| +class Time; |
| +} |
| + |
| +namespace data_reduction_proxy { |
| + |
| +// Returns a string representation (which is actually the string representation |
| +// of ProxyServer_ProxyScheme) of a |net::ProxyServer::Scheme|. |
| +std::string GetSchemeString(net::ProxyServer::Scheme scheme); |
| + |
| +// Returns the |net::ProxyServer::Scheme| for a ProxyServer_ProxyScheme. |
| +net::ProxyServer::Scheme SchemeFromProxyScheme( |
| + ProxyServer_ProxyScheme proxy_scheme); |
| + |
| +// Retrieves the ProxyServer_ProxyScheme for its string representation. |
| +ProxyServer_ProxyScheme GetProxyScheme(const std::string& scheme); |
| + |
| +// Returns the ISO-8601 representation of |time|. |
| +std::string TimeToISO8601(const base::Time& time); |
| + |
| +// Parses an ISO-8601 time string into a Timestamp proto. |
| +bool ISO8601ToTimestamp(const std::string& time, Timestamp* timestamp); |
| + |
| +// Returns the |base::Time| representation of |timestamp|. |
| +base::Time TimestampToTime(const Timestamp& timestamp); |
| + |
| +// Takes a JSON representation of a |ClientConfig| and populates |config|. |
| +// Returns false if the JSON has an unexpected structure. |
|
sclittle
2015/03/18 20:31:51
I'm confused. You turn a JSON into a proto; why do
bengr
2015/03/19 16:31:15
I agree that some explanation is in order. Please
jeremyim
2015/03/20 16:21:11
Done.
|
| +bool ParseClientConfig(const std::string& config_data, ClientConfig* config); |
| +} // namespace data_reduction_proxy |
| + |
| +#endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_CLIENT_CONFIG_RESPONSE_PARSER_H_ |