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. 4 5#include "chrome_frame/stream_impl.h" 6 7#include "base/logging.h" 8 9void StreamImpl::Initialize(IStream* delegate) { 10 delegate_ = delegate; 11} 12 13STDMETHODIMP 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; 19} 20 21STDMETHODIMP 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; 26} 27 28STDMETHODIMP 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; 34} 35 36STDMETHODIMP StreamImpl::SetSize(ULARGE_INTEGER new_size) { 37 HRESULT hr = E_NOTIMPL; 38 if (delegate_) 39 hr = delegate_->SetSize(new_size); 40 return hr; 41} 42 43STDMETHODIMP 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; 50} 51 52STDMETHODIMP StreamImpl::Commit(DWORD flags) { 53 HRESULT hr = E_NOTIMPL; 54 if (delegate_) 55 hr = delegate_->Commit(flags); 56 return hr; 57} 58 59STDMETHODIMP StreamImpl::Revert() { 60 HRESULT hr = E_NOTIMPL; 61 if (delegate_) 62 hr = delegate_->Revert(); 63 return hr; 64} 65 66STDMETHODIMP 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; 72} 73 74STDMETHODIMP 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; 80} 81 82STDMETHODIMP StreamImpl::Stat(STATSTG* statstg, DWORD flag) { 83 HRESULT hr = E_NOTIMPL; 84 if (delegate_) 85 hr = delegate_->Stat(statstg, flag); 86 return hr; 87} 88 89STDMETHODIMP StreamImpl::Clone(IStream** stream) { 90 HRESULT hr = E_NOTIMPL; 91 if (delegate_) 92 hr = delegate_->Clone(stream); 93 return hr; 94} 95 96