Add QUICHE_EXPORT macros in third_party/http2/adapter.

Also to FrameTypeToString() in third_party/spdy/core/spdy_protocol.h, which is
required for test_utils.cc to link in Chromium.

QUICHE_EXPORT_PRIVATE is used for definitions that are compiled in production
code but used from test code as well (otherwise linking the net_unittest
Chromium target fails).

QUICHE_NO_EXPORT is used in compilation units that are part of the net_unittest
build target, because these are not linked into any other target.  This macro is
defined empty both internally and in Chromium and is meant to supress the
presubmit error.

Also clean up dependencies using build_cleaner.

PiperOrigin-RevId: 386958565
diff --git a/http2/adapter/callback_visitor.h b/http2/adapter/callback_visitor.h
index 38c8dda..8a32862 100644
--- a/http2/adapter/callback_visitor.h
+++ b/http2/adapter/callback_visitor.h
@@ -8,13 +8,14 @@
 #include "http2/adapter/http2_visitor_interface.h"
 #include "http2/adapter/nghttp2_util.h"
 #include "third_party/nghttp2/src/lib/includes/nghttp2/nghttp2.h"
+#include "common/platform/api/quiche_export.h"
 
 namespace http2 {
 namespace adapter {
 
 // This visitor implementation accepts a set of nghttp2 callbacks and a "user
 // data" pointer, and invokes the callbacks according to HTTP/2 events received.
-class CallbackVisitor : public Http2VisitorInterface {
+class QUICHE_EXPORT_PRIVATE CallbackVisitor : public Http2VisitorInterface {
  public:
   explicit CallbackVisitor(Perspective perspective,
                            const nghttp2_session_callbacks& callbacks,
@@ -76,7 +77,7 @@
   void OnErrorDebug(absl::string_view message) override;
 
  private:
-  struct StreamInfo {
+  QUICHE_EXPORT_PRIVATE struct StreamInfo {
     bool before_sent_headers = false;
     bool sent_headers = false;
     bool received_headers = false;
diff --git a/http2/adapter/data_source.h b/http2/adapter/data_source.h
index d8d507b..b7f1afa 100644
--- a/http2/adapter/data_source.h
+++ b/http2/adapter/data_source.h
@@ -5,12 +5,13 @@
 #include <utility>
 
 #include "absl/strings/string_view.h"
+#include "common/platform/api/quiche_export.h"
 
 namespace http2 {
 namespace adapter {
 
 // Represents a source of DATA frames for transmission to the peer.
-class DataFrameSource {
+class QUICHE_EXPORT_PRIVATE DataFrameSource {
  public:
   virtual ~DataFrameSource() {}
 
diff --git a/http2/adapter/http2_adapter.h b/http2/adapter/http2_adapter.h
index 32a9ba1..75eb138 100644
--- a/http2/adapter/http2_adapter.h
+++ b/http2/adapter/http2_adapter.h
@@ -8,6 +8,7 @@
 #include "http2/adapter/http2_protocol.h"
 #include "http2/adapter/http2_session.h"
 #include "http2/adapter/http2_visitor_interface.h"
+#include "common/platform/api/quiche_export.h"
 
 namespace http2 {
 namespace adapter {
@@ -18,7 +19,7 @@
 // invokes corresponding callbacks on its passed-in Http2VisitorInterface.
 // Http2Adapter is a base class shared between client-side and server-side
 // implementations.
-class Http2Adapter {
+class QUICHE_EXPORT_PRIVATE Http2Adapter {
  public:
   Http2Adapter(const Http2Adapter&) = delete;
   Http2Adapter& operator=(const Http2Adapter&) = delete;
diff --git a/http2/adapter/http2_protocol.h b/http2/adapter/http2_protocol.h
index f2fc788..71a6db6 100644
--- a/http2/adapter/http2_protocol.h
+++ b/http2/adapter/http2_protocol.h
@@ -9,6 +9,7 @@
 #include "absl/base/attributes.h"
 #include "absl/strings/string_view.h"
 #include "absl/types/variant.h"
+#include "common/platform/api/quiche_export.h"
 
 namespace http2 {
 namespace adapter {
@@ -34,7 +35,7 @@
 using Header = std::pair<HeaderRep, HeaderRep>;
 
 // Represents an HTTP/2 SETTINGS key-value parameter.
-struct Http2Setting {
+QUICHE_EXPORT_PRIVATE struct Http2Setting {
   Http2SettingsId id;
   uint32_t value;
 };
@@ -56,11 +57,16 @@
 
 // The pseudo-header fields as specified in RFC 7540 Section 8.1.2.3 (request)
 // and Section 8.1.2.4 (response).
-ABSL_CONST_INIT extern const char kHttp2MethodPseudoHeader[];
-ABSL_CONST_INIT extern const char kHttp2SchemePseudoHeader[];
-ABSL_CONST_INIT extern const char kHttp2AuthorityPseudoHeader[];
-ABSL_CONST_INIT extern const char kHttp2PathPseudoHeader[];
-ABSL_CONST_INIT extern const char kHttp2StatusPseudoHeader[];
+ABSL_CONST_INIT QUICHE_EXPORT_PRIVATE extern const char
+    kHttp2MethodPseudoHeader[];
+ABSL_CONST_INIT QUICHE_EXPORT_PRIVATE extern const char
+    kHttp2SchemePseudoHeader[];
+ABSL_CONST_INIT QUICHE_EXPORT_PRIVATE extern const char
+    kHttp2AuthorityPseudoHeader[];
+ABSL_CONST_INIT QUICHE_EXPORT_PRIVATE extern const char
+    kHttp2PathPseudoHeader[];
+ABSL_CONST_INIT QUICHE_EXPORT_PRIVATE extern const char
+    kHttp2StatusPseudoHeader[];
 
 enum class FrameType : uint8_t {
   DATA = 0x0,
diff --git a/http2/adapter/http2_session.h b/http2/adapter/http2_session.h
index 0a6321c..49e671d 100644
--- a/http2/adapter/http2_session.h
+++ b/http2/adapter/http2_session.h
@@ -5,14 +5,15 @@
 
 #include "absl/strings/string_view.h"
 #include "http2/adapter/http2_protocol.h"
+#include "common/platform/api/quiche_export.h"
 
 namespace http2 {
 namespace adapter {
 
-struct Http2SessionCallbacks {};
+QUICHE_EXPORT_PRIVATE struct Http2SessionCallbacks {};
 
 // A class to represent the state of a single HTTP/2 connection.
-class Http2Session {
+class QUICHE_EXPORT_PRIVATE Http2Session {
  public:
   Http2Session() = default;
   virtual ~Http2Session() {}
diff --git a/http2/adapter/http2_util.h b/http2/adapter/http2_util.h
index 3ace28b..88e9a49 100644
--- a/http2/adapter/http2_util.h
+++ b/http2/adapter/http2_util.h
@@ -2,13 +2,16 @@
 #define QUICHE_HTTP2_ADAPTER_HTTP2_UTIL_H_
 
 #include "http2/adapter/http2_protocol.h"
+#include "common/platform/api/quiche_export.h"
 #include "spdy/core/spdy_protocol.h"
 
 namespace http2 {
 namespace adapter {
 
-spdy::SpdyErrorCode TranslateErrorCode(Http2ErrorCode code);
-Http2ErrorCode TranslateErrorCode(spdy::SpdyErrorCode code);
+QUICHE_EXPORT_PRIVATE spdy::SpdyErrorCode TranslateErrorCode(
+    Http2ErrorCode code);
+QUICHE_EXPORT_PRIVATE Http2ErrorCode
+TranslateErrorCode(spdy::SpdyErrorCode code);
 
 }  // namespace adapter
 }  // namespace http2
diff --git a/http2/adapter/http2_visitor_interface.h b/http2/adapter/http2_visitor_interface.h
index e3f7c53..2a74ff5 100644
--- a/http2/adapter/http2_visitor_interface.h
+++ b/http2/adapter/http2_visitor_interface.h
@@ -5,6 +5,7 @@
 
 #include "absl/strings/string_view.h"
 #include "http2/adapter/http2_protocol.h"
+#include "common/platform/api/quiche_export.h"
 
 namespace http2 {
 namespace adapter {
@@ -44,7 +45,7 @@
 //     - OnCloseStream()
 //
 // More details are at RFC 7540 (go/http2spec).
-class Http2VisitorInterface {
+class QUICHE_EXPORT_PRIVATE Http2VisitorInterface {
  public:
   Http2VisitorInterface(const Http2VisitorInterface&) = delete;
   Http2VisitorInterface& operator=(const Http2VisitorInterface&) = delete;
diff --git a/http2/adapter/mock_http2_visitor.h b/http2/adapter/mock_http2_visitor.h
index ca46e90..264c34e 100644
--- a/http2/adapter/mock_http2_visitor.h
+++ b/http2/adapter/mock_http2_visitor.h
@@ -2,6 +2,7 @@
 #define QUICHE_HTTP2_ADAPTER_MOCK_HTTP2_VISITOR_INTERFACE_H_
 
 #include "http2/adapter/http2_visitor_interface.h"
+#include "common/platform/api/quiche_export.h"
 #include "common/platform/api/quiche_test.h"
 
 namespace http2 {
@@ -9,7 +10,7 @@
 namespace test {
 
 // A mock visitor class, for use in tests.
-class MockHttp2Visitor : public Http2VisitorInterface {
+class QUICHE_NO_EXPORT MockHttp2Visitor : public Http2VisitorInterface {
  public:
   MockHttp2Visitor() {
     ON_CALL(*this, OnHeaderForStream).WillByDefault(testing::Return(HEADER_OK));
diff --git a/http2/adapter/mock_nghttp2_callbacks.h b/http2/adapter/mock_nghttp2_callbacks.h
index 1e8dc64..08d15be 100644
--- a/http2/adapter/mock_nghttp2_callbacks.h
+++ b/http2/adapter/mock_nghttp2_callbacks.h
@@ -4,6 +4,7 @@
 #include "absl/strings/string_view.h"
 #include "http2/adapter/nghttp2_util.h"
 #include "third_party/nghttp2/src/lib/includes/nghttp2/nghttp2.h"
+#include "common/platform/api/quiche_export.h"
 #include "common/platform/api/quiche_test.h"
 
 namespace http2 {
@@ -12,7 +13,7 @@
 
 // This class provides a set of mock nghttp2 callbacks for use in unit test
 // expectations.
-class MockNghttp2Callbacks {
+class QUICHE_NO_EXPORT MockNghttp2Callbacks {
  public:
   MockNghttp2Callbacks() = default;
 
diff --git a/http2/adapter/nghttp2_adapter.h b/http2/adapter/nghttp2_adapter.h
index b9900dd..2f2cbad 100644
--- a/http2/adapter/nghttp2_adapter.h
+++ b/http2/adapter/nghttp2_adapter.h
@@ -6,11 +6,12 @@
 #include "http2/adapter/http2_protocol.h"
 #include "http2/adapter/nghttp2_session.h"
 #include "http2/adapter/nghttp2_util.h"
+#include "common/platform/api/quiche_export.h"
 
 namespace http2 {
 namespace adapter {
 
-class NgHttp2Adapter : public Http2Adapter {
+class QUICHE_EXPORT_PRIVATE NgHttp2Adapter : public Http2Adapter {
  public:
   ~NgHttp2Adapter() override;
 
diff --git a/http2/adapter/nghttp2_session.h b/http2/adapter/nghttp2_session.h
index 5dd08f8..4339875 100644
--- a/http2/adapter/nghttp2_session.h
+++ b/http2/adapter/nghttp2_session.h
@@ -4,12 +4,13 @@
 #include "http2/adapter/http2_session.h"
 #include "http2/adapter/nghttp2_util.h"
 #include "third_party/nghttp2/src/lib/includes/nghttp2/nghttp2.h"
+#include "common/platform/api/quiche_export.h"
 
 namespace http2 {
 namespace adapter {
 
 // A C++ wrapper around common nghttp2_session operations.
-class NgHttp2Session : public Http2Session {
+class QUICHE_EXPORT_PRIVATE NgHttp2Session : public Http2Session {
  public:
   // Does not take ownership of |options|.
   NgHttp2Session(Perspective perspective,
diff --git a/http2/adapter/nghttp2_test_utils.h b/http2/adapter/nghttp2_test_utils.h
index dae3493..3ae63d3 100644
--- a/http2/adapter/nghttp2_test_utils.h
+++ b/http2/adapter/nghttp2_test_utils.h
@@ -6,6 +6,7 @@
 #include "absl/strings/string_view.h"
 #include "http2/adapter/http2_protocol.h"
 #include "third_party/nghttp2/src/lib/includes/nghttp2/nghttp2.h"
+#include "common/platform/api/quiche_export.h"
 #include "common/platform/api/quiche_test.h"
 
 namespace http2 {
@@ -13,7 +14,7 @@
 namespace test {
 
 // A simple class that can easily be adapted to act as a nghttp2_data_source.
-class TestDataSource {
+class QUICHE_NO_EXPORT TestDataSource {
  public:
   explicit TestDataSource(absl::string_view data) : data_(std::string(data)) {}
 
diff --git a/http2/adapter/oghttp2_adapter.h b/http2/adapter/oghttp2_adapter.h
index e2ea402..ace8ea9 100644
--- a/http2/adapter/oghttp2_adapter.h
+++ b/http2/adapter/oghttp2_adapter.h
@@ -6,11 +6,12 @@
 #include "http2/adapter/http2_adapter.h"
 #include "http2/adapter/http2_session.h"
 #include "http2/adapter/oghttp2_session.h"
+#include "common/platform/api/quiche_export.h"
 
 namespace http2 {
 namespace adapter {
 
-class OgHttp2Adapter : public Http2Adapter {
+class QUICHE_EXPORT_PRIVATE OgHttp2Adapter : public Http2Adapter {
  public:
   using Options = OgHttp2Session::Options;
   static std::unique_ptr<OgHttp2Adapter> Create(Http2VisitorInterface& visitor,
diff --git a/http2/adapter/oghttp2_session.h b/http2/adapter/oghttp2_session.h
index bd1a40a..70b0619 100644
--- a/http2/adapter/oghttp2_session.h
+++ b/http2/adapter/oghttp2_session.h
@@ -10,6 +10,7 @@
 #include "http2/adapter/window_manager.h"
 #include "http2/core/priority_write_scheduler.h"
 #include "common/platform/api/quiche_bug_tracker.h"
+#include "common/platform/api/quiche_export.h"
 #include "spdy/core/http2_frame_decoder_adapter.h"
 #include "spdy/core/spdy_framer.h"
 
@@ -17,10 +18,11 @@
 namespace adapter {
 
 // This class manages state associated with a single multiplexed HTTP/2 session.
-class OgHttp2Session : public Http2Session,
-                       public spdy::SpdyFramerVisitorInterface {
+class QUICHE_EXPORT_PRIVATE OgHttp2Session
+    : public Http2Session,
+      public spdy::SpdyFramerVisitorInterface {
  public:
-  struct Options {
+  QUICHE_EXPORT_PRIVATE struct Options {
     Perspective perspective = Perspective::kClient;
   };
 
@@ -150,7 +152,7 @@
                       Http2VisitorInterface::OnHeaderResult result);
 
  private:
-  struct StreamState {
+  QUICHE_EXPORT_PRIVATE struct StreamState {
     StreamState(int32_t stream_receive_window,
                 WindowManager::WindowUpdateListener listener)
         : window_manager(stream_receive_window, std::move(listener)) {}
@@ -164,7 +166,8 @@
     bool half_closed_remote = false;
   };
 
-  class PassthroughHeadersHandler : public spdy::SpdyHeadersHandlerInterface {
+  class QUICHE_EXPORT_PRIVATE PassthroughHeadersHandler
+      : public spdy::SpdyHeadersHandlerInterface {
    public:
     explicit PassthroughHeadersHandler(OgHttp2Session& session,
                                        Http2VisitorInterface& visitor)
diff --git a/http2/adapter/oghttp2_util.h b/http2/adapter/oghttp2_util.h
index e222c96..3134ff7 100644
--- a/http2/adapter/oghttp2_util.h
+++ b/http2/adapter/oghttp2_util.h
@@ -3,12 +3,14 @@
 
 #include "absl/types/span.h"
 #include "http2/adapter/http2_protocol.h"
+#include "common/platform/api/quiche_export.h"
 #include "spdy/core/spdy_header_block.h"
 
 namespace http2 {
 namespace adapter {
 
-spdy::SpdyHeaderBlock ToHeaderBlock(absl::Span<const Header> headers);
+QUICHE_EXPORT_PRIVATE spdy::SpdyHeaderBlock ToHeaderBlock(
+    absl::Span<const Header> headers);
 
 }  // namespace adapter
 }  // namespace http2
diff --git a/http2/adapter/recording_http2_visitor.h b/http2/adapter/recording_http2_visitor.h
index 62ce651..501a476 100644
--- a/http2/adapter/recording_http2_visitor.h
+++ b/http2/adapter/recording_http2_visitor.h
@@ -5,6 +5,7 @@
 #include <string>
 
 #include "http2/adapter/http2_visitor_interface.h"
+#include "common/platform/api/quiche_export.h"
 #include "common/platform/api/quiche_test.h"
 
 namespace http2 {
@@ -12,7 +13,7 @@
 namespace test {
 
 // A visitor implementation that records the sequence of callbacks it receives.
-class RecordingHttp2Visitor : public Http2VisitorInterface {
+class QUICHE_NO_EXPORT RecordingHttp2Visitor : public Http2VisitorInterface {
  public:
   using Event = std::string;
   using EventSequence = std::list<Event>;
diff --git a/http2/adapter/test_frame_sequence.h b/http2/adapter/test_frame_sequence.h
index 7a65f67..4496614 100644
--- a/http2/adapter/test_frame_sequence.h
+++ b/http2/adapter/test_frame_sequence.h
@@ -6,16 +6,17 @@
 #include <vector>
 
 #include "http2/adapter/http2_protocol.h"
+#include "common/platform/api/quiche_export.h"
 #include "spdy/core/spdy_protocol.h"
 
 namespace http2 {
 namespace adapter {
 namespace test {
 
-std::vector<const Header> ToHeaders(
+std::vector<const Header> QUICHE_NO_EXPORT ToHeaders(
     absl::Span<const std::pair<absl::string_view, absl::string_view>> headers);
 
-class TestFrameSequence {
+class QUICHE_NO_EXPORT TestFrameSequence {
  public:
   TestFrameSequence() = default;
 
diff --git a/http2/adapter/test_utils.h b/http2/adapter/test_utils.h
index cea7d61..9cac22e 100644
--- a/http2/adapter/test_utils.h
+++ b/http2/adapter/test_utils.h
@@ -8,6 +8,7 @@
 #include "http2/adapter/data_source.h"
 #include "http2/adapter/http2_protocol.h"
 #include "http2/adapter/mock_http2_visitor.h"
+#include "common/platform/api/quiche_export.h"
 #include "common/platform/api/quiche_test.h"
 #include "spdy/core/spdy_protocol.h"
 
@@ -15,7 +16,8 @@
 namespace adapter {
 namespace test {
 
-class DataSavingVisitor : public testing::StrictMock<MockHttp2Visitor> {
+class QUICHE_NO_EXPORT DataSavingVisitor
+    : public testing::StrictMock<MockHttp2Visitor> {
  public:
   ssize_t OnReadyToSend(absl::string_view data) override {
     if (is_write_blocked_) {
@@ -42,7 +44,7 @@
 
 // A test DataFrameSource that can be initialized with a single string payload,
 // or a chunked payload.
-class TestDataFrameSource : public DataFrameSource {
+class QUICHE_NO_EXPORT TestDataFrameSource : public DataFrameSource {
  public:
   TestDataFrameSource(Http2VisitorInterface& visitor,
                       absl::string_view data_payload,
diff --git a/http2/adapter/window_manager.h b/http2/adapter/window_manager.h
index 277c24f..f15982d 100644
--- a/http2/adapter/window_manager.h
+++ b/http2/adapter/window_manager.h
@@ -3,6 +3,8 @@
 
 #include <functional>
 
+#include "common/platform/api/quiche_export.h"
+
 namespace http2 {
 namespace adapter {
 
@@ -12,7 +14,7 @@
 
 // This class keeps track of a HTTP/2 flow control window, notifying a listener
 // when a window update needs to be sent. This class is not thread-safe.
-class WindowManager {
+class QUICHE_EXPORT_PRIVATE WindowManager {
  public:
   // A WindowUpdateListener is invoked when it is time to send a window update.
   typedef std::function<void(size_t)> WindowUpdateListener;
diff --git a/spdy/core/spdy_protocol.h b/spdy/core/spdy_protocol.h
index d7d0e8b..651a889 100644
--- a/spdy/core/spdy_protocol.h
+++ b/spdy/core/spdy_protocol.h
@@ -260,7 +260,7 @@
     SpdyFrameType frame_type_field);
 
 // Serialize |frame_type| to string for logging/debugging.
-const char* FrameTypeToString(SpdyFrameType frame_type);
+QUICHE_EXPORT_PRIVATE const char* FrameTypeToString(SpdyFrameType frame_type);
 
 // If |wire_setting_id| is the on-the-wire representation of a defined SETTINGS
 // parameter, parse it to |*setting_id| and return true.
@@ -328,7 +328,7 @@
 // Initial window size for a session in bytes.
 const int32_t kInitialSessionWindowSize = 64 * 1024 - 1;
 // The NPN string for HTTP2, "h2".
-extern const char* const kHttp2Npn;
+QUICHE_EXPORT_PRIVATE extern const char* const kHttp2Npn;
 // An estimate size of the HPACK overhead for each header field. 1 bytes for
 // indexed literal, 1 bytes for key literal and length encoding, and 2 bytes for
 // value literal and length encoding.
@@ -351,7 +351,7 @@
 // exclusive bit}. Templated to allow for use by QUIC code; SPDY and HTTP/2
 // code should use the concrete type instantiation SpdyStreamPrecedence.
 template <typename StreamIdType>
-class StreamPrecedence {
+QUICHE_EXPORT_PRIVATE class StreamPrecedence {
  public:
   // Constructs instance that is a SPDY 3.x priority. Clamps priority value to
   // the valid range [0, 7].
@@ -427,7 +427,7 @@
   }
 
  private:
-  struct Http2StreamDependency {
+  QUICHE_EXPORT_PRIVATE struct Http2StreamDependency {
     StreamIdType parent_id;
     int weight;
     bool is_exclusive;
@@ -920,7 +920,7 @@
   std::string priority_field_value_;
 };
 
-struct AcceptChOriginValuePair {
+QUICHE_EXPORT_PRIVATE struct AcceptChOriginValuePair {
   std::string origin;
   std::string value;
   bool operator==(const AcceptChOriginValuePair& rhs) const {