| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome_frame/bind_status_callback_impl.h" | 5 #include "chrome_frame/bind_status_callback_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 | 10 |
| 11 BSCBImpl::BSCBImpl() { | 11 BSCBImpl::BSCBImpl() { |
| 12 DLOG(INFO) << __FUNCTION__ << me(); | 12 DVLOG(1) << __FUNCTION__ << me(); |
| 13 } | 13 } |
| 14 | 14 |
| 15 BSCBImpl::~BSCBImpl() { | 15 BSCBImpl::~BSCBImpl() { |
| 16 DLOG(INFO) << __FUNCTION__ << me(); | 16 DVLOG(1) << __FUNCTION__ << me(); |
| 17 } | 17 } |
| 18 | 18 |
| 19 std::string BSCBImpl::me() { | 19 std::string BSCBImpl::me() { |
| 20 return base::StringPrintf(" obj=0x%08X", static_cast<BSCBImpl*>(this)); | 20 return base::StringPrintf(" obj=0x%08X", static_cast<BSCBImpl*>(this)); |
| 21 } | 21 } |
| 22 | 22 |
| 23 HRESULT BSCBImpl::DelegateQI(void* obj, REFIID iid, void** ret, DWORD cookie) { | 23 HRESULT BSCBImpl::DelegateQI(void* obj, REFIID iid, void** ret, DWORD cookie) { |
| 24 BSCBImpl* me = reinterpret_cast<BSCBImpl*>(obj); | 24 BSCBImpl* me = reinterpret_cast<BSCBImpl*>(obj); |
| 25 HRESULT hr = E_NOINTERFACE; | 25 HRESULT hr = E_NOINTERFACE; |
| 26 if (me->delegate_) | 26 if (me->delegate_) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 svc.QueryFrom(delegate_); | 68 svc.QueryFrom(delegate_); |
| 69 if (svc) { | 69 if (svc) { |
| 70 hr = svc->QueryService(service, iid, object); | 70 hr = svc->QueryService(service, iid, object); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 return hr; | 73 return hr; |
| 74 } | 74 } |
| 75 | 75 |
| 76 // IBindStatusCallback | 76 // IBindStatusCallback |
| 77 HRESULT BSCBImpl::OnStartBinding(DWORD reserved, IBinding* binding) { | 77 HRESULT BSCBImpl::OnStartBinding(DWORD reserved, IBinding* binding) { |
| 78 DLOG(INFO) << __FUNCTION__ << me() << base::StringPrintf(" tid=%i", | 78 DVLOG(1) << __FUNCTION__ << me() |
| 79 PlatformThread::CurrentId()); | 79 << base::StringPrintf(" tid=%i", PlatformThread::CurrentId()); |
| 80 HRESULT hr = S_OK; | 80 HRESULT hr = S_OK; |
| 81 if (delegate_) | 81 if (delegate_) |
| 82 hr = delegate_->OnStartBinding(reserved, binding); | 82 hr = delegate_->OnStartBinding(reserved, binding); |
| 83 return hr; | 83 return hr; |
| 84 } | 84 } |
| 85 | 85 |
| 86 HRESULT BSCBImpl::GetPriority(LONG* priority) { | 86 HRESULT BSCBImpl::GetPriority(LONG* priority) { |
| 87 DLOG(INFO) << __FUNCTION__ << me() << base::StringPrintf(" tid=%i", | 87 DVLOG(1) << __FUNCTION__ << me() |
| 88 PlatformThread::CurrentId()); | 88 << base::StringPrintf(" tid=%i", PlatformThread::CurrentId()); |
| 89 HRESULT hr = S_OK; | 89 HRESULT hr = S_OK; |
| 90 if (delegate_) | 90 if (delegate_) |
| 91 hr = delegate_->GetPriority(priority); | 91 hr = delegate_->GetPriority(priority); |
| 92 return hr; | 92 return hr; |
| 93 } | 93 } |
| 94 | 94 |
| 95 HRESULT BSCBImpl::OnLowResource(DWORD reserved) { | 95 HRESULT BSCBImpl::OnLowResource(DWORD reserved) { |
| 96 DLOG(INFO) << __FUNCTION__ << me() << base::StringPrintf(" tid=%i", | 96 DVLOG(1) << __FUNCTION__ << me() |
| 97 PlatformThread::CurrentId()); | 97 << base::StringPrintf(" tid=%i", PlatformThread::CurrentId()); |
| 98 HRESULT hr = S_OK; | 98 HRESULT hr = S_OK; |
| 99 if (delegate_) | 99 if (delegate_) |
| 100 hr = delegate_->OnLowResource(reserved); | 100 hr = delegate_->OnLowResource(reserved); |
| 101 return hr; | 101 return hr; |
| 102 } | 102 } |
| 103 | 103 |
| 104 HRESULT BSCBImpl::OnProgress(ULONG progress, ULONG progress_max, | 104 HRESULT BSCBImpl::OnProgress(ULONG progress, ULONG progress_max, |
| 105 ULONG status_code, LPCWSTR status_text) { | 105 ULONG status_code, LPCWSTR status_text) { |
| 106 DLOG(INFO) << __FUNCTION__ << me() << base::StringPrintf( | 106 DVLOG(1) << __FUNCTION__ << me() |
| 107 " status=%i tid=%i %ls", status_code, PlatformThread::CurrentId(), | 107 << base::StringPrintf(" status=%i tid=%i %ls", status_code, |
| 108 status_text); | 108 PlatformThread::CurrentId(), status_text); |
| 109 HRESULT hr = S_OK; | 109 HRESULT hr = S_OK; |
| 110 if (delegate_) | 110 if (delegate_) |
| 111 delegate_->OnProgress(progress, progress_max, status_code, status_text); | 111 delegate_->OnProgress(progress, progress_max, status_code, status_text); |
| 112 return hr; | 112 return hr; |
| 113 } | 113 } |
| 114 | 114 |
| 115 HRESULT BSCBImpl::OnStopBinding(HRESULT hresult, LPCWSTR error) { | 115 HRESULT BSCBImpl::OnStopBinding(HRESULT hresult, LPCWSTR error) { |
| 116 DLOG(INFO) << __FUNCTION__ << me() << base::StringPrintf( | 116 DVLOG(1) << __FUNCTION__ << me() |
| 117 " hr=0x%08X '%ls' tid=%i", hresult, error, PlatformThread::CurrentId()); | 117 << base::StringPrintf(" hr=0x%08X '%ls' tid=%i", hresult, error, |
| 118 PlatformThread::CurrentId()); |
| 118 HRESULT hr = S_OK; | 119 HRESULT hr = S_OK; |
| 119 if (delegate_) | 120 if (delegate_) |
| 120 delegate_->OnStopBinding(hresult, error); | 121 delegate_->OnStopBinding(hresult, error); |
| 121 return hr; | 122 return hr; |
| 122 } | 123 } |
| 123 | 124 |
| 124 HRESULT BSCBImpl::GetBindInfo(DWORD* bindf, BINDINFO* bind_info) { | 125 HRESULT BSCBImpl::GetBindInfo(DWORD* bindf, BINDINFO* bind_info) { |
| 125 DLOG(INFO) << __FUNCTION__ << me() << base::StringPrintf(" tid=%i", | 126 DVLOG(1) << __FUNCTION__ << me() |
| 126 PlatformThread::CurrentId()); | 127 << base::StringPrintf(" tid=%i", PlatformThread::CurrentId()); |
| 127 HRESULT hr = S_OK; | 128 HRESULT hr = S_OK; |
| 128 if (delegate_) | 129 if (delegate_) |
| 129 delegate_->GetBindInfo(bindf, bind_info); | 130 delegate_->GetBindInfo(bindf, bind_info); |
| 130 return hr; | 131 return hr; |
| 131 } | 132 } |
| 132 | 133 |
| 133 HRESULT BSCBImpl::OnDataAvailable(DWORD bscf, DWORD size, | 134 HRESULT BSCBImpl::OnDataAvailable(DWORD bscf, DWORD size, |
| 134 FORMATETC* format_etc, STGMEDIUM* stgmed) { | 135 FORMATETC* format_etc, STGMEDIUM* stgmed) { |
| 135 DLOG(INFO) << __FUNCTION__ << me() << base::StringPrintf(" tid=%i", | 136 DVLOG(1) << __FUNCTION__ << me() |
| 136 PlatformThread::CurrentId()); | 137 << base::StringPrintf(" tid=%i", PlatformThread::CurrentId()); |
| 137 HRESULT hr = S_OK; | 138 HRESULT hr = S_OK; |
| 138 if (delegate_) | 139 if (delegate_) |
| 139 hr = delegate_->OnDataAvailable(bscf, size, format_etc, stgmed); | 140 hr = delegate_->OnDataAvailable(bscf, size, format_etc, stgmed); |
| 140 return hr; | 141 return hr; |
| 141 } | 142 } |
| 142 | 143 |
| 143 HRESULT BSCBImpl::OnObjectAvailable(REFIID iid, IUnknown* unk) { | 144 HRESULT BSCBImpl::OnObjectAvailable(REFIID iid, IUnknown* unk) { |
| 144 DLOG(INFO) << __FUNCTION__ << me() << base::StringPrintf(" tid=%i", | 145 DVLOG(1) << __FUNCTION__ << me() |
| 145 PlatformThread::CurrentId()); | 146 << base::StringPrintf(" tid=%i", PlatformThread::CurrentId()); |
| 146 HRESULT hr = S_OK; | 147 HRESULT hr = S_OK; |
| 147 if (delegate_) | 148 if (delegate_) |
| 148 delegate_->OnObjectAvailable(iid, unk); | 149 delegate_->OnObjectAvailable(iid, unk); |
| 149 return hr; | 150 return hr; |
| 150 } | 151 } |
| 151 | 152 |
| 152 // IBindStatusCallbackEx | 153 // IBindStatusCallbackEx |
| 153 HRESULT BSCBImpl::GetBindInfoEx(DWORD* bindf, BINDINFO* bind_info, | 154 HRESULT BSCBImpl::GetBindInfoEx(DWORD* bindf, BINDINFO* bind_info, |
| 154 DWORD* bindf2, DWORD* reserved) { | 155 DWORD* bindf2, DWORD* reserved) { |
| 155 DLOG(INFO) << __FUNCTION__ << me() << base::StringPrintf(" tid=%i", | 156 DVLOG(1) << __FUNCTION__ << me() |
| 156 PlatformThread::CurrentId()); | 157 << base::StringPrintf(" tid=%i", PlatformThread::CurrentId()); |
| 157 HRESULT hr = S_OK; | 158 HRESULT hr = S_OK; |
| 158 if (delegate_) { | 159 if (delegate_) { |
| 159 ScopedComPtr<IBindStatusCallbackEx> bscbex; | 160 ScopedComPtr<IBindStatusCallbackEx> bscbex; |
| 160 bscbex.QueryFrom(delegate_); | 161 bscbex.QueryFrom(delegate_); |
| 161 if (bscbex) | 162 if (bscbex) |
| 162 hr = bscbex->GetBindInfoEx(bindf, bind_info, bindf2, reserved); | 163 hr = bscbex->GetBindInfoEx(bindf, bind_info, bindf2, reserved); |
| 163 } | 164 } |
| 164 return hr; | 165 return hr; |
| 165 } | 166 } |
| 166 | 167 |
| 167 HRESULT BSCBImpl::BeginningTransaction(LPCWSTR url, LPCWSTR headers, | 168 HRESULT BSCBImpl::BeginningTransaction(LPCWSTR url, LPCWSTR headers, |
| 168 DWORD reserved, | 169 DWORD reserved, |
| 169 LPWSTR* additional_headers) { | 170 LPWSTR* additional_headers) { |
| 170 DLOG(INFO) << __FUNCTION__ << me() << base::StringPrintf(" tid=%i", | 171 DVLOG(1) << __FUNCTION__ << me() |
| 171 PlatformThread::CurrentId()); | 172 << base::StringPrintf(" tid=%i", PlatformThread::CurrentId()); |
| 172 | 173 |
| 173 HRESULT hr = S_OK; | 174 HRESULT hr = S_OK; |
| 174 if (delegate_) { | 175 if (delegate_) { |
| 175 ScopedComPtr<IHttpNegotiate> http_negotiate; | 176 ScopedComPtr<IHttpNegotiate> http_negotiate; |
| 176 http_negotiate.QueryFrom(delegate_); | 177 http_negotiate.QueryFrom(delegate_); |
| 177 if (http_negotiate) { | 178 if (http_negotiate) { |
| 178 hr = http_negotiate->BeginningTransaction(url, headers, reserved, | 179 hr = http_negotiate->BeginningTransaction(url, headers, reserved, |
| 179 additional_headers); | 180 additional_headers); |
| 180 } | 181 } |
| 181 } | 182 } |
| 182 | 183 |
| 183 DLOG_IF(ERROR, FAILED(hr)) << __FUNCTION__; | 184 DLOG_IF(ERROR, FAILED(hr)) << __FUNCTION__; |
| 184 return hr; | 185 return hr; |
| 185 } | 186 } |
| 186 | 187 |
| 187 HRESULT BSCBImpl::OnResponse(DWORD response_code, LPCWSTR response_headers, | 188 HRESULT BSCBImpl::OnResponse(DWORD response_code, LPCWSTR response_headers, |
| 188 LPCWSTR request_headers, | 189 LPCWSTR request_headers, |
| 189 LPWSTR* additional_headers) { | 190 LPWSTR* additional_headers) { |
| 190 DLOG(INFO) << __FUNCTION__ << me() << base::StringPrintf(" tid=%i", | 191 DVLOG(1) << __FUNCTION__ << me() |
| 191 PlatformThread::CurrentId()); | 192 << base::StringPrintf(" tid=%i", PlatformThread::CurrentId()); |
| 192 | 193 |
| 193 HRESULT hr = S_OK; | 194 HRESULT hr = S_OK; |
| 194 if (delegate_) { | 195 if (delegate_) { |
| 195 ScopedComPtr<IHttpNegotiate> http_negotiate; | 196 ScopedComPtr<IHttpNegotiate> http_negotiate; |
| 196 http_negotiate.QueryFrom(delegate_); | 197 http_negotiate.QueryFrom(delegate_); |
| 197 if (http_negotiate) { | 198 if (http_negotiate) { |
| 198 hr = http_negotiate->OnResponse(response_code, response_headers, | 199 hr = http_negotiate->OnResponse(response_code, response_headers, |
| 199 request_headers, additional_headers); | 200 request_headers, additional_headers); |
| 200 } | 201 } |
| 201 } | 202 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 222 if (delegate_) { | 223 if (delegate_) { |
| 223 ScopedComPtr<IHttpNegotiate3> http_negotiate; | 224 ScopedComPtr<IHttpNegotiate3> http_negotiate; |
| 224 http_negotiate.QueryFrom(delegate_); | 225 http_negotiate.QueryFrom(delegate_); |
| 225 if (http_negotiate) { | 226 if (http_negotiate) { |
| 226 return http_negotiate->GetSerializedClientCertContext(cert, cert_size); | 227 return http_negotiate->GetSerializedClientCertContext(cert, cert_size); |
| 227 } | 228 } |
| 228 } | 229 } |
| 229 return hr; | 230 return hr; |
| 230 } | 231 } |
| 231 | 232 |
| OLD | NEW |