diff options
author | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-07 12:05:01 +0000 |
---|---|---|
committer | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-07 12:05:01 +0000 |
commit | be5cf44aa346b0f8cd5b0907d54c90250128191b (patch) | |
tree | 5f4fe93e8310050eb8073c4a2bcee869839f2d27 /content/browser/streams | |
parent | 231057f494e72c7767ce3ece77c9fe83e83490a8 (diff) | |
download | chromium_src-be5cf44aa346b0f8cd5b0907d54c90250128191b.zip chromium_src-be5cf44aa346b0f8cd5b0907d54c90250128191b.tar.gz chromium_src-be5cf44aa346b0f8cd5b0907d54c90250128191b.tar.bz2 |
Pass http response headers to the streamsPrivate API callback
This passes the response headers through to the API callback allowing the
application to access the headers without having to make an additional
http request.
BUG=303491
Review URL: https://codereview.chromium.org/185663002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255593 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/streams')
-rw-r--r-- | content/browser/streams/stream.cc | 9 | ||||
-rw-r--r-- | content/browser/streams/stream.h | 3 | ||||
-rw-r--r-- | content/browser/streams/stream_handle_impl.cc | 8 | ||||
-rw-r--r-- | content/browser/streams/stream_handle_impl.h | 5 |
4 files changed, 19 insertions, 6 deletions
diff --git a/content/browser/streams/stream.cc b/content/browser/streams/stream.cc index 5d20fe6..ca0cf1b 100644 --- a/content/browser/streams/stream.cc +++ b/content/browser/streams/stream.cc @@ -158,12 +158,15 @@ Stream::StreamState Stream::ReadRawData(net::IOBuffer* buf, return STREAM_HAS_DATA; } -scoped_ptr<StreamHandle> Stream::CreateHandle(const GURL& original_url, - const std::string& mime_type) { +scoped_ptr<StreamHandle> Stream::CreateHandle( + const GURL& original_url, + const std::string& mime_type, + const std::string& response_headers) { CHECK(!stream_handle_); stream_handle_ = new StreamHandleImpl(weak_ptr_factory_.GetWeakPtr(), original_url, - mime_type); + mime_type, + response_headers); return scoped_ptr<StreamHandle>(stream_handle_).Pass(); } diff --git a/content/browser/streams/stream.h b/content/browser/streams/stream.h index 3937f5b..e439b72 100644 --- a/content/browser/streams/stream.h +++ b/content/browser/streams/stream.h @@ -78,7 +78,8 @@ class CONTENT_EXPORT Stream : public base::RefCountedThreadSafe<Stream> { 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& mime_type, + const std::string& 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 e7ab8ea..cdba12b 100644 --- a/content/browser/streams/stream_handle_impl.cc +++ b/content/browser/streams/stream_handle_impl.cc @@ -13,11 +13,13 @@ namespace content { StreamHandleImpl::StreamHandleImpl(const base::WeakPtr<Stream>& stream, const GURL& original_url, - const std::string& mime_type) + const std::string& mime_type, + const std::string& response_headers) : stream_(stream), url_(stream->url()), original_url_(original_url), mime_type_(mime_type), + response_headers_(response_headers), stream_message_loop_(base::MessageLoopProxy::current().get()) {} StreamHandleImpl::~StreamHandleImpl() { @@ -37,4 +39,8 @@ const std::string& StreamHandleImpl::GetMimeType() { return mime_type_; } +const std::string& StreamHandleImpl::GetResponseHeaders() { + return response_headers_; +} + } // namespace content diff --git a/content/browser/streams/stream_handle_impl.h b/content/browser/streams/stream_handle_impl.h index 1d3614d..deb094f 100644 --- a/content/browser/streams/stream_handle_impl.h +++ b/content/browser/streams/stream_handle_impl.h @@ -21,7 +21,8 @@ class StreamHandleImpl : public StreamHandle { public: StreamHandleImpl(const base::WeakPtr<Stream>& stream, const GURL& original_url, - const std::string& mime_type); + const std::string& mime_type, + const std::string& response_headers); virtual ~StreamHandleImpl(); private: @@ -29,11 +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; base::WeakPtr<Stream> stream_; GURL url_; GURL original_url_; std::string mime_type_; + std::string response_headers_; base::MessageLoopProxy* stream_message_loop_; }; |