[email protected] | 8ee65ba | 2011-04-12 20:53:23 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | 97965e1 | 2010-04-09 00:51:10 | [diff] [blame] | 2 | // 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_STREAM_IMPL_H_ |
| 6 | #define CHROME_FRAME_STREAM_IMPL_H_ |
| 7 | |
| 8 | #include <atlbase.h> |
| 9 | #include <atlcom.h> |
| 10 | |
[email protected] | 8ee65ba | 2011-04-12 20:53:23 | [diff] [blame] | 11 | #include "base/win/scoped_comptr.h" |
[email protected] | 97965e1 | 2010-04-09 00:51:10 | [diff] [blame] | 12 | |
| 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 { |
| 17 | public: |
| 18 | StreamImpl() {} |
| 19 | |
| 20 | void Initialize(IStream* delegate); |
| 21 | |
| 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); |
| 29 | STDMETHOD(Revert)(); |
| 30 | STDMETHOD(LockRegion)(ULARGE_INTEGER offset, ULARGE_INTEGER cb, |
| 31 | DWORD type); |
| 32 | STDMETHOD(UnlockRegion)(ULARGE_INTEGER offset, ULARGE_INTEGER cb, |
| 33 | DWORD type); |
| 34 | STDMETHOD(Stat)(STATSTG* statstg, DWORD flag); |
| 35 | STDMETHOD(Clone)(IStream** stream); |
| 36 | |
| 37 | protected: |
[email protected] | 8ee65ba | 2011-04-12 20:53:23 | [diff] [blame] | 38 | base::win::ScopedComPtr<IStream> delegate_; |
[email protected] | 97965e1 | 2010-04-09 00:51:10 | [diff] [blame] | 39 | |
| 40 | private: |
| 41 | DISALLOW_COPY_AND_ASSIGN(StreamImpl); |
| 42 | }; |
| 43 | |
| 44 | #endif // CHROME_FRAME_STREAM_IMPL_H_ |