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