| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/bho.h" | 5 #include "chrome_frame/bho.h" |
| 6 | 6 |
| 7 #include <shlguid.h> | 7 #include <shlguid.h> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 // the current navigation (if all data is available) and fire off | 244 // the current navigation (if all data is available) and fire off |
| 245 // script events such as onload and even render the page. | 245 // script events such as onload and even render the page. |
| 246 // This will happen inside NavigateBrowserToMoniker below. | 246 // This will happen inside NavigateBrowserToMoniker below. |
| 247 // To work around this, we clear the contents of the document before | 247 // To work around this, we clear the contents of the document before |
| 248 // opening it up in CF. | 248 // opening it up in CF. |
| 249 ClearDocumentContents(browser); | 249 ClearDocumentContents(browser); |
| 250 mgr->NavigateToCurrentUrlInCF(browser); | 250 mgr->NavigateToCurrentUrlInCF(browser); |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 } else if (done) { | |
| 255 if (!CheckForCFNavigation(browser, false)) { | |
| 256 DLOG(INFO) << "Releasing cached data."; | |
| 257 NavigationManager* mgr = NavigationManager::GetThreadInstance(); | |
| 258 if (mgr) | |
| 259 mgr->ReleaseRequestData(); | |
| 260 } else { | |
| 261 DLOG(INFO) << __FUNCTION__ | |
| 262 << " not freeing request data - browser tagged"; | |
| 263 } | |
| 264 } | 254 } |
| 265 | 255 |
| 266 return original_httpequiv(browser, shell_view, done, in_arg, out_arg); | 256 return original_httpequiv(browser, shell_view, done, in_arg, out_arg); |
| 267 } | 257 } |
| 268 | 258 |
| 269 // static | 259 // static |
| 270 void Bho::ProcessOptInUrls(IWebBrowser2* browser, BSTR url) { | 260 void Bho::ProcessOptInUrls(IWebBrowser2* browser, BSTR url) { |
| 271 if (!browser || !url) { | 261 if (!browser || !url) { |
| 272 NOTREACHED(); | 262 NOTREACHED(); |
| 273 return; | 263 return; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 // If we're going to start patching things for reals, we'd better make sure | 309 // If we're going to start patching things for reals, we'd better make sure |
| 320 // that we stick around for ever more: | 310 // that we stick around for ever more: |
| 321 if (!IsUnpinnedMode()) | 311 if (!IsUnpinnedMode()) |
| 322 PinModule(); | 312 PinModule(); |
| 323 | 313 |
| 324 HttpNegotiatePatch::Initialize(); | 314 HttpNegotiatePatch::Initialize(); |
| 325 | 315 |
| 326 ProtocolPatchMethod patch_method = | 316 ProtocolPatchMethod patch_method = |
| 327 static_cast<ProtocolPatchMethod>( | 317 static_cast<ProtocolPatchMethod>( |
| 328 GetConfigInt(PATCH_METHOD_IBROWSER, kPatchProtocols)); | 318 GetConfigInt(PATCH_METHOD_IBROWSER, kPatchProtocols)); |
| 329 | |
| 330 if (patch_method == PATCH_METHOD_INET_PROTOCOL) { | 319 if (patch_method == PATCH_METHOD_INET_PROTOCOL) { |
| 331 ProtocolSinkWrap::PatchProtocolHandlers(); | 320 ProtocolSinkWrap::PatchProtocolHandlers(); |
| 332 state_ = PATCH_PROTOCOL; | 321 state_ = PATCH_PROTOCOL; |
| 322 } else if (patch_method == PATCH_METHOD_IBROWSER) { |
| 323 state_ = PATCH_IBROWSER; |
| 333 } else { | 324 } else { |
| 334 DCHECK(patch_method == PATCH_METHOD_IBROWSER || | 325 DCHECK(patch_method == PATCH_METHOD_MONIKER); |
| 335 patch_method == PATCH_METHOD_IBROWSER_AND_MONIKER); | 326 state_ = PATCH_MONIKER; |
| 336 state_ = PATCH_IBROWSER; | 327 MonikerPatch::Initialize(); |
| 337 if (patch_method == PATCH_METHOD_IBROWSER_AND_MONIKER) { | |
| 338 MonikerPatch::Initialize(); | |
| 339 } | |
| 340 } | 328 } |
| 329 |
| 341 ret = true; | 330 ret = true; |
| 342 } | 331 } |
| 343 | 332 |
| 344 _pAtlModule->m_csStaticDataInitAndTypeInfo.Unlock(); | 333 _pAtlModule->m_csStaticDataInitAndTypeInfo.Unlock(); |
| 345 | 334 |
| 346 return ret; | 335 return ret; |
| 347 } | 336 } |
| 348 | 337 |
| 349 void PatchHelper::PatchBrowserService(IBrowserService* browser_service) { | 338 void PatchHelper::PatchBrowserService(IBrowserService* browser_service) { |
| 350 DCHECK(state_ == PATCH_IBROWSER); | 339 DCHECK(state_ == PATCH_IBROWSER); |
| 351 if (!IS_PATCHED(IBrowserService)) { | 340 if (!IS_PATCHED(IBrowserService)) { |
| 352 vtable_patch::PatchInterfaceMethods(browser_service, | 341 vtable_patch::PatchInterfaceMethods(browser_service, |
| 353 IBrowserService_PatchInfo); | 342 IBrowserService_PatchInfo); |
| 354 } | 343 } |
| 355 } | 344 } |
| 356 | 345 |
| 357 void PatchHelper::UnpatchIfNeeded() { | 346 void PatchHelper::UnpatchIfNeeded() { |
| 358 if (state_ == PATCH_PROTOCOL) { | 347 if (state_ == PATCH_PROTOCOL) { |
| 359 ProtocolSinkWrap::UnpatchProtocolHandlers(); | 348 ProtocolSinkWrap::UnpatchProtocolHandlers(); |
| 360 } else if (state_ == PATCH_IBROWSER) { | 349 } else if (state_ == PATCH_IBROWSER) { |
| 361 vtable_patch::UnpatchInterfaceMethods(IBrowserService_PatchInfo); | 350 vtable_patch::UnpatchInterfaceMethods(IBrowserService_PatchInfo); |
| 362 MonikerPatch::Uninitialize(); | 351 MonikerPatch::Uninitialize(); |
| 363 } | 352 } |
| 364 | 353 |
| 365 HttpNegotiatePatch::Uninitialize(); | 354 HttpNegotiatePatch::Uninitialize(); |
| 366 | 355 |
| 367 state_ = UNKNOWN; | 356 state_ = UNKNOWN; |
| 368 } | 357 } |
| 369 | 358 |
| OLD | NEW |