| 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/urlmon_moniker.h" | 5 #include "chrome_frame/urlmon_moniker.h" |
| 6 | 6 |
| 7 #include <shlguid.h> | 7 #include <shlguid.h> |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome_frame/bho.h" | 10 #include "chrome_frame/bho.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 return should_wrap; | 155 return should_wrap; |
| 156 } | 156 } |
| 157 | 157 |
| 158 // static | 158 // static |
| 159 HRESULT MonikerPatch::BindToObject(IMoniker_BindToObject_Fn original, | 159 HRESULT MonikerPatch::BindToObject(IMoniker_BindToObject_Fn original, |
| 160 IMoniker* me, IBindCtx* bind_ctx, | 160 IMoniker* me, IBindCtx* bind_ctx, |
| 161 IMoniker* to_left, REFIID iid, void** obj) { | 161 IMoniker* to_left, REFIID iid, void** obj) { |
| 162 DLOG(INFO) << __FUNCTION__; | 162 DLOG(INFO) << __FUNCTION__; |
| 163 DCHECK(to_left == NULL); | 163 DCHECK(to_left == NULL); |
| 164 | 164 |
| 165 ExceptionBarrier barrier; | 165 ExceptionBarrierReportOnlyModule barrier; |
| 166 | 166 |
| 167 HRESULT hr = S_OK; | 167 HRESULT hr = S_OK; |
| 168 // Bind context is marked for switch when we sniff data in BSCBStorageBind | 168 // Bind context is marked for switch when we sniff data in BSCBStorageBind |
| 169 // and determine that the renderer to be used is Chrome. | 169 // and determine that the renderer to be used is Chrome. |
| 170 scoped_refptr<BindContextInfo> info = | 170 scoped_refptr<BindContextInfo> info = |
| 171 BindContextInfo::FromBindContext(bind_ctx); | 171 BindContextInfo::FromBindContext(bind_ctx); |
| 172 DCHECK(info); | 172 DCHECK(info); |
| 173 if (info) { | 173 if (info) { |
| 174 if (info->is_switching()) { | 174 if (info->is_switching()) { |
| 175 // We could implement the BindToObject ourselves here but instead we | 175 // We could implement the BindToObject ourselves here but instead we |
| (...skipping 22 matching lines...) Expand all Loading... |
| 198 DCHECK(to_left == NULL); | 198 DCHECK(to_left == NULL); |
| 199 | 199 |
| 200 HRESULT hr = S_OK; | 200 HRESULT hr = S_OK; |
| 201 CComObject<BSCBStorageBind>* callback = NULL; | 201 CComObject<BSCBStorageBind>* callback = NULL; |
| 202 if (ShouldWrapCallback(me, iid, bind_ctx)) { | 202 if (ShouldWrapCallback(me, iid, bind_ctx)) { |
| 203 hr = CComObject<BSCBStorageBind>::CreateInstance(&callback); | 203 hr = CComObject<BSCBStorageBind>::CreateInstance(&callback); |
| 204 callback->AddRef(); | 204 callback->AddRef(); |
| 205 hr = callback->Initialize(me, bind_ctx); | 205 hr = callback->Initialize(me, bind_ctx); |
| 206 DCHECK(SUCCEEDED(hr)); | 206 DCHECK(SUCCEEDED(hr)); |
| 207 | 207 |
| 208 // Call the original back under an exception barrier only if we should | 208 // Report all crashes in the exception handler if we wrap the callback. |
| 209 // wrap the callback. | 209 // Note that this avoids having the VEH report a crash if an SEH earlier in |
| 210 // the chain handles the exception. |
| 210 ExceptionBarrier barrier; | 211 ExceptionBarrier barrier; |
| 211 hr = original(me, bind_ctx, to_left, iid, obj); | 212 hr = original(me, bind_ctx, to_left, iid, obj); |
| 212 } else { | 213 } else { |
| 214 // If we don't wrap, only report a crash if the crash is in our own module. |
| 215 ExceptionBarrierReportOnlyModule barrier; |
| 213 hr = original(me, bind_ctx, to_left, iid, obj); | 216 hr = original(me, bind_ctx, to_left, iid, obj); |
| 214 } | 217 } |
| 215 | 218 |
| 216 // If the binding terminates before the data could be played back | 219 // If the binding terminates before the data could be played back |
| 217 // now is the chance. Sometimes OnStopBinding happens after this returns | 220 // now is the chance. Sometimes OnStopBinding happens after this returns |
| 218 // and then it's too late. | 221 // and then it's too late. |
| 219 if ((S_OK == hr) && callback) | 222 if ((S_OK == hr) && callback) |
| 220 callback->MayPlayBack(BSCF_LASTDATANOTIFICATION); | 223 callback->MayPlayBack(BSCF_LASTDATANOTIFICATION); |
| 221 return hr; | 224 return hr; |
| 222 } | 225 } |
| 223 | 226 |
| OLD | NEW |