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

Side by Side Diff: content/browser/streams/stream_handle_impl.cc

Issue 519533002: Initial PlzNavigate RDH-side logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 6 years, 2 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
« no previous file with comments | « content/browser/streams/stream_handle_impl.h ('k') | content/common/frame_messages.h » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "content/browser/streams/stream_handle_impl.h" 5 #include "content/browser/streams/stream_handle_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "content/browser/streams/stream.h" 10 #include "content/browser/streams/stream.h"
11 #include "net/http/http_response_headers.h"
12 11
13 namespace content { 12 namespace content {
14 13
15 namespace { 14 namespace {
16 15
17 void RunCloseListeners(const std::vector<base::Closure>& close_listeners) { 16 void RunCloseListeners(const std::vector<base::Closure>& close_listeners) {
18 for (size_t i = 0; i < close_listeners.size(); ++i) 17 for (size_t i = 0; i < close_listeners.size(); ++i)
19 close_listeners[i].Run(); 18 close_listeners[i].Run();
20 } 19 }
21 20
22 } // namespace 21 } // namespace
23 22
24 StreamHandleImpl::StreamHandleImpl( 23 StreamHandleImpl::StreamHandleImpl(const base::WeakPtr<Stream>& stream)
25 const base::WeakPtr<Stream>& stream,
26 const GURL& original_url,
27 const std::string& mime_type,
28 scoped_refptr<net::HttpResponseHeaders> response_headers)
29 : stream_(stream), 24 : stream_(stream),
30 url_(stream->url()), 25 url_(stream->url()),
31 original_url_(original_url), 26 stream_message_loop_(base::MessageLoopProxy::current().get()) {}
32 mime_type_(mime_type),
33 response_headers_(NULL),
34 stream_message_loop_(base::MessageLoopProxy::current().get()) {
35 // Make a copy of the response headers so it is safe to pass this across
36 // threads.
37 if (response_headers.get()) {
38 response_headers_ =
39 new net::HttpResponseHeaders(response_headers->raw_headers());
40 }
41 }
42 27
43 StreamHandleImpl::~StreamHandleImpl() { 28 StreamHandleImpl::~StreamHandleImpl() {
44 stream_message_loop_->PostTaskAndReply(FROM_HERE, 29 stream_message_loop_->PostTaskAndReply(FROM_HERE,
45 base::Bind(&Stream::CloseHandle, stream_), 30 base::Bind(&Stream::CloseHandle, stream_),
46 base::Bind(&RunCloseListeners, close_listeners_)); 31 base::Bind(&RunCloseListeners, close_listeners_));
47 } 32 }
48 33
49 const GURL& StreamHandleImpl::GetURL() { 34 const GURL& StreamHandleImpl::GetURL() {
50 return url_; 35 return url_;
51 } 36 }
52 37
53 const GURL& StreamHandleImpl::GetOriginalURL() {
54 return original_url_;
55 }
56
57 const std::string& StreamHandleImpl::GetMimeType() {
58 return mime_type_;
59 }
60
61 scoped_refptr<net::HttpResponseHeaders> StreamHandleImpl::GetResponseHeaders() {
62 return response_headers_;
63 }
64
65 void StreamHandleImpl::AddCloseListener(const base::Closure& callback) { 38 void StreamHandleImpl::AddCloseListener(const base::Closure& callback) {
66 close_listeners_.push_back(callback); 39 close_listeners_.push_back(callback);
67 } 40 }
68 41
69 } // namespace content 42 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/streams/stream_handle_impl.h ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698