Reland "Adding IPP request/response objs"

This reverts commit b1ac1568227a67e328a19a03e258e53464066e9d.

Reason for revert: fixed fatal build error

Original change's description:
> Revert "Adding IPP request/response objs"
>
> This reverts commit 99739ac0f4d375b7027238968f9ac74c5ed038ba.
>
> Reason for revert: suspected to have caused tree closure
> fatal error: 'chrome/services/cups_ipp_parser/public/mojom/ipp_parser.mojom.h' file not found
> from https://ci.chromium.org/p/chromium/builders/ci/chromeos-amd64-generic-rel/30861
>
> Original change's description:
> > Adding IPP request/response objs
> >
> > Adds POD representations of an IPP request and response along with some
> > helpful HTTP wrappers.
> >
> > Bug: chromium:945409
> > Test: tested in following CLs
> > Change-Id: I959fab98cafe0b695ab4260e67c7d9909b430fe2
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1636711
> > Reviewed-by: Ken Rockot <rockot@google.com>
> > Commit-Queue: Luum Habtemariam <luum@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#667767}
>
> TBR=rockot@google.com,luum@chromium.org,valleau@chromium.org
>
> Change-Id: I5f7c10558b5c00b059b6e4cdeeac3a70fee2ab0d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:945409
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1652710
> Reviewed-by: Ben Pastene <bpastene@chromium.org>
> Commit-Queue: Ben Pastene <bpastene@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#667814}

Change-Id: Ie9edc6d0858fae7080546aedadf0c6c7d07a00d2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:945409
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1652113
Commit-Queue: Luum Habtemariam <luum@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#668051}
diff --git a/chrome/services/cups_ipp_parser/public/cpp/BUILD.gn b/chrome/services/cups_ipp_parser/public/cpp/BUILD.gn
index 29bd299..6bf1de6e 100644
--- a/chrome/services/cups_ipp_parser/public/cpp/BUILD.gn
+++ b/chrome/services/cups_ipp_parser/public/cpp/BUILD.gn
@@ -12,9 +12,12 @@
       "ipp_converter.h",
     ]
 
+    public_deps = [
+      "//chrome/services/cups_ipp_parser/public/mojom",
+    ]
+
     deps = [
       "//base",
-      "//chrome/services/cups_ipp_parser/public/mojom",
       "//net",
       "//printing",
     ]
diff --git a/chrome/services/cups_proxy/DEPS b/chrome/services/cups_proxy/DEPS
index 4694dc2..69f0dbb 100644
--- a/chrome/services/cups_proxy/DEPS
+++ b/chrome/services/cups_proxy/DEPS
@@ -1,3 +1,4 @@
 include_rules = [
   "+chromeos/printing",
+  "+chrome/services/cups_ipp_parser/public",
 ]
diff --git a/chrome/services/cups_proxy/public/cpp/BUILD.gn b/chrome/services/cups_proxy/public/cpp/BUILD.gn
index 3170bc0..0c35dc6 100644
--- a/chrome/services/cups_proxy/public/cpp/BUILD.gn
+++ b/chrome/services/cups_proxy/public/cpp/BUILD.gn
@@ -13,17 +13,23 @@
     "type_conversions.h",
   ]
 
+  deps = [
+    "//base",
+  ]
+
   if (use_cups) {
     configs += [ "//printing:cups" ]
     sources += [
       "cups_util.cc",
       "cups_util.h",
+      "ipp_messages.cc",
+      "ipp_messages.h",
+    ]
+    public_deps = [
+      "//chrome/services/cups_ipp_parser/public/cpp",
+      "//printing",
     ]
   }
-
-  deps = [
-    "//base",
-  ]
 }
 
 source_set("manifest") {
diff --git a/chrome/services/cups_proxy/public/cpp/OWNERS b/chrome/services/cups_proxy/public/cpp/OWNERS
index 6faeaa47..cff5fd99 100644
--- a/chrome/services/cups_proxy/public/cpp/OWNERS
+++ b/chrome/services/cups_proxy/public/cpp/OWNERS
@@ -2,3 +2,8 @@
 per-file manifest.cc=file://ipc/SECURITY_OWNERS
 per-file manifest.h=set noparent
 per-file manifest.h=file://ipc/SECURITY_OWNERS
+
+per-file *_messages.cc=set noparent
+per-file *_messages.cc=file://ipc/SECURITY_OWNERS
+per-file *_messages*.h=set noparent
+per-file *_messages*.h=file://ipc/SECURITY_OWNERS
diff --git a/chrome/services/cups_proxy/public/cpp/ipp_messages.cc b/chrome/services/cups_proxy/public/cpp/ipp_messages.cc
new file mode 100644
index 0000000..5da352d
--- /dev/null
+++ b/chrome/services/cups_proxy/public/cpp/ipp_messages.cc
@@ -0,0 +1,21 @@
+// Copyright 2019 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.
+
+#include "chrome/services/cups_proxy/public/cpp/ipp_messages.h"
+
+#include "base/strings/string_piece.h"
+
+namespace cups_proxy {
+
+// Defaults for IppRequest.
+IppRequest::IppRequest() : ipp(printing::WrapIpp(nullptr)) {}
+IppRequest::IppRequest(IppRequest&& other) = default;
+IppRequest::~IppRequest() = default;
+
+// Defaults for IppResponse.
+IppResponse::IppResponse() : ipp(printing::WrapIpp(nullptr)) {}
+IppResponse::IppResponse(IppResponse&& other) = default;
+IppResponse::~IppResponse() = default;
+
+}  // namespace cups_proxy
diff --git a/chrome/services/cups_proxy/public/cpp/ipp_messages.h b/chrome/services/cups_proxy/public/cpp/ipp_messages.h
new file mode 100644
index 0000000..1654c8f
--- /dev/null
+++ b/chrome/services/cups_proxy/public/cpp/ipp_messages.h
@@ -0,0 +1,79 @@
+// Copyright 2019 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 CHROME_SERVICES_CUPS_PROXY_PUBLIC_CPP_IPP_MESSAGES_H_
+#define CHROME_SERVICES_CUPS_PROXY_PUBLIC_CPP_IPP_MESSAGES_H_
+
+#include <cups/cups.h>
+#include <stddef.h>
+
+#include <string>
+#include <vector>
+
+#include "base/optional.h"
+#include "chrome/services/cups_ipp_parser/public/cpp/ipp_converter.h"
+#include "printing/backend/cups_ipp_util.h"
+
+// POD representations of HTTP/IPP objects.
+namespace cups_proxy {
+
+// Helpful wrapper for a HTTP Request request-line.
+struct HttpRequestLine {
+  std::string method;
+  std::string endpoint;
+  std::string http_version;
+};
+
+// POD representation of an IPP request and assorted metadata.
+struct IppRequest {
+  // Explicitly declared/defined defaults since [chromium-style] flagged this as
+  // a complex struct.
+  IppRequest();
+  IppRequest(IppRequest&& other);
+  ~IppRequest();
+
+  // Implicitly deleted by DISALLOW, so adding back in.
+  IppRequest& operator=(IppRequest&& other) = default;
+
+  std::vector<uint8_t> buffer;
+
+  HttpRequestLine request_line;
+  std::vector<ipp_converter::HttpHeader> headers;
+  printing::ScopedIppPtr ipp;
+  std::vector<uint8_t> ipp_data;
+
+  DISALLOW_COPY_AND_ASSIGN(IppRequest);
+};
+
+// Helpful wrapper for a HTTP Response status-line.
+struct HttpStatusLine {
+  std::string http_version;
+  std::string status_code;
+  std::string reason_phrase;
+};
+
+// POD representation of an IPP response and assorted metadata.
+struct IppResponse {
+  // Explicitly declared/defined defaults since [chromium-style] flagged this as
+  // a complex struct.
+  IppResponse();
+  IppResponse(IppResponse&& other);
+  ~IppResponse();
+
+  // Implicitly deleted by DISALLOW, so adding back in.
+  IppResponse& operator=(IppResponse&& other) = default;
+
+  std::vector<uint8_t> buffer;
+
+  HttpStatusLine status_line;
+  std::vector<ipp_converter::HttpHeader> headers;
+  printing::ScopedIppPtr ipp;
+  std::vector<uint8_t> ipp_data;
+
+  DISALLOW_COPY_AND_ASSIGN(IppResponse);
+};
+
+}  // namespace cups_proxy
+
+#endif  // CHROME_SERVICES_CUPS_PROXY_PUBLIC_CPP_IPP_MESSAGES_H_