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

Unified Diff: net/http/http_byte_range.h

Issue 78343004: Net: Standardize HttpByteRange printing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/buffered_resource_loader.cc ('k') | net/http/http_byte_range.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_byte_range.h
diff --git a/net/http/http_byte_range.h b/net/http/http_byte_range.h
index 2c06434439d5c1589dfa00dde3607b832127e277..98708721a4fb9a5530682a8ca10a0b94986c57ef 100644
--- a/net/http/http_byte_range.h
+++ b/net/http/http_byte_range.h
@@ -5,6 +5,8 @@
#ifndef NET_HTTP_HTTP_BYTE_RANGE_H_
#define NET_HTTP_HTTP_BYTE_RANGE_H_
+#include <string>
+
#include "base/basictypes.h"
#include "net/base/net_export.h"
@@ -17,10 +19,16 @@ class NET_EXPORT HttpByteRange {
public:
HttpByteRange();
+ // Convenience constructors.
+ static HttpByteRange Bounded(int64 first_byte_position,
+ int64 last_byte_position);
+ static HttpByteRange RightUnbounded(int64 first_byte_position);
+ static HttpByteRange Suffix(int64 suffix_length);
+
// Since this class is POD, we use constructor, assignment operator
// and destructor provided by compiler.
int64 first_byte_position() const { return first_byte_position_; }
- void set_first_byte_position(int64 value) { first_byte_position_ = value; }
+ void set_first_byte_position(int64 value) { first_byte_position_ = value; }
int64 last_byte_position() const { return last_byte_position_; }
void set_last_byte_position(int64 value) { last_byte_position_ = value; }
@@ -38,6 +46,10 @@ class NET_EXPORT HttpByteRange {
// Returns true if this range is valid.
bool IsValid() const;
+ // Gets the header string, e.g. "bytes=0-100", "bytes=100-", "bytes=-100".
+ // Assumes range is valid.
+ std::string GetHeaderValue() const;
+
// A method that when given the size in bytes of a file, adjust the internal
// |first_byte_position_| and |last_byte_position_| values according to the
// range specified by this object. If the range specified is invalid with
« no previous file with comments | « content/renderer/media/buffered_resource_loader.cc ('k') | net/http/http_byte_range.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698