print_mojom_traits.cc 648 B

1234567891011121314151617181920212223
  1. // Copyright 2022 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. #include "printing/mojom/print_mojom_traits.h"
  5. namespace mojo {
  6. // static
  7. bool StructTraits<printing::mojom::PageRangeDataView, printing::PageRange>::
  8. Read(printing::mojom::PageRangeDataView data, printing::PageRange* out) {
  9. out->from = data.from();
  10. out->to = data.to();
  11. // A range should represent increasing page numbers, not to be used to
  12. // indicate processing pages backwards.
  13. if (out->from > out->to)
  14. return false;
  15. return true;
  16. }
  17. } // namespace mojo