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

Side by Side Diff: chrome_frame/bind_status_callback_impl.cc

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
Property Changes:
Added: svn:eol-style
+ LF
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 #include "chrome_frame/bind_status_callback_impl.h"
6
7 #include "base/logging.h"
8 #include "base/string_util.h"
9
10 BSCBImpl::BSCBImpl() {
11 DLOG(INFO) << __FUNCTION__ << me();
12 }
13
14 BSCBImpl::~BSCBImpl() {
15 DLOG(INFO) << __FUNCTION__ << me();
16 }
17
18 std::string BSCBImpl::me() {
19 return StringPrintf(" obj=0x%08X",
20 static_cast<BSCBImpl*>(this));
21 }
22
23 HRESULT BSCBImpl::DelegateQI(void* obj, REFIID iid, void** ret, DWORD cookie) {
24 BSCBImpl* me = reinterpret_cast<BSCBImpl*>(obj);
25 HRESULT hr = E_NOINTERFACE;
26 if (me->delegate_)
27 hr = me->delegate_.QueryInterface(iid, ret);
28 return hr;
29 }
30
31 void BSCBImpl::Initialize(IBindStatusCallback* original) {
32 DCHECK(!delegate_);
33 delegate_ = original;
34 }
35
36 HRESULT BSCBImpl::AttachToBind(IBindCtx* bind_ctx) {
37 HRESULT hr = S_OK;
38 hr = ::RegisterBindStatusCallback(bind_ctx, this, delegate_.Receive(), 0);
39 if (SUCCEEDED(hr)) {
40 bind_ctx_ = bind_ctx;
41 }
42
43 return hr;
44 }
45
46 HRESULT BSCBImpl::ReleaseBind() {
47 HRESULT hr = S_OK;
48 if (delegate_ && bind_ctx_) {
49 ScopedComPtr<IBindStatusCallback> this_callback;
50 hr = ::RegisterBindStatusCallback(bind_ctx_, delegate_,
51 this_callback.Receive(), 0);
52 DCHECK(this_callback &&
53 (this_callback == static_cast<IBindStatusCallback*>(this)));
54 }
55
56 delegate_.Release();
57 bind_ctx_.Release();
58 return hr;
59 }
60
61 // IServiceProvider
62 HRESULT BSCBImpl::QueryService(REFGUID service, REFIID iid, void** object) {
63 HRESULT hr = E_NOINTERFACE;
64 if (delegate_) {
65 ScopedComPtr<IServiceProvider> svc;
66 svc.QueryFrom(delegate_);
67 if (svc) {
68 hr = svc->QueryService(service, iid, object);
69 }
70 }
71 return hr;
72 }
73
74 // IBindStatusCallback
75 HRESULT BSCBImpl::OnStartBinding(DWORD reserved, IBinding* binding) {
76 DLOG(INFO) << __FUNCTION__ << me() << StringPrintf(" tid=%i",
77 PlatformThread::CurrentId());
78 HRESULT hr = S_OK;
79 if (delegate_)
80 hr = delegate_->OnStartBinding(reserved, binding);
81 return hr;
82 }
83
84 HRESULT BSCBImpl::GetPriority(LONG* priority) {
85 DLOG(INFO) << __FUNCTION__ << me() << StringPrintf(" tid=%i",
86 PlatformThread::CurrentId());
87 HRESULT hr = S_OK;
88 if (delegate_)
89 hr = delegate_->GetPriority(priority);
90 return hr;
91 }
92
93 HRESULT BSCBImpl::OnLowResource(DWORD reserved) {
94 DLOG(INFO) << __FUNCTION__ << me() << StringPrintf(" tid=%i",
95 PlatformThread::CurrentId());
96 HRESULT hr = S_OK;
97 if (delegate_)
98 hr = delegate_->OnLowResource(reserved);
99 return hr;
100 }
101
102 HRESULT BSCBImpl::OnProgress(ULONG progress, ULONG progress_max,
103 ULONG status_code, LPCWSTR status_text) {
104 DLOG(INFO) << __FUNCTION__ << me() << StringPrintf(" status=%i tid=%i %ls",
105 status_code, PlatformThread::CurrentId(), status_text);
106 HRESULT hr = S_OK;
107 if (delegate_)
108 delegate_->OnProgress(progress, progress_max, status_code, status_text);
109 return hr;
110 }
111
112 HRESULT BSCBImpl::OnStopBinding(HRESULT hresult, LPCWSTR error) {
113 DLOG(INFO) << __FUNCTION__ << me() << StringPrintf(" hr=0x%08X '%ls' tid=%i",
114 hresult, error, PlatformThread::CurrentId());
115 HRESULT hr = S_OK;
116 if (delegate_)
117 delegate_->OnStopBinding(hresult, error);
118 return hr;
119 }
120
121 HRESULT BSCBImpl::GetBindInfo(DWORD* bindf, BINDINFO* bind_info) {
122 DLOG(INFO) << __FUNCTION__ << me() << StringPrintf(" tid=%i",
123 PlatformThread::CurrentId());
124 HRESULT hr = S_OK;
125 if (delegate_)
126 delegate_->GetBindInfo(bindf, bind_info);
127 return hr;
128 }
129
130 HRESULT BSCBImpl::OnDataAvailable(DWORD bscf, DWORD size,
131 FORMATETC* format_etc, STGMEDIUM* stgmed) {
132 DLOG(INFO) << __FUNCTION__ << me() << StringPrintf(" tid=%i",
133 PlatformThread::CurrentId());
134 HRESULT hr = S_OK;
135 if (delegate_)
136 hr = delegate_->OnDataAvailable(bscf, size, format_etc, stgmed);
137 return hr;
138 }
139
140 HRESULT BSCBImpl::OnObjectAvailable(REFIID iid, IUnknown* unk) {
141 DLOG(INFO) << __FUNCTION__ << me() << StringPrintf(" tid=%i",
142 PlatformThread::CurrentId());
143 HRESULT hr = S_OK;
144 if (delegate_)
145 delegate_->OnObjectAvailable(iid, unk);
146 return hr;
147 }
148
149 // IBindStatusCallbackEx
150 HRESULT BSCBImpl::GetBindInfoEx(DWORD* bindf, BINDINFO* bind_info,
151 DWORD* bindf2, DWORD* reserved) {
152 DLOG(INFO) << __FUNCTION__ << me() << StringPrintf(" tid=%i",
153 PlatformThread::CurrentId());
154 HRESULT hr = S_OK;
155 if (delegate_) {
156 ScopedComPtr<IBindStatusCallbackEx> bscbex;
157 bscbex.QueryFrom(delegate_);
158 if (bscbex)
159 hr = bscbex->GetBindInfoEx(bindf, bind_info, bindf2, reserved);
160 }
161 return hr;
162 }
163
164 HRESULT BSCBImpl::BeginningTransaction(LPCWSTR url, LPCWSTR headers,
165 DWORD reserved,
166 LPWSTR* additional_headers) {
167 DLOG(INFO) << __FUNCTION__ << me() << StringPrintf(" tid=%i",
168 PlatformThread::CurrentId());
169
170 HRESULT hr = S_OK;
171 if (delegate_) {
172 ScopedComPtr<IHttpNegotiate> http_negotiate;
173 http_negotiate.QueryFrom(delegate_);
174 if (http_negotiate) {
175 hr = http_negotiate->BeginningTransaction(url, headers, reserved,
176 additional_headers);
177 }
178 }
179
180 DLOG_IF(ERROR, FAILED(hr)) << __FUNCTION__;
181 return hr;
182 }
183
184 HRESULT BSCBImpl::OnResponse(DWORD response_code, LPCWSTR response_headers,
185 LPCWSTR request_headers,
186 LPWSTR* additional_headers) {
187 DLOG(INFO) << __FUNCTION__ << me() << StringPrintf(" tid=%i",
188 PlatformThread::CurrentId());
189
190 HRESULT hr = S_OK;
191 if (delegate_) {
192 ScopedComPtr<IHttpNegotiate> http_negotiate;
193 http_negotiate.QueryFrom(delegate_);
194 if (http_negotiate) {
195 hr = http_negotiate->OnResponse(response_code, response_headers,
196 request_headers, additional_headers);
197 }
198 }
199 return hr;
200 }
201
202 HRESULT BSCBImpl::GetRootSecurityId(BYTE* security_id, DWORD* security_id_size,
203 DWORD_PTR reserved) {
204 HRESULT hr = S_OK;
205 if (delegate_) {
206 ScopedComPtr<IHttpNegotiate2> http_negotiate;
207 http_negotiate.QueryFrom(delegate_);
208 if (http_negotiate) {
209 hr = http_negotiate->GetRootSecurityId(security_id, security_id_size,
210 reserved);
211 }
212 }
213 return hr;
214 }
215
216 HRESULT BSCBImpl::GetSerializedClientCertContext(BYTE** cert,
217 DWORD* cert_size) {
218 HRESULT hr = S_OK;
219 if (delegate_) {
220 ScopedComPtr<IHttpNegotiate3> http_negotiate;
221 http_negotiate.QueryFrom(delegate_);
222 if (http_negotiate) {
223 return http_negotiate->GetSerializedClientCertContext(cert, cert_size);
224 }
225 }
226 return hr;
227 }
228
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698