summaryrefslogtreecommitdiffstats
path: root/content/browser/streams/stream_handle_impl.h
blob: dc64dade6daa0bfb98e5b65d090181b3440cab72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_BROWSER_STREAMS_STREAM_HANDLE_IMPL_H_
#define CONTENT_BROWSER_STREAMS_STREAM_HANDLE_IMPL_H_

#include <vector>

#include "base/memory/weak_ptr.h"
#include "base/synchronization/lock.h"
#include "content/public/browser/stream_handle.h"

namespace base {
class MessageLoopProxy;
}

namespace content {

class Stream;

class StreamHandleImpl : public StreamHandle {
 public:
  StreamHandleImpl(const base::WeakPtr<Stream>& stream,
                   const GURL& original_url,
                   const std::string& mime_type,
                   scoped_refptr<net::HttpResponseHeaders> response_headers);
  virtual ~StreamHandleImpl();

 private:
  // StreamHandle overrides
  virtual const GURL& GetURL() OVERRIDE;
  virtual const GURL& GetOriginalURL() OVERRIDE;
  virtual const std::string& GetMimeType() OVERRIDE;
  virtual scoped_refptr<net::HttpResponseHeaders> GetResponseHeaders() OVERRIDE;
  virtual void AddCloseListener(const base::Closure& callback) OVERRIDE;

  base::WeakPtr<Stream> stream_;
  GURL url_;
  GURL original_url_;
  std::string mime_type_;
  scoped_refptr<net::HttpResponseHeaders> response_headers_;
  base::MessageLoopProxy* stream_message_loop_;
  std::vector<base::Closure> close_listeners_;
};

}  // namespace content

#endif  // CONTENT_BROWSER_STREAMS_STREAM_HANDLE_IMPL_H_