stream_handle_impl.cc revision 7d4cd473f85ac64c3747c96c277f9e506a0d2246
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
3// found in the LICENSE file.
4
5#include "content/browser/streams/stream_handle_impl.h"
6
7#include "content/browser/streams/stream.h"
8#include "content/public/browser/browser_thread.h"
9
10namespace content {
11
12StreamHandleImpl::StreamHandleImpl(const base::WeakPtr<Stream>& stream,
13                                   const GURL& original_url,
14                                   const std::string& mime_type)
15    : stream_(stream),
16      url_(stream->url()),
17      original_url_(original_url),
18      mime_type_(mime_type),
19      stream_message_loop_(base::MessageLoopProxy::current().get()) {}
20
21StreamHandleImpl::~StreamHandleImpl() {
22  stream_message_loop_->PostTask(FROM_HERE,
23                                 base::Bind(&Stream::CloseHandle, stream_));
24}
25
26const GURL& StreamHandleImpl::GetURL() {
27  return url_;
28}
29
30const GURL& StreamHandleImpl::GetOriginalURL() {
31  return original_url_;
32}
33
34const std::string& StreamHandleImpl::GetMimeType() {
35  return mime_type_;
36}
37
38}  // namespace content
39