Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: chrome_frame/urlmon_moniker_base.h

Issue 1589013: Switch renderer in Moniker patch... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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 #ifndef CHROME_FRAME_URLMON_MONIKER_BASE_H_
6 #define CHROME_FRAME_URLMON_MONIKER_BASE_H_
7
8 #include <atlbase.h>
9 #include <atlcom.h>
10
11 // An implementation of IStream (minus IUnknown) that delegates to
12 // another source. Most of the methods contain a NOTREACHED() as the
13 // class is used by the ReadStreamCache class where we don't expect those
14 // calls under normal circumstances.
15 class DelegatingReadStream : public IStream {
16 public:
17 DelegatingReadStream() {
18 }
19
20 ~DelegatingReadStream() {
21 }
22
23 void SetDelegate(IStream* delegate) {
24 delegate_ = delegate;
25 }
26
27 // ISequentialStream.
28 STDMETHOD(Read)(void* pv, ULONG cb, ULONG* read) {
29 return delegate_->Read(pv, cb, read);
30 }
31
32 STDMETHOD(Write)(const void* pv, ULONG cb, ULONG* written) {
33 NOTREACHED();
34 return delegate_->Write(pv, cb, written);
35 }
36
37 // IStream.
38 STDMETHOD(Seek)(LARGE_INTEGER move, DWORD origin, ULARGE_INTEGER* new_pos) {
39 NOTREACHED();
40 return delegate_->Seek(move, origin, new_pos);
41 }
42
43 STDMETHOD(SetSize)(ULARGE_INTEGER new_size) {
44 NOTREACHED();
45 return delegate_->SetSize(new_size);
46 }
47
48 STDMETHOD(CopyTo)(IStream* stream, ULARGE_INTEGER cb, ULARGE_INTEGER* read,
49 ULARGE_INTEGER* written) {
50 NOTREACHED();
51 return delegate_->CopyTo(stream, cb, read, written);
52 }
53
54 STDMETHOD(Commit)(DWORD commit_flags) {
55 NOTREACHED();
56 return delegate_->Commit(commit_flags);
57 }
58
59 STDMETHOD(Revert)() {
60 NOTREACHED();
61 return delegate_->Revert();
62 }
63
64 STDMETHOD(LockRegion)(ULARGE_INTEGER offset, ULARGE_INTEGER cb,
65 DWORD lock_type) {
66 NOTREACHED();
67 return delegate_->LockRegion(offset, cb, lock_type);
68 }
69
70 STDMETHOD(UnlockRegion)(ULARGE_INTEGER offset, ULARGE_INTEGER cb,
71 DWORD lock_type) {
72 NOTREACHED();
73 return delegate_->UnlockRegion(offset, cb, lock_type);
74 }
75
76 STDMETHOD(Stat)(STATSTG* stat_stg, DWORD stat_flag) {
77 DCHECK(delegate_);
78 return delegate_->Stat(stat_stg, stat_flag);
79 }
80
81 STDMETHOD(Clone)(IStream** stream) {
82 NOTREACHED();
83 return delegate_->Clone(stream);
84 }
85
86 protected:
87 ScopedComPtr<IStream> delegate_;
88 };
89
90 // A very basic implementation of IBinding that forwards all calls
91 // to a delegate.
92 class DelegatingBinding : public IBinding {
93 public:
94 DelegatingBinding() {
95 }
96
97 ~DelegatingBinding() {
98 }
99
100 IBinding* delegate() const {
101 return delegate_;
102 }
103
104 void SetDelegate(IBinding* delegate) {
105 delegate_ = delegate;
106 }
107
108 STDMETHOD(Abort)() {
109 DCHECK(delegate_);
110 if (!delegate_)
111 return S_OK;
112 return delegate_->Abort();
113 }
114
115 STDMETHOD(Suspend)() {
116 DCHECK(delegate_);
117 if (!delegate_)
118 return E_FAIL;
119 return delegate_->Suspend();
120 }
121
122 STDMETHOD(Resume)() {
123 DCHECK(delegate_);
124 if (!delegate_)
125 return E_FAIL;
126 return delegate_->Resume();
127 }
128
129 STDMETHOD(SetPriority)(LONG priority) {
130 DCHECK(delegate_);
131 if (!delegate_)
132 return E_FAIL;
133 return delegate_->SetPriority(priority);
134 }
135
136 STDMETHOD(GetPriority)(LONG* priority) {
137 DCHECK(delegate_);
138 if (!delegate_)
139 return E_FAIL;
140 return delegate_->GetPriority(priority);
141 }
142
143 STDMETHOD(GetBindResult)(CLSID* protocol, DWORD* result_code,
144 LPOLESTR* result, DWORD* reserved) {
145 DCHECK(delegate_);
146 if (!delegate_)
147 return E_FAIL;
148 return delegate_->GetBindResult(protocol, result_code, result, reserved);
149 }
150
151 protected:
152 ScopedComPtr<IBinding> delegate_;
153 };
154
155 #endif // CHROME_FRAME_URLMON_MONIKER_BASE_H_
156
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698