| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // HttpRequestHeaders manages the request headers. | 5 // HttpRequestHeaders manages the request headers. |
| 6 // It maintains these in a vector of header key/value pairs, thereby maintaining | 6 // It maintains these in a vector of header key/value pairs, thereby maintaining |
| 7 // the order of the headers. This means that any lookups are linear time | 7 // the order of the headers. This means that any lookups are linear time |
| 8 // operations. | 8 // operations. |
| 9 | 9 |
| 10 #ifndef NET_HTTP_HTTP_REQUEST_HEADERS_H_ | 10 #ifndef NET_HTTP_HTTP_REQUEST_HEADERS_H_ |
| 11 #define NET_HTTP_HTTP_REQUEST_HEADERS_H_ | 11 #define NET_HTTP_HTTP_REQUEST_HEADERS_H_ |
| 12 #pragma once | 12 #pragma once |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
| 18 #include "base/string_piece.h" | 18 #include "base/string_piece.h" |
| 19 #include "net/base/net_api.h" | 19 #include "net/base/net_export.h" |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 | 22 |
| 23 class NET_API HttpRequestHeaders { | 23 class NET_EXPORT HttpRequestHeaders { |
| 24 public: | 24 public: |
| 25 struct HeaderKeyValuePair { | 25 struct HeaderKeyValuePair { |
| 26 HeaderKeyValuePair(); | 26 HeaderKeyValuePair(); |
| 27 HeaderKeyValuePair(const base::StringPiece& key, | 27 HeaderKeyValuePair(const base::StringPiece& key, |
| 28 const base::StringPiece& value); | 28 const base::StringPiece& value); |
| 29 | 29 |
| 30 std::string key; | 30 std::string key; |
| 31 std::string value; | 31 std::string value; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 typedef std::vector<HeaderKeyValuePair> HeaderVector; | 34 typedef std::vector<HeaderKeyValuePair> HeaderVector; |
| 35 | 35 |
| 36 class NET_API Iterator { | 36 class NET_EXPORT Iterator { |
| 37 public: | 37 public: |
| 38 explicit Iterator(const HttpRequestHeaders& headers); | 38 explicit Iterator(const HttpRequestHeaders& headers); |
| 39 ~Iterator(); | 39 ~Iterator(); |
| 40 | 40 |
| 41 // Advances the iterator to the next header, if any. Returns true if there | 41 // Advances the iterator to the next header, if any. Returns true if there |
| 42 // is a next header. Use name() and value() methods to access the resultant | 42 // is a next header. Use name() and value() methods to access the resultant |
| 43 // header name and value. | 43 // header name and value. |
| 44 bool GetNext(); | 44 bool GetNext(); |
| 45 | 45 |
| 46 // These two accessors are only valid if GetNext() returned true. | 46 // These two accessors are only valid if GetNext() returned true. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // Allow the copy construction and operator= to facilitate copying in | 154 // Allow the copy construction and operator= to facilitate copying in |
| 155 // HttpRequestInfo. | 155 // HttpRequestInfo. |
| 156 // TODO(willchan): Investigate to see if we can remove the need to copy | 156 // TODO(willchan): Investigate to see if we can remove the need to copy |
| 157 // HttpRequestInfo. | 157 // HttpRequestInfo. |
| 158 // DISALLOW_COPY_AND_ASSIGN(HttpRequestHeaders); | 158 // DISALLOW_COPY_AND_ASSIGN(HttpRequestHeaders); |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 } // namespace net | 161 } // namespace net |
| 162 | 162 |
| 163 #endif // NET_HTTP_HTTP_REQUEST_HEADERS_H_ | 163 #endif // NET_HTTP_HTTP_REQUEST_HEADERS_H_ |
| OLD | NEW |