Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: net/http/http_response_headers.h

Issue 10399083: Make NetLog take in callbacks that return Values (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix merge error Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_request_headers_unittest.cc ('k') | net/http/http_response_headers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef NET_HTTP_HTTP_RESPONSE_HEADERS_H_ 5 #ifndef NET_HTTP_HTTP_RESPONSE_HEADERS_H_
6 #define NET_HTTP_HTTP_RESPONSE_HEADERS_H_ 6 #define NET_HTTP_HTTP_RESPONSE_HEADERS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/hash_tables.h" 13 #include "base/hash_tables.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "net/base/net_export.h" 15 #include "net/base/net_export.h"
16 #include "net/base/net_log.h"
16 #include "net/http/http_version.h" 17 #include "net/http/http_version.h"
17 18
18 class Pickle; 19 class Pickle;
19 class PickleIterator; 20 class PickleIterator;
20 21
21 namespace base { 22 namespace base {
22 class Time; 23 class Time;
23 class TimeDelta; 24 class TimeDelta;
24 } 25 }
25 26
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // |*last_byte_position| = inclusive position of the last byte of the range 238 // |*last_byte_position| = inclusive position of the last byte of the range
238 // |*instance_length| = size in bytes of the object requested 239 // |*instance_length| = size in bytes of the object requested
239 // If any of the above values is unknown, its value will be -1. 240 // If any of the above values is unknown, its value will be -1.
240 bool GetContentRange(int64* first_byte_position, 241 bool GetContentRange(int64* first_byte_position,
241 int64* last_byte_position, 242 int64* last_byte_position,
242 int64* instance_length) const; 243 int64* instance_length) const;
243 244
244 // Returns true if the response is chunk-encoded. 245 // Returns true if the response is chunk-encoded.
245 bool IsChunkEncoded() const; 246 bool IsChunkEncoded() const;
246 247
248 // Creates a Value for use with the NetLog containing the response headers.
249 base::Value* NetLogCallback(NetLog::LogLevel log_level) const;
250
251 // Takes in a Value created by the above function, and attempts to create a
252 // copy of the original headers. Returns true on success. On failure,
253 // clears |http_response_headers|.
254 // TODO(mmenke): Long term, we want to remove this, and migrate external
255 // consumers to be NetworkDelegates.
256 static bool FromNetLogParam(
257 const base::Value* event_param,
258 scoped_refptr<HttpResponseHeaders>* http_response_headers);
259
247 // Returns the HTTP response code. This is 0 if the response code text seems 260 // Returns the HTTP response code. This is 0 if the response code text seems
248 // to exist but could not be parsed. Otherwise, it defaults to 200 if the 261 // to exist but could not be parsed. Otherwise, it defaults to 200 if the
249 // response code is not found in the raw headers. 262 // response code is not found in the raw headers.
250 int response_code() const { return response_code_; } 263 int response_code() const { return response_code_; }
251 264
252 // Returns the raw header string. 265 // Returns the raw header string.
253 const std::string& raw_headers() const { return raw_headers_; } 266 const std::string& raw_headers() const { return raw_headers_; }
254 267
255 private: 268 private:
256 friend class base::RefCountedThreadSafe<HttpResponseHeaders>; 269 friend class base::RefCountedThreadSafe<HttpResponseHeaders>;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 373
361 // The parsed http version number (not normalized). 374 // The parsed http version number (not normalized).
362 HttpVersion parsed_http_version_; 375 HttpVersion parsed_http_version_;
363 376
364 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders); 377 DISALLOW_COPY_AND_ASSIGN(HttpResponseHeaders);
365 }; 378 };
366 379
367 } // namespace net 380 } // namespace net
368 381
369 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_ 382 #endif // NET_HTTP_HTTP_RESPONSE_HEADERS_H_
OLDNEW
« no previous file with comments | « net/http/http_request_headers_unittest.cc ('k') | net/http/http_response_headers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698