WebKit roll 138552:138617
[chromium-blink-merge.git] / chrome_frame / stream_impl.h
blob454bbb1b1fa66ddf74daa5fe04d668c94281c247
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_
8 #include <atlbase.h>
9 #include <atlcom.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 {
17 public:
18 StreamImpl() {}
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);
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);
37 protected:
38 base::win::ScopedComPtr<IStream> delegate_;
40 private:
41 DISALLOW_COPY_AND_ASSIGN(StreamImpl);
44 #endif // CHROME_FRAME_STREAM_IMPL_H_