WebKit roll 138552:138617
[chromium-blink-merge.git] / chrome_frame / stream_impl.cc
blob246e7ea70bdea32a7ffcd92e3db7197a472277b9
1 // Copyright (c) 2010 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 #include "chrome_frame/stream_impl.h"
7 #include "base/logging.h"
9 void StreamImpl::Initialize(IStream* delegate) {
10 delegate_ = delegate;
13 STDMETHODIMP StreamImpl::Write(const void * buffer, ULONG size,
14 ULONG* size_written) {
15 HRESULT hr = E_NOTIMPL;
16 if (delegate_)
17 hr = delegate_->Write(buffer, size, size_written);
18 return hr;
21 STDMETHODIMP StreamImpl::Read(void* pv, ULONG cb, ULONG* read) {
22 HRESULT hr = E_NOTIMPL;
23 if (delegate_)
24 hr = delegate_->Read(pv, cb, read);
25 return hr;
28 STDMETHODIMP StreamImpl::Seek(LARGE_INTEGER move, DWORD origin,
29 ULARGE_INTEGER* new_pos) {
30 HRESULT hr = E_NOTIMPL;
31 if (delegate_)
32 hr = delegate_->Seek(move, origin, new_pos);
33 return hr;
36 STDMETHODIMP StreamImpl::SetSize(ULARGE_INTEGER new_size) {
37 HRESULT hr = E_NOTIMPL;
38 if (delegate_)
39 hr = delegate_->SetSize(new_size);
40 return hr;
43 STDMETHODIMP StreamImpl::CopyTo(IStream* stream, ULARGE_INTEGER cb,
44 ULARGE_INTEGER* read,
45 ULARGE_INTEGER* written) {
46 HRESULT hr = E_NOTIMPL;
47 if (delegate_)
48 hr = delegate_->CopyTo(stream, cb, read, written);
49 return hr;
52 STDMETHODIMP StreamImpl::Commit(DWORD flags) {
53 HRESULT hr = E_NOTIMPL;
54 if (delegate_)
55 hr = delegate_->Commit(flags);
56 return hr;
59 STDMETHODIMP StreamImpl::Revert() {
60 HRESULT hr = E_NOTIMPL;
61 if (delegate_)
62 hr = delegate_->Revert();
63 return hr;
66 STDMETHODIMP StreamImpl::LockRegion(ULARGE_INTEGER offset, ULARGE_INTEGER cb,
67 DWORD type) {
68 HRESULT hr = E_NOTIMPL;
69 if (delegate_)
70 hr = delegate_->LockRegion(offset, cb, type);
71 return hr;
74 STDMETHODIMP StreamImpl::UnlockRegion(ULARGE_INTEGER offset, ULARGE_INTEGER cb,
75 DWORD type) {
76 HRESULT hr = E_NOTIMPL;
77 if (delegate_)
78 hr = delegate_->UnlockRegion(offset, cb, type);
79 return hr;
82 STDMETHODIMP StreamImpl::Stat(STATSTG* statstg, DWORD flag) {
83 HRESULT hr = E_NOTIMPL;
84 if (delegate_)
85 hr = delegate_->Stat(statstg, flag);
86 return hr;
89 STDMETHODIMP StreamImpl::Clone(IStream** stream) {
90 HRESULT hr = E_NOTIMPL;
91 if (delegate_)
92 hr = delegate_->Clone(stream);
93 return hr;