blob: 36ea386caf0f3bfd181f30f7eda000026cda6928 [file] [log] [blame]
[email protected]3b63f8f42011-03-28 01:54:151// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]4736610c2011-03-04 06:43:352// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_FRAME_URLMON_UPLOAD_DATA_STREAM_H_
6#define CHROME_FRAME_URLMON_UPLOAD_DATA_STREAM_H_
7
8#include <urlmon.h>
9#include <atlbase.h>
10#include <atlcom.h>
11
[email protected]3b63f8f42011-03-28 01:54:1512#include "base/memory/ref_counted.h"
[email protected]4736610c2011-03-04 06:43:3513#include "chrome_frame/stream_impl.h"
14#include "net/base/upload_data.h"
15#include "net/base/upload_data_stream.h"
16
17// Provides an IStream interface to the very different UploadDataStream
18// implementation.
19class UrlmonUploadDataStream : public CComObjectRootEx<CComMultiThreadModel>,
20 public StreamImpl {
21 public:
22 UrlmonUploadDataStream() {}
23
24 BEGIN_COM_MAP(UrlmonUploadDataStream)
25 COM_INTERFACE_ENTRY(ISequentialStream)
26 COM_INTERFACE_ENTRY(IStream)
27 END_COM_MAP()
28
29 void Initialize(net::UploadData* upload_data);
30
31 // Partial implementation of IStream.
32 STDMETHOD(Read)(void* pv, ULONG cb, ULONG* read);
33 STDMETHOD(Seek)(LARGE_INTEGER move, DWORD origin, ULARGE_INTEGER* new_pos);
34 STDMETHOD(Stat)(STATSTG *pstatstg, DWORD grfStatFlag);
35
36 private:
37 scoped_refptr<net::UploadData> upload_data_;
38 scoped_ptr<net::UploadDataStream> request_body_stream_;
39};
40
41#endif // CHROME_FRAME_URLMON_UPLOAD_DATA_STREAM_H_