summaryrefslogtreecommitdiffstats
path: root/content/browser/streams
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-26 05:01:11 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-26 05:01:11 +0000
commite62b65a1dd07c8fd4e1fa61c67c65aecb75a316c (patch)
tree05c1d9816ee7eeff5d4cc232b5cfa9a9809a812b /content/browser/streams
parenta3d215ec60d3a3f1e9316e240d4b14d2a28426fc (diff)
downloadchromium_src-e62b65a1dd07c8fd4e1fa61c67c65aecb75a316c.zip
chromium_src-e62b65a1dd07c8fd4e1fa61c67c65aecb75a316c.tar.gz
chromium_src-e62b65a1dd07c8fd4e1fa61c67c65aecb75a316c.tar.bz2
Change the streamsPrivate extensions API to return HTTP response headers in a dictionary
This changes from returning the response headers as a raw string to a dictionary mapping header name to header value. If there are multiple headers with the same name, the values are merged in a dictionary and separated by a ", ". BUG=350755 Review URL: https://codereview.chromium.org/198463005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259496 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/streams')
-rw-r--r--content/browser/streams/stream.cc4
-rw-r--r--content/browser/streams/stream.h8
-rw-r--r--content/browser/streams/stream_handle_impl.cc12
-rw-r--r--content/browser/streams/stream_handle_impl.h6
4 files changed, 18 insertions, 12 deletions
diff --git a/content/browser/streams/stream.cc b/content/browser/streams/stream.cc
index ca0cf1b..d10770c 100644
--- a/content/browser/streams/stream.cc
+++ b/content/browser/streams/stream.cc
@@ -7,11 +7,13 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/message_loop/message_loop_proxy.h"
+#include "base/values.h"
#include "content/browser/streams/stream_handle_impl.h"
#include "content/browser/streams/stream_read_observer.h"
#include "content/browser/streams/stream_registry.h"
#include "content/browser/streams/stream_write_observer.h"
#include "net/base/io_buffer.h"
+#include "net/http/http_response_headers.h"
namespace {
// Start throttling the connection at about 1MB.
@@ -161,7 +163,7 @@ Stream::StreamState Stream::ReadRawData(net::IOBuffer* buf,
scoped_ptr<StreamHandle> Stream::CreateHandle(
const GURL& original_url,
const std::string& mime_type,
- const std::string& response_headers) {
+ scoped_refptr<net::HttpResponseHeaders> response_headers) {
CHECK(!stream_handle_);
stream_handle_ = new StreamHandleImpl(weak_ptr_factory_.GetWeakPtr(),
original_url,
diff --git a/content/browser/streams/stream.h b/content/browser/streams/stream.h
index e439b72..e7e9586 100644
--- a/content/browser/streams/stream.h
+++ b/content/browser/streams/stream.h
@@ -13,6 +13,7 @@
#include "url/gurl.h"
namespace net {
+class HttpResponseHeaders;
class IOBuffer;
}
@@ -77,9 +78,10 @@ class CONTENT_EXPORT Stream : public base::RefCountedThreadSafe<Stream> {
// and STREAM_COMPLETE if the stream is finalized and all data has been read.
StreamState ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read);
- scoped_ptr<StreamHandle> CreateHandle(const GURL& original_url,
- const std::string& mime_type,
- const std::string& response_headers);
+ scoped_ptr<StreamHandle> CreateHandle(
+ const GURL& original_url,
+ const std::string& mime_type,
+ scoped_refptr<net::HttpResponseHeaders> response_headers);
void CloseHandle();
// Indicates whether there is space in the buffer to add more data.
diff --git a/content/browser/streams/stream_handle_impl.cc b/content/browser/streams/stream_handle_impl.cc
index cdba12b..d13bdc6 100644
--- a/content/browser/streams/stream_handle_impl.cc
+++ b/content/browser/streams/stream_handle_impl.cc
@@ -8,13 +8,15 @@
#include "base/location.h"
#include "base/message_loop/message_loop_proxy.h"
#include "content/browser/streams/stream.h"
+#include "net/http/http_response_headers.h"
namespace content {
-StreamHandleImpl::StreamHandleImpl(const base::WeakPtr<Stream>& stream,
- const GURL& original_url,
- const std::string& mime_type,
- const std::string& response_headers)
+StreamHandleImpl::StreamHandleImpl(
+ const base::WeakPtr<Stream>& stream,
+ const GURL& original_url,
+ const std::string& mime_type,
+ scoped_refptr<net::HttpResponseHeaders> response_headers)
: stream_(stream),
url_(stream->url()),
original_url_(original_url),
@@ -39,7 +41,7 @@ const std::string& StreamHandleImpl::GetMimeType() {
return mime_type_;
}
-const std::string& StreamHandleImpl::GetResponseHeaders() {
+scoped_refptr<net::HttpResponseHeaders> StreamHandleImpl::GetResponseHeaders() {
return response_headers_;
}
diff --git a/content/browser/streams/stream_handle_impl.h b/content/browser/streams/stream_handle_impl.h
index deb094f..fc8f5355 100644
--- a/content/browser/streams/stream_handle_impl.h
+++ b/content/browser/streams/stream_handle_impl.h
@@ -22,7 +22,7 @@ class StreamHandleImpl : public StreamHandle {
StreamHandleImpl(const base::WeakPtr<Stream>& stream,
const GURL& original_url,
const std::string& mime_type,
- const std::string& response_headers);
+ scoped_refptr<net::HttpResponseHeaders> response_headers);
virtual ~StreamHandleImpl();
private:
@@ -30,13 +30,13 @@ class StreamHandleImpl : public StreamHandle {
virtual const GURL& GetURL() OVERRIDE;
virtual const GURL& GetOriginalURL() OVERRIDE;
virtual const std::string& GetMimeType() OVERRIDE;
- virtual const std::string& GetResponseHeaders() OVERRIDE;
+ virtual scoped_refptr<net::HttpResponseHeaders> GetResponseHeaders() OVERRIDE;
base::WeakPtr<Stream> stream_;
GURL url_;
GURL original_url_;
std::string mime_type_;
- std::string response_headers_;
+ scoped_refptr<net::HttpResponseHeaders> response_headers_;
base::MessageLoopProxy* stream_message_loop_;
};