1 // Copyright 2020 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // TODO(crbug.com/1008939): These traits files, printing_param_traits.{cc,h}, 6 // are required for sending printing mojom types to legacy IPCs. Once the 7 // mojofication of printing is done, these traits should be removed. 8 9 #ifndef COMPONENTS_PRINTING_COMMON_PRINTING_PARAM_TRAITS_H_ 10 #define COMPONENTS_PRINTING_COMMON_PRINTING_PARAM_TRAITS_H_ 11 12 #include "components/printing/common/print.mojom.h" 13 #include "ipc/ipc_message_utils.h" 14 15 namespace base { 16 class Pickle; 17 class PickleIterator; 18 } // namespace base 19 20 namespace IPC { 21 22 template <> 23 struct ParamTraits<printing::mojom::DidPrintContentParamsPtr> { 24 typedef printing::mojom::DidPrintContentParamsPtr param_type; 25 static void Write(base::Pickle* m, const param_type& p); 26 static bool Read(const base::Pickle* m, 27 base::PickleIterator* iter, 28 param_type* r); 29 static void Log(const param_type& p, std::string* l); 30 }; 31 32 template <> 33 struct ParamTraits<printing::mojom::PrintParamsPtr> { 34 typedef printing::mojom::PrintParamsPtr param_type; 35 static void Write(base::Pickle* m, const param_type& p); 36 static bool Read(const base::Pickle* m, 37 base::PickleIterator* iter, 38 param_type* r); 39 static void Log(const param_type& p, std::string* l); 40 }; 41 42 } // namespace IPC 43 44 #endif // COMPONENTS_PRINTING_COMMON_PRINTING_PARAM_TRAITS_H_ 45