blob: 798c206333d37baa1abe25638079f2316fb56545 [file] [log] [blame]
// Copyright 2017 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 SERVICES_NETWORK_PUBLIC_CPP_NETWORK_IPC_PARAM_TRAITS_H_
#define SERVICES_NETWORK_PUBLIC_CPP_NETWORK_IPC_PARAM_TRAITS_H_
#include <string>
#include "base/component_export.h"
#include "base/pickle.h"
#include "ipc/ipc_param_traits.h"
#include "ipc/param_traits_macros.h"
#include "net/base/auth.h"
#include "net/base/ip_endpoint.h"
#include "net/base/proxy_server.h"
#include "net/base/request_priority.h"
#include "net/cert/cert_verify_result.h"
#include "net/cert/ct_policy_status.h"
#include "net/cert/signed_certificate_timestamp.h"
#include "net/cert/signed_certificate_timestamp_and_status.h"
#include "net/cert/x509_certificate.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_version.h"
#include "net/nqe/effective_connection_type.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/ssl/ssl_info.h"
#include "net/url_request/redirect_info.h"
#include "services/network/public/cpp/net_ipc_param_traits.h"
#include "services/network/public/cpp/origin_policy.h"
#include "services/network/public/cpp/resource_request_body.h"
#include "services/network/public/cpp/url_loader_completion_status.h"
#include "services/network/public/mojom/cors.mojom-shared.h"
#include "services/network/public/mojom/fetch_api.mojom-shared.h"
#include "url/ipc/url_param_traits.h"
#include "url/origin.h"
// This file defines IPC::ParamTraits for network:: classes / structs.
// For IPC::ParamTraits for net:: class / structs, see net_ipc_param_traits.h.
#ifndef INTERNAL_SERVICES_NETWORK_PUBLIC_CPP_NETWORK_IPC_PARAM_TRAITS_H_
#define INTERNAL_SERVICES_NETWORK_PUBLIC_CPP_NETWORK_IPC_PARAM_TRAITS_H_
#undef IPC_MESSAGE_EXPORT
#define IPC_MESSAGE_EXPORT COMPONENT_EXPORT(NETWORK_CPP_BASE)
namespace network {
struct HttpRawRequestResponseInfo;
}
namespace IPC {
template <>
struct COMPONENT_EXPORT(NETWORK_CPP_BASE)
ParamTraits<scoped_refptr<network::HttpRawRequestResponseInfo>> {
typedef scoped_refptr<network::HttpRawRequestResponseInfo> param_type;
static void Write(base::Pickle* m, const param_type& p);
static bool Read(const base::Pickle* m,
base::PickleIterator* iter,
param_type* r);
static void Log(const param_type& p, std::string* l);
};
// TODO(Richard): Remove this traits after usage of FrameHostMsg_OpenURL_Params
// disappears.
template <>
struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ParamTraits<network::DataElement> {
typedef network::DataElement param_type;
static void Write(base::Pickle* m, const param_type& p);
static bool Read(const base::Pickle* m,
base::PickleIterator* iter,
param_type* r);
static void Log(const param_type& p, std::string* l);
};
// TODO(Richard): Remove this traits after usage of FrameHostMsg_OpenURL_Params
// disappears.
template <>
struct COMPONENT_EXPORT(NETWORK_CPP_BASE)
ParamTraits<scoped_refptr<network::ResourceRequestBody>> {
typedef scoped_refptr<network::ResourceRequestBody> param_type;
static void Write(base::Pickle* m, const param_type& p);
static bool Read(const base::Pickle* m,
base::PickleIterator* iter,
param_type* r);
static void Log(const param_type& p, std::string* l);
};
} // namespace IPC
#endif // INTERNAL_SERVICES_NETWORK_PUBLIC_CPP_NETWORK_IPC_PARAM_TRAITS_H_
IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::CorsError,
network::mojom::CorsError::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::CredentialsMode,
network::mojom::CredentialsMode::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::RedirectMode,
network::mojom::RedirectMode::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::RequestMode,
network::mojom::RequestMode::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::CorsPreflightPolicy,
network::mojom::CorsPreflightPolicy::kMaxValue)
IPC_STRUCT_TRAITS_BEGIN(network::CorsErrorStatus)
IPC_STRUCT_TRAITS_MEMBER(cors_error)
IPC_STRUCT_TRAITS_MEMBER(failed_parameter)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(network::cors::PreflightTimingInfo)
IPC_STRUCT_TRAITS_MEMBER(start_time)
IPC_STRUCT_TRAITS_MEMBER(response_end)
IPC_STRUCT_TRAITS_MEMBER(alpn_negotiated_protocol)
IPC_STRUCT_TRAITS_MEMBER(connection_info)
IPC_STRUCT_TRAITS_MEMBER(timing_allow_origin)
IPC_STRUCT_TRAITS_MEMBER(transfer_size)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(network::URLLoaderCompletionStatus)
IPC_STRUCT_TRAITS_MEMBER(error_code)
IPC_STRUCT_TRAITS_MEMBER(extended_error_code)
IPC_STRUCT_TRAITS_MEMBER(exists_in_cache)
IPC_STRUCT_TRAITS_MEMBER(completion_time)
IPC_STRUCT_TRAITS_MEMBER(cors_preflight_timing_info)
IPC_STRUCT_TRAITS_MEMBER(encoded_data_length)
IPC_STRUCT_TRAITS_MEMBER(encoded_body_length)
IPC_STRUCT_TRAITS_MEMBER(decoded_body_length)
IPC_STRUCT_TRAITS_MEMBER(cors_error_status)
IPC_STRUCT_TRAITS_MEMBER(ssl_info)
IPC_STRUCT_TRAITS_MEMBER(should_report_corb_blocking)
IPC_STRUCT_TRAITS_MEMBER(proxy_server)
IPC_STRUCT_TRAITS_END()
IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::FetchResponseType,
network::mojom::FetchResponseType::kMaxValue)
IPC_ENUM_TRAITS_MAX_VALUE(network::OriginPolicyState,
network::OriginPolicyState::kMaxValue)
IPC_STRUCT_TRAITS_BEGIN(network::OriginPolicyContents)
IPC_STRUCT_TRAITS_MEMBER(features)
IPC_STRUCT_TRAITS_MEMBER(content_security_policies)
IPC_STRUCT_TRAITS_MEMBER(content_security_policies_report_only)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(network::OriginPolicy)
IPC_STRUCT_TRAITS_MEMBER(state)
IPC_STRUCT_TRAITS_MEMBER(policy_url)
IPC_STRUCT_TRAITS_MEMBER(contents)
IPC_STRUCT_TRAITS_END()
#endif // SERVICES_NETWORK_PUBLIC_CPP_NETWORK_IPC_PARAM_TRAITS_H_