1 // Copyright (c) 2011 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.
5 #ifndef CHROME_FRAME_STREAM_IMPL_H_
6 #define CHROME_FRAME_STREAM_IMPL_H_
11 #include "base/win/scoped_comptr.h"
13 // A generic base class for IStream implementation. If provided
14 // with a delegate, it delegated calls to it otherwise can be
15 // used a as a base class for an IStream implementation.
16 class StreamImpl
: public IStream
{
20 void Initialize(IStream
* delegate
);
22 STDMETHOD(Write
)(const void * buffer
, ULONG size
, ULONG
* size_written
);
23 STDMETHOD(Read
)(void* pv
, ULONG cb
, ULONG
* read
);
24 STDMETHOD(Seek
)(LARGE_INTEGER move
, DWORD origin
, ULARGE_INTEGER
* new_pos
);
25 STDMETHOD(SetSize
)(ULARGE_INTEGER new_size
);
26 STDMETHOD(CopyTo
)(IStream
* stream
, ULARGE_INTEGER cb
, ULARGE_INTEGER
* read
,
27 ULARGE_INTEGER
* written
);
28 STDMETHOD(Commit
)(DWORD flags
);
30 STDMETHOD(LockRegion
)(ULARGE_INTEGER offset
, ULARGE_INTEGER cb
,
32 STDMETHOD(UnlockRegion
)(ULARGE_INTEGER offset
, ULARGE_INTEGER cb
,
34 STDMETHOD(Stat
)(STATSTG
* statstg
, DWORD flag
);
35 STDMETHOD(Clone
)(IStream
** stream
);
38 base::win::ScopedComPtr
<IStream
> delegate_
;
41 DISALLOW_COPY_AND_ASSIGN(StreamImpl
);
44 #endif // CHROME_FRAME_STREAM_IMPL_H_